From 7fced41eb8f3cf62d080f06702c72790238ad177 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Wed, 4 Oct 2023 10:18:01 +0530 Subject: [PATCH 01/27] added qsm quiz block --- .gitignore | 3 +- blocks/block.php | 241 +- blocks/build/answer-option/block.json | 46 + blocks/build/answer-option/index.asset.php | 1 + blocks/build/answer-option/index.js | 367 + blocks/build/answer-option/index.js.map | 1 + blocks/build/block.json | 29 + blocks/build/index.asset.php | 1 + blocks/build/index.css | 51 + blocks/build/index.css.map | 1 + blocks/build/index.js | 671 + blocks/build/index.js.map | 1 + blocks/build/page/block.json | 43 + blocks/build/page/index.asset.php | 1 + blocks/build/page/index.js | 281 + blocks/build/page/index.js.map | 1 + blocks/build/question/block.json | 98 + blocks/build/question/index.asset.php | 1 + blocks/build/question/index.js | 420 + blocks/build/question/index.js.map | 1 + blocks/build/render.php | 8 + blocks/build/style-index.css | 11 + blocks/build/style-index.css.map | 1 + blocks/build/view.asset.php | 1 + blocks/build/view.js | 29 + blocks/build/view.js.map | 1 + blocks/package-lock.json | 16714 +++++++++++++++++++ blocks/package.json | 20 + blocks/src/answer-option/block.json | 40 + blocks/src/answer-option/edit.js | 125 + blocks/src/answer-option/index.js | 14 + blocks/src/block.json | 29 + blocks/src/edit.js | 381 + blocks/src/editor.scss | 55 + blocks/src/helper.js | 16 + blocks/src/index.js | 12 + blocks/src/page/block.json | 39 + blocks/src/page/edit.js | 77 + blocks/src/page/index.js | 10 + blocks/src/question/block.json | 93 + blocks/src/question/edit.js | 212 + blocks/src/question/index.js | 10 + blocks/src/render.php | 8 + blocks/src/style.scss | 12 + blocks/src/view.js | 21 + php/rest-api.php | 114 + 46 files changed, 20264 insertions(+), 48 deletions(-) create mode 100644 blocks/build/answer-option/block.json create mode 100644 blocks/build/answer-option/index.asset.php create mode 100644 blocks/build/answer-option/index.js create mode 100644 blocks/build/answer-option/index.js.map create mode 100644 blocks/build/block.json create mode 100644 blocks/build/index.asset.php create mode 100644 blocks/build/index.css create mode 100644 blocks/build/index.css.map create mode 100644 blocks/build/index.js create mode 100644 blocks/build/index.js.map create mode 100644 blocks/build/page/block.json create mode 100644 blocks/build/page/index.asset.php create mode 100644 blocks/build/page/index.js create mode 100644 blocks/build/page/index.js.map create mode 100644 blocks/build/question/block.json create mode 100644 blocks/build/question/index.asset.php create mode 100644 blocks/build/question/index.js create mode 100644 blocks/build/question/index.js.map create mode 100644 blocks/build/render.php create mode 100644 blocks/build/style-index.css create mode 100644 blocks/build/style-index.css.map create mode 100644 blocks/build/view.asset.php create mode 100644 blocks/build/view.js create mode 100644 blocks/build/view.js.map create mode 100644 blocks/package-lock.json create mode 100644 blocks/package.json create mode 100644 blocks/src/answer-option/block.json create mode 100644 blocks/src/answer-option/edit.js create mode 100644 blocks/src/answer-option/index.js create mode 100644 blocks/src/block.json create mode 100644 blocks/src/edit.js create mode 100644 blocks/src/editor.scss create mode 100644 blocks/src/helper.js create mode 100644 blocks/src/index.js create mode 100644 blocks/src/page/block.json create mode 100644 blocks/src/page/edit.js create mode 100644 blocks/src/page/index.js create mode 100644 blocks/src/question/block.json create mode 100644 blocks/src/question/edit.js create mode 100644 blocks/src/question/index.js create mode 100644 blocks/src/render.php create mode 100644 blocks/src/style.scss create mode 100644 blocks/src/view.js diff --git a/.gitignore b/.gitignore index 1a45c0c27..02c7cfd7e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ chromedriver php/classes/composer.json .DS_Store .vscode -phpcs.xml \ No newline at end of file +phpcs.xml +node_modules \ No newline at end of file diff --git a/blocks/block.php b/blocks/block.php index a588b0ebb..82e07002e 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -1,57 +1,204 @@ =' ) ) { - $dependencies = array_merge( $dependencies, array( 'wp-block-editor', 'wp-server-side-render' ) ); - } +if ( ! class_exists( 'QSMBlock' ) ) { - // Register our block editor script. - wp_register_script( 'qsm-quiz-block', plugins_url( 'block.js', __FILE__ ), $dependencies, $mlwQuizMasterNext->version, true ); - - // Register our block, and explicitly define the attributes we accept. - register_block_type( 'qsm/main-block', array( - 'attributes' => array( - 'quiz' => array( - 'type' => 'string', - ), - 'quiz_id' => array( - 'type' => 'array', - 'default' => array( - array( - 'label' => 'quiz name', - 'value' => '0', - ), - ), - ), - ), - 'editor_script' => 'qsm-quiz-block', - 'render_callback' => 'qsm_block_render', - ) ); -} -add_action( 'init', 'qsm_block_init' ); + class QSMBlock { -/** - * The block renderer. - * - * This simply calls our main shortcode renderer. - * - * @param array $attributes The attributes that were set on the block. - */ -function qsm_block_render( $attributes ) { - global $qmnQuizManager; - return $qmnQuizManager->display_shortcode( $attributes ); + // The instance of this class + private static $instance = null; + + // Returns the instance of this class. + public static function get_instance() { + if ( null === self::$instance ) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * Main Construct Function + * + * @return void + */ + public function __construct() { + add_action( 'init', array( $this, 'register_block' ) ); + //Fires after block assets have been enqueued for the editing interface + add_action( 'enqueue_block_editor_assets', array( $this, 'register_block_scripts' ) ); + } + + /** + * Register block. + */ + public function register_block() { + if ( ! function_exists( 'register_block_type' ) ) { + // Block editor is not available. + return; + } + //register legacy block + $this->qsm_block_register_legacy(); + // QSM Main Block + register_block_type( + __DIR__ . '/build', + array( + 'render_callback' => array( $this, 'qsm_block_render' ), + ) + ); + + foreach ( array( 'page', 'question', 'answer-option' ) as $block_dir ) { + register_block_type( + __DIR__ . '/build/'.$block_dir, + array( + 'render_callback' => array( $this, 'render_block_content' ), + ) + ); + } + + } + + /** + * legacy block + */ + private function qsm_block_register_legacy() { + global $wp_version, $mlwQuizMasterNext; + $dependencies = array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor', 'wp-api-request' ); + if ( version_compare( $wp_version, '5.3', '>=' ) ) { + $dependencies = array_merge( $dependencies, array( 'wp-block-editor', 'wp-server-side-render' ) ); + } + + // Register our block editor script. + wp_register_script( 'qsm-quiz-block', plugins_url( 'block.js', __FILE__ ), $dependencies, $mlwQuizMasterNext->version, true ); + + // Register our block, and explicitly define the attributes we accept. + register_block_type( 'qsm/main-block', array( + 'attributes' => array( + 'quiz' => array( + 'type' => 'string', + ), + 'quiz_id' => array( + 'type' => 'array', + 'default' => array( + array( + 'label' => 'quiz name', + 'value' => '0', + ), + ), + ), + ), + 'editor_script' => 'qsm-quiz-block', + 'render_callback' => array( $this, 'qsm_block_render' ), + ) ); + } + + /** + * Register scripts for block + */ + public function register_block_scripts() { + global $globalQuizsetting, $mlwQuizMasterNext; + if ( empty( $globalQuizsetting ) || empty( $mlwQuizMasterNext ) || ! function_exists( 'qsm_get_plugin_link' ) ) { + return; + } + + $quiz_options = $mlwQuizMasterNext->quiz_settings->load_setting_fields( 'quiz_options' ); + $quiz_options_id_details = array( + 'enable_contact_form' => array( + 'label' => __( 'Enable Contact Form', 'quiz-master-next' ), + 'help' => __( 'Display a contact form before quiz', 'quiz-master-next' ), + ), + ); + if ( ! empty( $quiz_options ) && is_array( $quiz_options ) ) { + foreach ( $quiz_options as $quiz ) { + if ( ! empty( $quiz ) && ! empty( $quiz['id'] ) ) { + $quiz_options_id_details[ $quiz['id'] ] = $quiz; + } + } + } + + $question_type = $mlwQuizMasterNext->pluginHelper->categorize_question_types(); + $question_types = array(); + if ( ! empty( $question_type ) && is_array( $question_type ) ) { + foreach ($question_type as $category => $qtypes ) { + $question_types[] = array( + 'category' => $category, + 'types' => array_values( $qtypes ) + ); + } + } + + wp_localize_script( + 'qsm-quiz-editor-script', + 'qsmBlockData', + array( + 'ajax_url' => admin_url( 'admin-ajax.php' ), + 'nonce' => wp_create_nonce( 'qsm_nlock_quiz' ), + 'globalQuizsetting' => array_merge( + $globalQuizsetting, + array( + 'enable_contact_form' => 0 + ) + ), + 'QSMQuizList' => function_exists( 'qsm_get_quizzes_list' ) ? qsm_get_quizzes_list(): array(), + 'quizOptions' => $quiz_options_id_details, + 'question_type' => array( + 'label' => __( 'Question Type', 'quiz-master-next' ), + 'options' => $question_types, + 'default' => '0', + 'documentation_link' => esc_url( qsm_get_plugin_link( 'docs/about-quiz-survey-master/question-types/', 'quiz_editor', 'question_type', 'quizsurvey-question-type_doc' ) ), + ), + 'answerEditor' => array( + 'label' => __( 'Answers Type', 'quiz-master-next' ), + 'options' => array( + array( 'label' => __( 'Text Answers', 'quiz-master-next' ), 'value' => 'text' ), + array( 'label' => __( 'Rich Answers', 'quiz-master-next' ), 'value' => 'rich' ), + array( 'label' => __( 'Image Answers', 'quiz-master-next' ), 'value' => 'image' ), + ), + 'default' => 'text', + 'documentation_link' => esc_url( qsm_get_plugin_link( 'docs/creating-quizzes-and-surveys/adding-and-editing-questions/', 'quiz_editor', 'answer_type', 'answer_type_doc#Answer-Type' ) ), + ), + 'categoryList' => get_terms( array( + 'taxonomy' => 'qsm_category', + 'hide_empty' => false + ) + ), + 'commentBox' => array( + 'heading' => __( 'Comment Box', 'quiz-master-next' ), + 'label' => __( 'Field Type', 'quiz-master-next' ), + 'options' => array( + array( 'label' => __( 'Small Text Field', 'quiz-master-next' ), 'value' => '0' ), + array( 'label' => __( 'Large Text Field', 'quiz-master-next' ), 'value' => '2' ), + array( 'label' => __( 'None', 'quiz-master-next' ), 'value' => '1' ), + ), + 'default' => '1', + 'documentation_link' => qsm_get_plugin_link( 'docs/creating-quizzes-and-surveys/adding-and-editing-questions/', 'quiz_editor', 'comment-box', 'quizsurvey-comment-box_doc' ), + ) + ) + ); + } + + /** + * The block renderer. + * + * This simply calls our main shortcode renderer. + * + * @param array $attributes The attributes that were set on the block. + */ + public function qsm_block_render( $attributes, $content, $block ) { + global $qmnQuizManager; + return $qmnQuizManager->display_shortcode( $attributes ); + } + + public function render_block_content( $attributes, $content, $block ) { + return $content; + } + } + + QSMBlock::get_instance(); } diff --git a/blocks/build/answer-option/block.json b/blocks/build/answer-option/block.json new file mode 100644 index 000000000..c6f25bbb3 --- /dev/null +++ b/blocks/build/answer-option/block.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "qsm/quiz-answer-option", + "version": "0.1.0", + "title": "Answer Option", + "category": "widgets", + "parent": [ + "qsm/quiz-question" + ], + "icon": "feedback", + "description": "QSM Quiz answer option", + "attributes": { + "optionID": { + "type": "string", + "default": "0" + }, + "content": { + "type": "string", + "default": "" + }, + "points": { + "type": "string", + "default": "0" + }, + "isCorrect": { + "type": "string", + "default": "0" + } + }, + "usesContext": [ + "quiz-master-next/quizID", + "quiz-master-next/pageID", + "quiz-master-next/questionID" + ], + "example": {}, + "supports": { + "html": false + }, + "textdomain": "main-block", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "render": "file:./render.php", + "viewScript": "file:./view.js" +} \ No newline at end of file diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php new file mode 100644 index 000000000..de48ae5dc --- /dev/null +++ b/blocks/build/answer-option/index.asset.php @@ -0,0 +1 @@ + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => 'e5c6fb3f75353889483d'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js new file mode 100644 index 000000000..b33b58a87 --- /dev/null +++ b/blocks/build/answer-option/index.js @@ -0,0 +1,367 @@ +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/answer-option/edit.js": +/*!***********************************!*\ + !*** ./src/answer-option/edit.js ***! + \***********************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": function() { return /* binding */ Edit; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); +/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); + + + + + + + + + + + +function Edit(props) { + //check for QSM initialize data + if ('undefined' === typeof qsmBlockData) { + return null; + } + const { + className, + attributes, + setAttributes, + isSelected, + clientId, + context, + mergeBlocks, + onReplace, + onRemove + } = props; + const quizID = context['quiz-master-next/quizID']; + const pageID = context['quiz-master-next/pageID']; + const questionID = context['quiz-master-next/questionID']; + const name = 'qsm/quiz-answer-option'; + const { + optionID, + content, + points, + isCorrect + } = attributes; + + /**Initialize block from server */ + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetQSMAttr = true; + if (shouldSetQSMAttr) {} + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + }, [quizID]); + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({ + className: '' + }); + + //Decode htmlspecialchars + const decodeHtml = html => { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; + }; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Settings', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + type: "number", + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Points', 'quiz-master-next'), + help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer points', 'quiz-master-next'), + value: points, + onChange: points => setAttributes({ + points + }) + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct', 'quiz-master-next'), + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(isCorrect) && '1' == isCorrect, + onChange: () => setAttributes({ + isCorrect: !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(isCorrect) && '1' == isCorrect ? 0 : 1 + }) + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { + tagName: "p", + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question answer', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Your Answer', 'quiz-master-next'), + value: content, + onChange: content => setAttributes({ + content: (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmStripTags)(content) + }), + onSplit: (value, isOriginal) => { + let newAttributes; + if (isOriginal || value) { + newAttributes = { + ...attributes, + content: value + }; + } + const block = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__.createBlock)(name, newAttributes); + if (isOriginal) { + block.clientId = clientId; + } + return block; + }, + onMerge: mergeBlocks, + onReplace: onReplace, + onRemove: onRemove, + allowedFormats: [], + withoutInteractiveFormatting: true, + className: 'qsm-question-answer-option', + identifier: "text" + }))); +} + +/***/ }), + +/***/ "./src/helper.js": +/*!***********************!*\ + !*** ./src/helper.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, +/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; } +/* harmony export */ }); +//Check if undefined, null, empty +const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; +const qsmSanitizeName = name => { + if (qsmIsEmpty(name)) { + name = ''; + } else { + name = name.toLowerCase().replace(/ /g, '_'); + name = name.replace(/\W/g, ''); + } + return name; +}; + +// Remove anchor tags from button text content. +const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); + +/***/ }), + +/***/ "@wordpress/api-fetch": +/*!**********************************!*\ + !*** external ["wp","apiFetch"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["apiFetch"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/core-data": +/*!**********************************!*\ + !*** external ["wp","coreData"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["coreData"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/editor": +/*!********************************!*\ + !*** external ["wp","editor"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["editor"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "./src/answer-option/block.json": +/*!**************************************!*\ + !*** ./src/answer-option/block.json ***! + \**************************************/ +/***/ (function(module) { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-answer-option","version":"0.1.0","title":"Answer Option","category":"widgets","parent":["qsm/quiz-question"],"icon":"feedback","description":"QSM Quiz answer option","attributes":{"optionID":{"type":"string","default":"0"},"content":{"type":"string","default":""},"points":{"type":"string","default":"0"},"isCorrect":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/questionID"],"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { +/*!************************************!*\ + !*** ./src/answer-option/index.js ***! + \************************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/answer-option/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/answer-option/block.json"); + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { + merge(attributes, attributesToMerge) { + return { + content: (attributes.content || '') + (attributesToMerge.content || '') + }; + }, + edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] +}); +}(); +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/build/answer-option/index.js.map b/blocks/build/answer-option/index.js.map new file mode 100644 index 000000000..10350c53d --- /dev/null +++ b/blocks/build/answer-option/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"answer-option/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AACb;AAMX;AACwB;AACC;AACD;AAS1B;AACiB;AACK;AACtC,SAASuB,IAAIA,CAAEC,KAAK,EAAG;EAErC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,WAAW;IAAEC,SAAS;IACpGC;EAAS,CAAC,GAAGV,KAAK;EAEjB,MAAMW,MAAM,GAAGJ,OAAO,CAAC,yBAAyB,CAAC;EACjD,MAAMK,MAAM,GAAG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U,CAACa,OAAO,IAAI,EAAE,KACxBsC,iBAAiB,CAACtC,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACDuC,IAAI,EAAExD,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/answer-option/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/answer-option/index.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\nexport default function Edit( props ) {\n\t\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace,\nonRemove } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\tconst questionID = context['quiz-master-next/questionID'];\n\tconst name = 'qsm/quiz-answer-option';\n\tconst {\n\t\toptionID,\n\t\tcontent,\n\t\tpoints,\n\t\tisCorrect\n\t} = attributes;\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: '',\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = (html) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\t\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { points } ) }\n\t\t\t/>\n\t\t\t setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\n\t
\n\t\t setAttributes( { content: qsmStripTags( content ) } ) }\n\t\t\tonSplit={ ( value, isOriginal ) => {\n\t\t\t\tlet newAttributes;\n\n\t\t\t\tif ( isOriginal || value ) {\n\t\t\t\t\tnewAttributes = {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst block = createBlock( name, newAttributes );\n\n\t\t\t\tif ( isOriginal ) {\n\t\t\t\t\tblock.clientId = clientId;\n\t\t\t\t}\n\n\t\t\t\treturn block;\n\t\t\t} }\n\t\t\tonMerge={ mergeBlocks }\n\t\t\tonReplace={ onReplace }\n\t\t\tonRemove={ onRemove }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-answer-option' }\n\t\t\tidentifier='text'\n\t\t/>\n\t
\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit: Edit,\n} );\n"],"names":["__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","createBlock","qsmIsEmpty","qsmStripTags","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","mergeBlocks","onReplace","onRemove","quizID","pageID","questionID","name","optionID","content","points","isCorrect","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","Fragment","title","initialOpen","type","label","help","onChange","checked","tagName","placeholder","onSplit","isOriginal","newAttributes","block","onMerge","allowedFormats","withoutInteractiveFormatting","identifier","data","qsmSanitizeName","toLowerCase","replace","text","registerBlockType","metadata","merge","attributesToMerge","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/block.json b/blocks/build/block.json new file mode 100644 index 000000000..5afcaf659 --- /dev/null +++ b/blocks/build/block.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "qsm/quiz", + "version": "0.1.0", + "title": "QSM Quiz", + "category": "widgets", + "icon": "feedback", + "description": "Easily and quickly add quizzes and surveys to your website.", + "attributes": { + "quizID": { + "type": "string", + "default": "0" + } + }, + "providesContext": { + "quiz-master-next/quizID": "quizID" + }, + "example": {}, + "supports": { + "html": false + }, + "textdomain": "main-block", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "render": "file:./render.php", + "viewScript": "file:./view.js" +} \ No newline at end of file diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php new file mode 100644 index 000000000..8f4d4c645 --- /dev/null +++ b/blocks/build/index.asset.php @@ -0,0 +1 @@ + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '5c207d9bba4eae05e9c0'); diff --git a/blocks/build/index.css b/blocks/build/index.css new file mode 100644 index 000000000..0a24e2a27 --- /dev/null +++ b/blocks/build/index.css @@ -0,0 +1,51 @@ +/*!****************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! + \****************************************************************************************************************************************************************************************************************************************/ +/** + * The following styles get applied inside the editor only. + * + * Replace them with your own styles or remove the file completely. + */ +.qsm-placeholder-select-create-quiz { + display: flex; + gap: 1rem; + align-items: center; + margin-bottom: 1rem; +} +.qsm-placeholder-select-create-quiz .components-base-control { + max-width: 50%; +} + +.qsm-placeholder-quiz-create-form { + width: 50%; +} +.qsm-placeholder-quiz-create-form .components-button { + width: -moz-fit-content; + width: fit-content; +} + +.wp-block-qsm-quiz-question { + /*Question Title*/ + /*Question description*/ + /*Question options*/ + /*Question block in editing mode*/ +} +.wp-block-qsm-quiz-question .qsm-question-title { + color: #1f8cbe; + font-size: 1.38rem; +} +.wp-block-qsm-quiz-question .qsm-question-description, +.wp-block-qsm-quiz-question .qsm-question-correct-answer-info, +.wp-block-qsm-quiz-question .qsm-question-hint { + font-size: 1rem; +} +.wp-block-qsm-quiz-question .qsm-question-answer-option { + color: #666666; + font-size: 0.9rem; + margin-left: 1rem; +} +.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title { + color: #666666; +} + +/*# sourceMappingURL=index.css.map*/ \ No newline at end of file diff --git a/blocks/build/index.css.map b/blocks/build/index.css.map new file mode 100644 index 000000000..3236fc2e0 --- /dev/null +++ b/blocks/build/index.css.map @@ -0,0 +1 @@ +{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AASA;EACI;EACA;EACA;EACA;AAHJ;AAII;EACI;AAFR;;AAMA;EACI;AAHJ;AAII;EACI;EAAA;AAFR;;AAMA;EACI;EAMA;EAOA;EAOA;AApBJ;AACI;EACI,cAtBiB;EAuBjB;AACR;AAGI;;;EAGI;AADR;AAKI;EACI,cApCa;EAqCb;EACA;AAHR;AAQQ;EACI,cA5CS;AAsCrB,C","sources":["webpack://qsm/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n $qsm_primary_color: #666666;\n $qsm_wp_primary_color : #1f8cbe;\n\n.qsm-placeholder-select-create-quiz{\n display: flex;\n gap: 1rem;\n align-items: center;\n margin-bottom: 1rem;\n .components-base-control{\n max-width: 50%;\n }\n}\n\n.qsm-placeholder-quiz-create-form{\n width: 50%;\n .components-button{\n width: fit-content;\n }\n}\n\n.wp-block-qsm-quiz-question {\n /*Question Title*/\n .qsm-question-title {\n color: $qsm_wp_primary_color;\n font-size: 1.38rem;\n }\n\n /*Question description*/\n .qsm-question-description, \n .qsm-question-correct-answer-info,\n .qsm-question-hint {\n font-size: 1rem;\n }\n\n /*Question options*/\n .qsm-question-answer-option{\n color: $qsm_primary_color;\n font-size: 0.9rem;\n margin-left: 1rem;\n }\n\n /*Question block in editing mode*/\n &.in-editing-mode{\n .qsm-question-title{\n color: $qsm_primary_color;\n }\n }\n \n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/index.js b/blocks/build/index.js new file mode 100644 index 000000000..5d5a72bf4 --- /dev/null +++ b/blocks/build/index.js @@ -0,0 +1,671 @@ +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/edit.js": +/*!*********************!*\ + !*** ./src/edit.js ***! + \*********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": function() { return /* binding */ Edit; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); +/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./helper */ "./src/helper.js"); + + + + + + + + + + + +function Edit(props) { + //check for QSM initialize data + if ('undefined' === typeof qsmBlockData) { + return null; + } + const { + className, + attributes, + setAttributes, + isSelected, + clientId + } = props; + /* + " quiz_name": { + "type": "string", + "default": "" + }, + "quiz_featured_image": { + "type": "string", + "default": "" + }, + "form_type": { + "type": "string", + "default": "" + }, + "system": { + "type": "string", + "default": "" + }, + "timer_limit": { + "type": "string", + "default": "" + }, + "pagination": { + "type": "string", + "default": "" + }, + "enable_pagination_quiz": { + "type": "number", + "default": 0 + }, + "progress_bar": { + "type": "number", + "default": 0 + }, + "require_log_in": { + "type": "number", + "default": 0 + }, + "disable_first_page": { + "type": "number", + "default": 0 + }, + "comment_section": { + "type": "number", + "default": 1 + } + */ + const { + quizID + } = attributes; + const [quizAttr, setQuizAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.globalQuizsetting); + const [quizList, setQuizList] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.QSMQuizList); + const [createQuiz, setCreateQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const [saveQuiz, setSaveQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const [showAdvanceOption, setShowAdvanceOption] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const [quizTemplate, setQuizTemplate] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)([]); + const quizOptions = qsmBlockData.quizOptions; + /**Initialize block from server */ + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetQSMAttr = true; + if (shouldSetQSMAttr) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizID) && 0 < quizID && ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr) || (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr?.quizID) || quizID != quizAttr.quiz_id)) { + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/quiz/structure', + method: 'POST', + data: { + quizID: quizID + } + }).then(res => { + console.log(res); + if ('success' == res.status) { + let result = res.result; + setQuizAttr({ + ...quizAttr, + ...result + }); + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(result.qpages)) { + let quizTemp = []; + result.qpages.forEach(page => { + let questions = []; + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(page.question_arr)) { + page.question_arr.forEach(question => { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(question)) { + let answers = []; + //answers options blocks + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(question.answers) && 0 < question.answers.length) { + question.answers.forEach((answer, aIndex) => { + answers.push(['qsm/quiz-answer-option', { + optionID: aIndex, + content: answer[0], + points: answer[1], + isCorrect: answer[2] + }]); + }); + } + //question blocks + questions.push(['qsm/quiz-question', { + questionID: question.question_id, + type: question.question_type_new, + answerEditor: question.settings.answerEditor, + title: question.settings.question_title, + description: question.question_name, + required: question.settings.required, + hint: question.hints, + answers: question.answers, + correctAnswerInfo: question.question_answer_info, + category: question.category, + multicategories: question.multicategories, + commentBox: question.comments, + matchAnswer: question.settings.matchAnswer, + featureImageID: question.settings.featureImageID, + featureImageSrc: question.settings.featureImageSrc, + settings: question.settings + }, answers]); + } + }); + } + //console.log("page",page); + quizTemp.push(['qsm/quiz-page', { + pageID: page.id, + pageKey: page.pagekey, + hidePrevBtn: page.hide_prevbtn, + quizID: page.quizID + }, questions]); + }); + setQuizTemplate(quizTemp); + } + // QSM_QUIZ = [ + // [ + + // ] + // ]; + } else { + console.log("error " + res.msg); + } + }); + } + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + }, [quizID]); + const feedbackIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "24", + height: "24", + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + color: "#ffffff" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + x: "2.75", + y: "3.75", + width: "18.5", + height: "16.5", + stroke: "#0EA489", + strokeWidth: "1.5" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + x: "6", + y: "7", + width: "12", + height: "1", + fill: "#0EA489" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + x: "6", + y: "11", + width: "12", + height: "1", + fill: "#0EA489" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + x: "6", + y: "15", + width: "12", + height: "1", + fill: "#0EA489" + })) + }); + const quizPlaceholder = () => { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Placeholder, { + icon: feedbackIcon, + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz And Survey Master') + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizList) && 0 < quizList.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "qsm-placeholder-select-create-quiz" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('', 'quiz-master-next'), + value: quizID, + options: quizList, + onChange: quizID => setAttributes({ + quizID + }), + disabled: createQuiz, + __nextHasNoMarginBottom: true + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('OR', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { + variant: "link", + onClick: () => setCreateQuiz(!createQuiz) + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New', 'quiz-master-next'))), ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizList) || createQuiz) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.__experimentalVStack, { + spacing: "3", + className: "qsm-placeholder-quiz-create-form" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), + help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), + value: quizAttr?.quiz_name || '', + onChange: val => setQuizAttributes(val, 'quiz_name') + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { + variant: "link", + onClick: () => setShowAdvanceOption(!showAdvanceOption) + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance options', 'quiz-master-next')), showAdvanceOption && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + label: quizOptions?.form_type?.label, + value: quizAttr?.form_type, + options: quizOptions?.form_type?.options, + onChange: val => setQuizAttributes(val, 'form_type'), + __nextHasNoMarginBottom: true + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + label: quizOptions?.system?.label, + value: quizAttr?.system, + options: quizOptions?.system?.options, + onChange: val => setQuizAttributes(val, 'system'), + help: quizOptions?.system?.help, + __nextHasNoMarginBottom: true + }), ['timer_limit', 'pagination'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + type: "number", + label: quizOptions?.[item]?.label, + help: quizOptions?.[item]?.help, + value: (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) ? 0 : quizAttr[item], + onChange: val => setQuizAttributes(val, item) + })), ['enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { + label: quizOptions?.[item]?.label, + help: quizOptions?.[item]?.help, + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item], + onChange: () => setQuizAttributes(!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item] ? 0 : 1, item) + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { + variant: "primary", + disabled: saveQuiz || (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr.quiz_name), + onClick: () => createNewQuiz() + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Create Quiz', 'quiz-master-next'))))); + }; + const setQuizAttributes = (value, attr_name) => { + let newAttr = quizAttr; + newAttr[attr_name] = value; + setQuizAttr({ + ...newAttr + }); + }; + const createNewQuiz = () => {}; + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); + const innerBlocksProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useInnerBlocksProps)(blockProps, { + template: quizTemplate, + allowedBlocks: ['qsm/quiz-page'] + }); + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz settings', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), + help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), + value: quizAttr?.quiz_name || '', + onChange: val => setQuizAttributes(val, 'quiz_name') + }))), (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizID) || '0' == quizID ? quizPlaceholder() : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...innerBlocksProps + })); +} + +/***/ }), + +/***/ "./src/helper.js": +/*!***********************!*\ + !*** ./src/helper.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, +/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; } +/* harmony export */ }); +//Check if undefined, null, empty +const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; +const qsmSanitizeName = name => { + if (qsmIsEmpty(name)) { + name = ''; + } else { + name = name.toLowerCase().replace(/ /g, '_'); + name = name.replace(/\W/g, ''); + } + return name; +}; + +// Remove anchor tags from button text content. +const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); + +/***/ }), + +/***/ "./src/index.js": +/*!**********************!*\ + !*** ./src/index.js ***! + \**********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss"); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/block.json"); + + + + +const save = props => null; +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, { + /** + * @see ./edit.js + */ + edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"], + save: save +}); + +/***/ }), + +/***/ "./src/editor.scss": +/*!*************************!*\ + !*** ./src/editor.scss ***! + \*************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/style.scss": +/*!************************!*\ + !*** ./src/style.scss ***! + \************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "@wordpress/api-fetch": +/*!**********************************!*\ + !*** external ["wp","apiFetch"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["apiFetch"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/core-data": +/*!**********************************!*\ + !*** external ["wp","coreData"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["coreData"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/editor": +/*!********************************!*\ + !*** external ["wp","editor"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["editor"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "./src/block.json": +/*!************************!*\ + !*** ./src/block.json ***! + \************************/ +/***/ (function(module) { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz","version":"0.1.0","title":"QSM Quiz","category":"widgets","icon":"feedback","description":"Easily and quickly add quizzes and surveys to your website.","attributes":{"quizID":{"type":"string","default":"0"}},"providesContext":{"quiz-master-next/quizID":"quizID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = __webpack_modules__; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ !function() { +/******/ var deferred = []; +/******/ __webpack_require__.O = function(result, chunkIds, fn, priority) { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var chunkIds = deferred[i][0]; +/******/ var fn = deferred[i][1]; +/******/ var priority = deferred[i][2]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/jsonp chunk loading */ +/******/ !function() { +/******/ // no baseURI +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "index": 0, +/******/ "./style-index": 0 +/******/ }; +/******/ +/******/ // no chunk on demand loading +/******/ +/******/ // no prefetching +/******/ +/******/ // no preloaded +/******/ +/******/ // no HMR +/******/ +/******/ // no HMR manifest +/******/ +/******/ __webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; }; +/******/ +/******/ // install a JSONP callback for chunk loading +/******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) { +/******/ var chunkIds = data[0]; +/******/ var moreModules = data[1]; +/******/ var runtime = data[2]; +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { +/******/ installedChunks[chunkId][0](); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ return __webpack_require__.O(result); +/******/ } +/******/ +/******/ var chunkLoadingGlobal = self["webpackChunkqsm"] = self["webpackChunkqsm"] || []; +/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); +/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); +/******/ }(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module depends on other loaded chunks and execution need to be delayed +/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], function() { return __webpack_require__("./src/index.js"); }) +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/build/index.js.map b/blocks/build/index.js.map new file mode 100644 index 000000000..27f9a2144 --- /dev/null +++ b/blocks/build/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AACb;AAMX;AACwB;AACC;AACD;AAa1B;AACR;AACe;AACvB,SAAS0B,IAAIA,CAAEC,KAAK,EAAG;EACrC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGN,KAAK;EAC5E;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAM;IACLO;EACD,CAAC,GAAGJ,UAAU;EAEd,MAAM,CAAEK,QAAQ,EAAEC,WAAW,CAAE,GAAGnC,4DAAQ,CAAE2B,YAAY,CAACS,iBAAkB,CAAC;EAC5E,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAGtC,4DAAQ,CAAE2B,YAAY,CAACY,WAAY,CAAC;EACtE,MAAM,CAAEC,UAAU,EAAEC,aAAa,CAAE,GAAGzC,4DAAQ,CAAE,KAAM,CAAC;EACvD,MAAM,CAAE0C,QAAQ,EAAEC,WAAW,CAAE,GAAG3C,4DAAQ,CAAE,KAAM,CAAC;EACnD,MAAM,CAAE4C,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG7C,4DAAQ,CAAE,KAAM,CAAC;EACrE,MAAM,CAAE8C,YAAY,EAAEC,eAAe,CAAE,GAAG/C,4DAAQ,CAAE,EAAG,CAAC;EACxD,MAAMgD,WAAW,GAAGrB,YAAY,CAACqB,WAAW;EAC5C;EACA/C,6DAAS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f,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,8CAA8C;;WAE9C;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,iCAAiC,mCAAmC;WACpE;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA,2FAA2F,+CAA+C;UAC1I","sources":["webpack://qsm/./src/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/./src/index.js","webpack://qsm/./src/editor.scss","webpack://qsm/./src/style.scss","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/chunk loaded","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/webpack/runtime/jsonp chunk loading","webpack://qsm/webpack/before-startup","webpack://qsm/webpack/startup","webpack://qsm/webpack/after-startup"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tButton,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n\tPlaceholder,\n\tIcon,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport './editor.scss';\nimport { qsmIsEmpty } from './helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId } = props;\n\t/*\n\t\"\tquiz_name\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"quiz_featured_image\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"form_type\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"system\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"timer_limit\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"pagination\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"enable_pagination_quiz\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"progress_bar\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"require_log_in\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"disable_first_page\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"comment_section\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 1\n\t\t}\n\t*/\n\tconst {\n\t\tquizID \n\t} = attributes;\n\n\tconst [ quizAttr, setQuizAttr ] = useState( qsmBlockData.globalQuizsetting );\n\tconst [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList );\n\tconst [ createQuiz, setCreateQuiz ] = useState( false );\n\tconst [ saveQuiz, setSaveQuiz ] = useState( false );\n\tconst [ showAdvanceOption, setShowAdvanceOption ] = useState( false );\n\tconst [ quizTemplate, setQuizTemplate ] = useState( [] );\n\tconst quizOptions = qsmBlockData.quizOptions;\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\tif ( ! qsmIsEmpty( quizID ) && 0 < quizID && ( qsmIsEmpty( quizAttr ) || qsmIsEmpty( quizAttr?.quizID ) || quizID != quizAttr.quiz_id ) ) {\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/quiz/structure',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: { quizID: quizID },\n\t\t\t\t} ).then( ( res ) => {\n\t\t\t\t\tconsole.log( res );\n\t\t\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t\t\tlet result = res.result;\n\t\t\t\t\t\tsetQuizAttr( {\n\t\t\t\t\t\t\t...quizAttr,\n\t\t\t\t\t\t\t...result\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( ! qsmIsEmpty( result.qpages ) ) {\n\t\t\t\t\t\t\tlet quizTemp = [];\n\t\t\t\t\t\t\tresult.qpages.forEach( page => {\n\t\t\t\t\t\t\t\tlet questions = [];\n\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( page.question_arr ) ) {\n\t\t\t\t\t\t\t\t\tpage.question_arr.forEach( question => {\n\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question ) ) {\n\t\t\t\t\t\t\t\t\t\t\tlet answers = [];\n\t\t\t\t\t\t\t\t\t\t\t//answers options blocks\n\t\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tquestion.answers.forEach( ( answer, aIndex ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-answer-option',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptionID:aIndex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontent:answer[0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoints:answer[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect:answer[2]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t//question blocks\n\t\t\t\t\t\t\t\t\t\t\tquestions.push(\n\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-question',\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquestionID: question.question_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: question.question_type_new,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswerEditor: question.settings.answerEditor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: question.settings.question_title,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: question.question_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: question.settings.required,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thint:question.hints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswers: question.answers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcorrectAnswerInfo:question.question_answer_info,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcategory:question.category,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmulticategories:question.multicategories,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcommentBox: question.comments,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatchAnswer: question.settings.matchAnswer,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageID: question.settings.featureImageID,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageSrc: question.settings.featureImageSrc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings: question.settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers\n\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//console.log(\"page\",page);\n\t\t\t\t\t\t\t\tquizTemp.push(\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'qsm/quiz-page',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpageID:page.id,\n\t\t\t\t\t\t\t\t\t\t\tpageKey: page.pagekey,\n\t\t\t\t\t\t\t\t\t\t\thidePrevBtn: page.hide_prevbtn,\n\t\t\t\t\t\t\t\t\t\t\tquizID: page.quizID\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tquestions\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsetQuizTemplate( quizTemp );\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// QSM_QUIZ = [\n\t\t\t\t\t\t// \t[\n\n\t\t\t\t\t\t// \t]\n\t\t\t\t\t\t// ];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log( \"error \"+ res.msg );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\t\n\tconst feedbackIcon = () => (\n\t (\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t)\n\t\t\t}\n\t/>\n\t);\n\tconst quizPlaceholder = ( ) => {\n\t\treturn (\n\t\t\t\n\t\t\t\t{\n\t\t\t\t\t<>\n\t\t\t\t\t{ ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& \n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( { quizID } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdisabled={ createQuiz }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t\t{ __( 'OR', 'quiz-master-next' ) }\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t}\n\t\t\t\t\t{ ( qsmIsEmpty( quizList ) || createQuiz ) &&\n\t\t\t\t\t\n\t\t\t\t\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ showAdvanceOption && (<>\n\t\t\t\t\t\t\t{/**Form Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'form_type') }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{/**Grading Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'system') }\n\t\t\t\t\t\t\t\thelp={ quizOptions?.system?.help }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'timer_limit', \n\t\t\t\t\t\t\t\t\t'pagination',\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t\t setQuizAttributes( val, item) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'enable_contact_form', \n\t\t\t\t\t\t\t\t\t'enable_pagination_quiz', \n\t\t\t\t\t\t\t\t\t'show_question_featured_image_in_result',\n\t\t\t\t\t\t\t\t\t'progress_bar',\n\t\t\t\t\t\t\t\t\t'require_log_in',\n\t\t\t\t\t\t\t\t\t'disable_first_page',\n\t\t\t\t\t\t\t\t\t'comment_section'\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t setQuizAttributes( ( ( ! qsmIsEmpty( quizAttr[item] ) && '1' == quizAttr[item] ) ? 0 : 1 ), item ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t }\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t);\n\t};\n\n\tconst setQuizAttributes = ( value , attr_name ) => {\n\t\tlet newAttr = quizAttr;\n\t\tnewAttr[ attr_name ] = value;\n\t\tsetQuizAttr( { ...newAttr } );\n\t}\n\n\tconst createNewQuiz = () => {\n\n\t}\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: quizTemplate,\n\t\tallowedBlocks : [\n\t\t\t'qsm/quiz-page'\n\t\t]\n\t} );\n\t\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t/>\n\t\t\n\t\n\t{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? \n quizPlaceholder() \n\t:\n\t
\n\t}\n\t\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );","import { registerBlockType } from '@wordpress/blocks';\nimport './style.scss';\nimport Edit from './edit';\nimport metadata from './block.json';\nconst save = ( props ) => null;\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n\tsave: save,\n} );\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkqsm\"] = self[\"webpackChunkqsm\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], function() { return __webpack_require__(\"./src/index.js\"); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","useInnerBlocksProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","Button","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Placeholder","Icon","__experimentalVStack","VStack","qsmIsEmpty","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","quizID","quizAttr","setQuizAttr","globalQuizsetting","quizList","setQuizList","QSMQuizList","createQuiz","setCreateQuiz","saveQuiz","setSaveQuiz","showAdvanceOption","setShowAdvanceOption","quizTemplate","setQuizTemplate","quizOptions","shouldSetQSMAttr","quiz_id","path","method","data","then","res","console","log","status","result","qpages","quizTemp","forEach","page","questions","question_arr","question","answers","length","answer","aIndex","push","optionID","content","points","isCorrect","questionID","question_id","type","question_type_new","answerEditor","settings","title","question_title","description","question_name","required","hint","hints","correctAnswerInfo","question_answer_info","category","multicategories","commentBox","comments","matchAnswer","featureImageID","featureImageSrc","pageID","id","pageKey","pagekey","hidePrevBtn","hide_prevbtn","msg","feedbackIcon","createElement","icon","width","height","viewBox","fill","xmlns","color","x","y","stroke","strokeWidth","quizPlaceholder","label","Fragment","value","options","onChange","disabled","__nextHasNoMarginBottom","variant","onClick","spacing","help","quiz_name","val","setQuizAttributes","form_type","system","map","item","checked","createNewQuiz","attr_name","newAttr","blockProps","innerBlocksProps","template","allowedBlocks","initialOpen","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","registerBlockType","metadata","save","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/page/block.json b/blocks/build/page/block.json new file mode 100644 index 000000000..754fe0e3d --- /dev/null +++ b/blocks/build/page/block.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "qsm/quiz-page", + "version": "0.1.0", + "title": "Page", + "category": "widgets", + "parent": [ + "qsm/quiz" + ], + "icon": "feedback", + "description": "QSM Quiz Page", + "attributes": { + "pageID": { + "type": "string", + "default": "0" + }, + "pageKey": { + "type": "string", + "default": "" + }, + "hidePrevBtn": { + "type": "string", + "default": "0" + } + }, + "usesContext": [ + "quiz-master-next/quizID" + ], + "providesContext": { + "quiz-master-next/pageID": "pageID" + }, + "example": {}, + "supports": { + "html": false + }, + "textdomain": "main-block", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "render": "file:./render.php", + "viewScript": "file:./view.js" +} \ No newline at end of file diff --git a/blocks/build/page/index.asset.php b/blocks/build/page/index.asset.php new file mode 100644 index 000000000..dd5c6c060 --- /dev/null +++ b/blocks/build/page/index.asset.php @@ -0,0 +1 @@ + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'd24b88e85555402d01c5'); diff --git a/blocks/build/page/index.js b/blocks/build/page/index.js new file mode 100644 index 000000000..8d8aef49a --- /dev/null +++ b/blocks/build/page/index.js @@ -0,0 +1,281 @@ +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/helper.js": +/*!***********************!*\ + !*** ./src/helper.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, +/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; } +/* harmony export */ }); +//Check if undefined, null, empty +const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; +const qsmSanitizeName = name => { + if (qsmIsEmpty(name)) { + name = ''; + } else { + name = name.toLowerCase().replace(/ /g, '_'); + name = name.replace(/\W/g, ''); + } + return name; +}; + +// Remove anchor tags from button text content. +const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); + +/***/ }), + +/***/ "./src/page/edit.js": +/*!**************************!*\ + !*** ./src/page/edit.js ***! + \**************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": function() { return /* binding */ Edit; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); + + + + + + + +function Edit(props) { + //check for QSM initialize data + if ('undefined' === typeof qsmBlockData) { + return null; + } + const { + className, + attributes, + setAttributes, + isSelected, + clientId, + context + } = props; + const quizID = context['quiz-master-next/quizID']; + const { + pageID, + pageKey, + hidePrevBtn + } = attributes; + const [qsmPageAttr, setQsmPageAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.globalQuizsetting); + + /**Initialize block from server */ + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetQSMAttr = true; + if (shouldSetQSMAttr) { + //console.log("attr",attributes); + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + }, [quizID]); + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page settings', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page Name', 'quiz-master-next'), + value: pageKey, + onChange: pageKey => setAttributes({ + pageKey + }) + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToggleControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hide Previous Button?', 'quiz-master-next'), + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn, + onChange: () => setAttributes({ + hidePrevBtn: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn ? 0 : 1 + }) + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { + allowedBlocks: ['qsm/quiz-question'] + }))); +} + +/***/ }), + +/***/ "@wordpress/api-fetch": +/*!**********************************!*\ + !*** external ["wp","apiFetch"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["apiFetch"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "./src/page/block.json": +/*!*****************************!*\ + !*** ./src/page/block.json ***! + \*****************************/ +/***/ (function(module) { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-page","version":"0.1.0","title":"Page","category":"widgets","parent":["qsm/quiz"],"icon":"feedback","description":"QSM Quiz Page","attributes":{"pageID":{"type":"string","default":"0"},"pageKey":{"type":"string","default":""},"hidePrevBtn":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID"],"providesContext":{"quiz-master-next/pageID":"pageID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { +/*!***************************!*\ + !*** ./src/page/index.js ***! + \***************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/page/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/page/block.json"); + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { + /** + * @see ./edit.js + */ + edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] +}); +}(); +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/build/page/index.js.map b/blocks/build/page/index.js.map new file mode 100644 index 000000000..907bb0c65 --- /dev/null +++ b/blocks/build/page/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"page/index.js","mappings":";;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;AAE9F,MAAMC,eAAe,GAAKC,IAAI,IAAM;EAC1C,IAAKH,UAAU,CAAEG,IAAK,CAAC,EAAG;IACzBA,IAAI,GAAG,EAAE;EACV,CAAC,MAAM;IACNA,IAAI,GAAGA,IAAI,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,IAAI,EAAE,GAAI,CAAC;IAC9CF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAC/B;EAEA,OAAOF,IAAI;AACZ,CAAC;;AAED;AACO,MAAMG,YAAY,GAAKC,IAAI,IAAMA,IAAI,CAACF,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;ACfrC;AACoB;AACb;AAKX;AASF;AACQ;AACxB,SAASiB,IAAIA,CAAEC,KAAK,EAAG;EACrC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGP,KAAK;EAErF,MAAMQ,MAAM,GAAGD,OAAO,CAAC,yBAAyB,CAAC;EAEjD,MAAM;IACLE,MAAM;IACNC,OAAO;IACPC;EACD,CAAC,GAAGR,UAAU;EAEd,MAAM,CAAES,WAAW,EAAE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;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCC,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAE7B,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/page/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/page/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty } from '../helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\t\n\tconst {\n\t\tpageID,\n\t\tpageKey,\n\t\thidePrevBtn,\n\t} = attributes;\n\n\tconst [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting );\n\t\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\t\t\t//console.log(\"attr\",attributes);\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { pageKey } ) }\n\t\t\t/>\n\t\t\t setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\t\n\t\n\t
\n\t\t\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","quizID","pageID","pageKey","hidePrevBtn","qsmPageAttr","setQsmPageAttr","globalQuizsetting","shouldSetQSMAttr","blockProps","createElement","Fragment","title","initialOpen","label","value","onChange","checked","allowedBlocks","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/question/block.json b/blocks/build/question/block.json new file mode 100644 index 000000000..46b3e66c0 --- /dev/null +++ b/blocks/build/question/block.json @@ -0,0 +1,98 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "qsm/quiz-question", + "version": "0.1.0", + "title": "Question", + "category": "widgets", + "parent": [ + "qsm/quiz-page" + ], + "icon": "feedback", + "description": "QSM Quiz Question", + "attributes": { + "questionID": { + "type": "string", + "default": "0" + }, + "type": { + "type": "string", + "default": "0" + }, + "description": { + "type": "string", + "source": "html", + "selector": "p", + "default": "" + }, + "title": { + "type": "string", + "default": "" + }, + "correctAnswerInfo": { + "type": "string", + "source": "html", + "selector": "p", + "default": "" + }, + "commentBox": { + "type": "string", + "default": "0" + }, + "category": { + "type": "number" + }, + "multicategories": { + "type": "array" + }, + "hint": { + "type": "string" + }, + "featureImageID": { + "type": "number" + }, + "featureImageSrc": { + "type": "string" + }, + "answers": { + "type": "array" + }, + "answerEditor": { + "type": "string", + "default": "text" + }, + "matchAnswer": { + "type": "string", + "default": "random" + }, + "required": { + "type": "string", + "default": "0" + }, + "otherSettings": { + "type": "object", + "default": {} + }, + "settings": { + "type": "object", + "default": {} + } + }, + "usesContext": [ + "quiz-master-next/quizID", + "quiz-master-next/pageID" + ], + "providesContext": { + "quiz-master-next/questionID": "questionID" + }, + "example": {}, + "supports": { + "html": false + }, + "textdomain": "main-block", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "render": "file:./render.php", + "viewScript": "file:./view.js" +} \ No newline at end of file diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php new file mode 100644 index 000000000..5dc25b0a3 --- /dev/null +++ b/blocks/build/question/index.asset.php @@ -0,0 +1 @@ + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => 'e24fa8eab73b21b3b2c2'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js new file mode 100644 index 000000000..f4c10f2df --- /dev/null +++ b/blocks/build/question/index.js @@ -0,0 +1,420 @@ +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/helper.js": +/*!***********************!*\ + !*** ./src/helper.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, +/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; } +/* harmony export */ }); +//Check if undefined, null, empty +const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; +const qsmSanitizeName = name => { + if (qsmIsEmpty(name)) { + name = ''; + } else { + name = name.toLowerCase().replace(/ /g, '_'); + name = name.replace(/\W/g, ''); + } + return name; +}; + +// Remove anchor tags from button text content. +const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); + +/***/ }), + +/***/ "./src/question/edit.js": +/*!******************************!*\ + !*** ./src/question/edit.js ***! + \******************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": function() { return /* binding */ Edit; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); +/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); + + + + + + + + + + +/** + * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array + * + */ + +function Edit(props) { + //check for QSM initialize data + if ('undefined' === typeof qsmBlockData) { + return null; + } + const { + className, + attributes, + setAttributes, + isSelected, + clientId, + context + } = props; + + /** https://github.com/WordPress/gutenberg/issues/22282 */ + const isParentOfSelectedBlock = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(select => isSelected || select('core/block-editor').hasSelectedInnerBlock(clientId, true)); + const quizID = context['quiz-master-next/quizID']; + const pageID = context['quiz-master-next/pageID']; + const { + questionID, + type, + description, + title, + correctAnswerInfo, + commentBox, + category, + multicategories, + hint, + featureImageID, + featureImageSrc, + answers, + answerEditor, + matchAnswer, + otherSettings, + settings + } = attributes; + const [quesAttr, setQuesAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(settings); + + /**Initialize block from server */ + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetQSMAttr = true; + if (shouldSetQSMAttr) {} + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + }, [quizID]); + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({ + className: isParentOfSelectedBlock ? ' in-editing-mode' : '' + }); + + //Decode htmlspecialchars + const decodeHtml = html => { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; + }; + const QUESTION_TEMPLATE = [['qsm/quiz-answer-option', { + optionID: '0' + }], ['qsm/quiz-answer-option', { + optionID: '1' + }]]; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question settings', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", { + className: "block-editor-block-card__title" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('ID', 'quiz-master-next') + ': ' + questionID), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + label: qsmBlockData.question_type.label, + value: type || qsmBlockData.question_type.default, + onChange: type => setAttributes({ + type + }), + __nextHasNoMarginBottom: true + }, !(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(qsmBlockData.question_type.options) && qsmBlockData.question_type.options.map(qtypes => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("optgroup", { + label: qtypes.category, + key: "qtypes" + qtypes.category + }, qtypes.types.map(qtype => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("option", { + value: qtype.slug, + key: "qtype" + qtype.slug + }, qtype.name))))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + label: qsmBlockData.answerEditor.label, + value: answerEditor || qsmBlockData.answerEditor.default, + options: qsmBlockData.answerEditor.options, + onChange: answerEditor => setAttributes({ + answerEditor + }), + __nextHasNoMarginBottom: true + })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: qsmBlockData.commentBox.heading + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + label: qsmBlockData.commentBox.label, + value: commentBox || qsmBlockData.commentBox.default, + options: qsmBlockData.commentBox.options, + onChange: commentBox => setAttributes({ + commentBox + }), + __nextHasNoMarginBottom: true + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { + tagName: "h4", + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Type your question here', 'quiz-master-next'), + value: title, + onChange: title => setAttributes({ + title: (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmStripTags)(title) + }), + allowedFormats: [], + withoutInteractiveFormatting: true, + className: 'qsm-question-title' + }), isParentOfSelectedBlock && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { + tagName: "p", + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Description goes here', 'quiz-master-next'), + value: decodeHtml(description), + onChange: description => setAttributes({ + description + }), + className: 'qsm-question-description', + __unstableEmbedURLOnPaste: true, + __unstableAllowPrefixTransformations: true + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { + allowedBlocks: ['qsm/quiz-answer-option'], + template: QUESTION_TEMPLATE + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { + tagName: "p", + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct answer info goes here', 'quiz-master-next'), + value: decodeHtml(correctAnswerInfo), + onChange: correctAnswerInfo => setAttributes({ + correctAnswerInfo + }), + className: 'qsm-question-correct-answer-info', + __unstableEmbedURLOnPaste: true, + __unstableAllowPrefixTransformations: true + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { + tagName: "p", + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hint', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('hint goes here', 'quiz-master-next'), + value: hint, + onChange: hint => setAttributes({ + hint: (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmStripTags)(hint) + }), + allowedFormats: [], + withoutInteractiveFormatting: true, + className: 'qsm-question-hint' + })))); +} + +/***/ }), + +/***/ "@wordpress/api-fetch": +/*!**********************************!*\ + !*** external ["wp","apiFetch"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["apiFetch"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/core-data": +/*!**********************************!*\ + !*** external ["wp","coreData"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["coreData"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/editor": +/*!********************************!*\ + !*** external ["wp","editor"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["editor"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "./src/question/block.json": +/*!*********************************!*\ + !*** ./src/question/block.json ***! + \*********************************/ +/***/ (function(module) { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-question","version":"0.1.0","title":"Question","category":"widgets","parent":["qsm/quiz-page"],"icon":"feedback","description":"QSM Quiz Question","attributes":{"questionID":{"type":"string","default":"0"},"type":{"type":"string","default":"0"},"description":{"type":"string","source":"html","selector":"p","default":""},"title":{"type":"string","default":""},"correctAnswerInfo":{"type":"string","source":"html","selector":"p","default":""},"commentBox":{"type":"string","default":"0"},"category":{"type":"number"},"multicategories":{"type":"array"},"hint":{"type":"string"},"featureImageID":{"type":"number"},"featureImageSrc":{"type":"string"},"answers":{"type":"array"},"answerEditor":{"type":"string","default":"text"},"matchAnswer":{"type":"string","default":"random"},"required":{"type":"string","default":"0"},"otherSettings":{"type":"object","default":{}},"settings":{"type":"object","default":{}}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID"],"providesContext":{"quiz-master-next/questionID":"questionID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { +/*!*******************************!*\ + !*** ./src/question/index.js ***! + \*******************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/question/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/question/block.json"); + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { + /** + * @see ./edit.js + */ + edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] +}); +}(); +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/build/question/index.js.map b/blocks/build/question/index.js.map new file mode 100644 index 000000000..613ecae05 --- /dev/null +++ b/blocks/build/question/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"question/index.js","mappings":";;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAK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;ACNsD;AAC5B;AACU;AAEpC+D,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAEpE,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/question/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/question/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\n/**\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\n * \n */\n\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\t\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\t\n\tconst {\n\t\tquestionID,\n\t\ttype,\n\t\tdescription,\n\t\ttitle,\n\t\tcorrectAnswerInfo,\n\t\tcommentBox,\n\t\tcategory,\n\t\tmulticategories,\n\t\thint,\n\t\tfeatureImageID,\n\t\tfeatureImageSrc,\n\t\tanswers,\n\t\tanswerEditor,\n\t\tmatchAnswer,\n\t\totherSettings,\n\t\tsettings,\n\t} = attributes;\n\n\tconst [ quesAttr, setQuesAttr ] = useState( settings );\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = ( html ) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\n\tconst QUESTION_TEMPLATE = [\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'0'\n\t\t\t}\n\t\t],\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'1'\n\t\t\t}\n\t\t]\n\n\t];\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\n\t\t{ /** Question Type **/ }\n\t\t\n\t\t\t\tsetAttributes( { type } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t{\n\t\t\t ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \n\t\t\t\t(\n\t\t\t\t\n\t\t\t\t\t{\n\t\t\t\t\t\tqtypes.types.map( qtype => \n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t \t\n\t\t{/**Answer Type */}\n\t\t\n\t\t\t\tsetAttributes( { answerEditor } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t
\n\t\t{/**Comment Box */}\n\t\t\n\t\t\n\t\t\t\tsetAttributes( { commentBox } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t\n\t
\n\t
\n\t\t setAttributes( { title: qsmStripTags( title ) } ) }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-title' }\n\t\t/>\n\t\t{\n\t\t\tisParentOfSelectedBlock && \n\t\t\t<>\n\t\t\t setAttributes({ description }) }\n\t\t\t\tclassName={ 'qsm-question-description' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t\n\t\t\t setAttributes({ correctAnswerInfo }) }\n\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\n\t\t\t\tallowedFormats={ [ ] }\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\tclassName={ 'qsm-question-hint' }\n\t\t\t/>\n\t\t\t\n\t\t}\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","select","hasSelectedInnerBlock","quizID","pageID","questionID","type","description","title","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageID","featureImageSrc","answers","answerEditor","matchAnswer","otherSettings","settings","quesAttr","setQuesAttr","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","QUESTION_TEMPLATE","optionID","Fragment","initialOpen","label","question_type","default","onChange","__nextHasNoMarginBottom","options","map","qtypes","key","types","qtype","slug","heading","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/render.php b/blocks/build/render.php new file mode 100644 index 000000000..02d32ba52 --- /dev/null +++ b/blocks/build/render.php @@ -0,0 +1,8 @@ + +

> + +

diff --git a/blocks/build/style-index.css b/blocks/build/style-index.css new file mode 100644 index 000000000..74830d632 --- /dev/null +++ b/blocks/build/style-index.css @@ -0,0 +1,11 @@ +/*!***************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! + \***************************************************************************************************************************************************************************************************************************************/ +/** + * The following styles get applied both on the front of your site + * and in the editor. + * + * Replace them with your own styles or remove the file completely. + */ + +/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/blocks/build/style-index.css.map b/blocks/build/style-index.css.map new file mode 100644 index 000000000..4ba6a61fa --- /dev/null +++ b/blocks/build/style-index.css.map @@ -0,0 +1 @@ +{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA,C","sources":["webpack://qsm/./src/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n// .wp-block-qsm-main-block {\n// \tbackground-color: #21759b;\n// \tcolor: #fff;\n// \tpadding: 2px;\n// }\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/view.asset.php b/blocks/build/view.asset.php new file mode 100644 index 000000000..c2564797e --- /dev/null +++ b/blocks/build/view.asset.php @@ -0,0 +1 @@ + array(), 'version' => 'ed4bdcfa47e5d03db91a'); diff --git a/blocks/build/view.js b/blocks/build/view.js new file mode 100644 index 000000000..3d316cab8 --- /dev/null +++ b/blocks/build/view.js @@ -0,0 +1,29 @@ +/******/ (function() { // webpackBootstrap +var __webpack_exports__ = {}; +/*!*********************!*\ + !*** ./src/view.js ***! + \*********************/ +/** + * Use this file for JavaScript code that you want to run in the front-end + * on posts/pages that contain this block. + * + * When this file is defined as the value of the `viewScript` property + * in `block.json` it will be enqueued on the front end of the site. + * + * Example: + * + * ```js + * { + * "viewScript": "file:./view.js" + * } + * ``` + * + * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script + */ + +/* eslint-disable no-console */ +console.log("Hello World! (from qsm-main-block block)"); +/* eslint-enable no-console */ +/******/ })() +; +//# sourceMappingURL=view.js.map \ No newline at end of file diff --git a/blocks/build/view.js.map b/blocks/build/view.js.map new file mode 100644 index 000000000..e791abefb --- /dev/null +++ b/blocks/build/view.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACAA,OAAO,CAACC,GAAG,CAAC,0CAA0C,CAAC;AACvD,8B","sources":["webpack://qsm/./src/view.js"],"sourcesContent":["/**\n * Use this file for JavaScript code that you want to run in the front-end \n * on posts/pages that contain this block.\n *\n * When this file is defined as the value of the `viewScript` property\n * in `block.json` it will be enqueued on the front end of the site.\n *\n * Example:\n *\n * ```js\n * {\n * \"viewScript\": \"file:./view.js\"\n * }\n * ```\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script\n */\n \n/* eslint-disable no-console */\nconsole.log(\"Hello World! (from qsm-main-block block)\");\n/* eslint-enable no-console */\n"],"names":["console","log"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/package-lock.json b/blocks/package-lock.json new file mode 100644 index 000000000..17c85511c --- /dev/null +++ b/blocks/package-lock.json @@ -0,0 +1,16714 @@ +{ + "name": "qsm", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "qsm", + "version": "1.0.0", + "license": "GPL-2.0-or-later", + "devDependencies": { + "@wordpress/scripts": "^26.12.0" + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/code-frame/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/code-frame/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/code-frame/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.9.tgz", + "integrity": "sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.22.17", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.17.tgz", + "integrity": "sha512-2EENLmhpwplDux5PSsZnSbnSkB3tZ6QTksgO25xwEL7pIDcNOMhF5v/s6RzwjMZzZzw9Ofc30gHv5ChCC8pifQ==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.22.15", + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-module-transforms": "^7.22.17", + "@babel/helpers": "^7.22.15", + "@babel/parser": "^7.22.16", + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.22.17", + "@babel/types": "^7.22.17", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/eslint-parser": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.22.15.tgz", + "integrity": "sha512-yc8OOBIQk1EcRrpizuARSQS0TWAcOMpEJ1aafhNznaeYkeL+OhqnDObGFylB8ka8VFF/sZc+S4RzHyO+3LjQxg==", + "dev": true, + "dependencies": { + "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || >=14.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.11.0", + "eslint": "^7.5.0 || ^8.0.0" + } + }, + "node_modules/@babel/generator": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.15.tgz", + "integrity": "sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.15", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz", + "integrity": "sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.22.15.tgz", + "integrity": "sha512-QkBXwGgaoC2GtGZRoma6kv7Szfv06khvhFav67ZExau2RaXzy8MpHSMO2PNoP2XtmQphJQRHFfg77Bq731Yizw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz", + "integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.22.9", + "@babel/helper-validator-option": "^7.22.15", + "browserslist": "^4.21.9", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.15.tgz", + "integrity": "sha512-jKkwA59IXcvSaiK2UN45kKwSC9o+KuoXsBDvHvU/7BecYIp8GQ2UwrVvFgJASUT+hBnwJx6MhvMCuMzwZZ7jlg==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-function-name": "^7.22.5", + "@babel/helper-member-expression-to-functions": "^7.22.15", + "@babel/helper-optimise-call-expression": "^7.22.5", + "@babel/helper-replace-supers": "^7.22.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-regexp-features-plugin": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.15.tgz", + "integrity": "sha512-29FkPLFjn4TPEa3RE7GpW+qbE8tlsu3jntNYNfcGsc49LphF1PQIiD+vMZ1z1xVOKt+93khA9tc2JBs3kBjA7w==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "regexpu-core": "^5.3.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.2.tgz", + "integrity": "sha512-k0qnnOqHn5dK9pZpfD5XXZ9SojAITdCKRn2Lp6rnDGzIbaP0rHyMPk/4wsSxVBVz4RfN0q6VpXWP2pDGIoQ7hw==", + "dev": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.22.6", + "@babel/helper-plugin-utils": "^7.22.5", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", + "integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", + "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.5", + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.22.15.tgz", + "integrity": "sha512-qLNsZbgrNh0fDQBCPocSL8guki1hcPvltGDv/NxvUoABwFq7GkKSu1nRXeJkVZc+wJvne2E0RKQz+2SQrz6eAA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.22.17", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.17.tgz", + "integrity": "sha512-XouDDhQESrLHTpnBtCKExJdyY4gJCdrvH2Pyv8r8kovX2U8G0dRUOT45T9XlbLtuu9CLXP15eusnkprhoPV5iQ==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz", + "integrity": "sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-remap-async-to-generator": { + "version": "7.22.17", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.17.tgz", + "integrity": "sha512-bxH77R5gjH3Nkde6/LuncQoLaP16THYPscurp1S8z7S9ZgezCyV3G8Hc+TZiCmY8pz4fp8CvKSgtJMW0FkLAxA==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-wrap-function": "^7.22.17" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.22.9.tgz", + "integrity": "sha512-LJIKvvpgPOPUThdYqcX6IXRuIcTkcAub0IaDRGCZH0p5GPUp7PhRU9QVgFcDDd51BaPkk77ZjqFwh6DZTAEmGg==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-member-expression-to-functions": "^7.22.5", + "@babel/helper-optimise-call-expression": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz", + "integrity": "sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.15.tgz", + "integrity": "sha512-4E/F9IIEi8WR94324mbDUMo074YTheJmd7eZF5vITTeYchqAi6sYXRLHUVsmkdmY4QjfKTcB2jB7dVP3NaBElQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", + "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-wrap-function": { + "version": "7.22.17", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.22.17.tgz", + "integrity": "sha512-nAhoheCMlrqU41tAojw9GpVEKDlTS8r3lzFmF0lP52LwblCPbuFSO7nGIZoIcoU5NIm1ABrna0cJExE4Ay6l2Q==", + "dev": true, + "dependencies": { + "@babel/helper-function-name": "^7.22.5", + "@babel/template": "^7.22.15", + "@babel/types": "^7.22.17" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.15.tgz", + "integrity": "sha512-7pAjK0aSdxOwR+CcYAqgWOGy5dcfvzsTIfFTb2odQqW47MDfv14UaJDY6eng8ylM2EaeKXdxaSWESbkmaQHTmw==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.22.15", + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.13.tgz", + "integrity": "sha512-C/BaXcnnvBCmHTpz/VGZ8jgtE2aYlW4hxDhseJAWZb7gqGM/qtCK6iZUb0TyKFf7BOUsBH7Q7fkRsDRhg1XklQ==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.5", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.22.16", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.16.tgz", + "integrity": "sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.22.15.tgz", + "integrity": "sha512-FB9iYlz7rURmRJyXRKEnalYPPdn87H5no108cyuQQyMwlpJ2SJtpIUBI27kdTin956pz+LPypkPVPUTlxOmrsg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.22.15.tgz", + "integrity": "sha512-Hyph9LseGvAeeXzikV88bczhsrLrIZqDPxO+sSmAunMPaGrBGhfMWzCPYTtiW9t+HzSE2wtV8e5cc5P6r1xMDQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", + "@babel/plugin-transform-optional-chaining": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.13.0" + } + }, + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", + "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.22.5.tgz", + "integrity": "sha512-rdV97N7KqsRzeNGoWUOK6yUsWarLjE5Su/Snk9IYPU9CwkWHs4t+rTGOvffTR8XGkJMTAdLfO0xVnXm8wugIJg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.22.5.tgz", + "integrity": "sha512-KwvoWDeNKPETmozyFE0P2rOLqh39EoQHNjqizrI5B8Vt0ZNS7M56s7dAiAqbYfiAYOuIzIh96z3iR2ktgu3tEg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-unicode-sets-regex": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.18.6", + "@babel/helper-plugin-utils": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.22.5.tgz", + "integrity": "sha512-26lTNXoVRdAnsaDXPpvCNUq+OVWEVC6bx7Vvz9rC53F2bagUWW4u4ii2+h8Fejfh7RYqPxn+libeFBBck9muEw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-generator-functions": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.22.15.tgz", + "integrity": "sha512-jBm1Es25Y+tVoTi5rfd5t1KLmL8ogLKpXszboWOTTtGFGz2RKnQe2yn7HbZ+kb/B8N0FVSGQo874NSlOU1T4+w==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-remap-async-to-generator": "^7.22.9", + "@babel/plugin-syntax-async-generators": "^7.8.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.22.5.tgz", + "integrity": "sha512-b1A8D8ZzE/VhNDoV1MSJTnpKkCG5bJo+19R4o4oy03zM7ws8yEMK755j61Dc3EyvdysbqH5BOOTquJ7ZX9C6vQ==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-remap-async-to-generator": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.22.5.tgz", + "integrity": "sha512-tdXZ2UdknEKQWKJP1KMNmuF5Lx3MymtMN/pvA+p/VEkhK8jVcQ1fzSy8KM9qRYhAf2/lV33hoMPKI/xaI9sADA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.22.15.tgz", + "integrity": "sha512-G1czpdJBZCtngoK1sJgloLiOHUnkb/bLZwqVZD8kXmq0ZnVfTTWUcs9OWtp0mBtYJ+4LQY1fllqBkOIPhXmFmw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-properties": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.22.5.tgz", + "integrity": "sha512-nDkQ0NfkOhPTq8YCLiWNxp1+f9fCobEjCb0n8WdbNUBc4IB5V7P1QnX9IjpSoquKrXF5SKojHleVNs2vGeHCHQ==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-static-block": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.22.11.tgz", + "integrity": "sha512-GMM8gGmqI7guS/llMFk1bJDkKfn3v3C4KHK9Yg1ey5qcHcOlKb0QvcMrgzvxo+T03/4szNh5lghY+fEC98Kq9g==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.22.11", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0" + } + }, + "node_modules/@babel/plugin-transform-classes": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.22.15.tgz", + "integrity": "sha512-VbbC3PGjBdE0wAWDdHM9G8Gm977pnYI0XpqMd6LrKISj8/DJXEsWqgRuTYaNE9Bv0JGhTZUzHDlMk18IpOuoqw==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-function-name": "^7.22.5", + "@babel/helper-optimise-call-expression": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-replace-supers": "^7.22.9", + "@babel/helper-split-export-declaration": "^7.22.6", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.22.5.tgz", + "integrity": "sha512-4GHWBgRf0krxPX+AaPtgBAlTgTeZmqDynokHOX7aqqAB4tHs3U2Y02zH6ETFdLZGcg9UQSD1WCmkVrE9ErHeOg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/template": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.22.15.tgz", + "integrity": "sha512-HzG8sFl1ZVGTme74Nw+X01XsUTqERVQ6/RLHo3XjGRzm7XD6QTtfS3NJotVgCGy8BzkDqRjRBD8dAyJn5TuvSQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.22.5.tgz", + "integrity": "sha512-5/Yk9QxCQCl+sOIB1WelKnVRxTJDSAIxtJLL2/pqL14ZVlbH0fUQUZa/T5/UnQtBNgghR7mfB8ERBKyKPCi7Vw==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.22.5.tgz", + "integrity": "sha512-dEnYD+9BBgld5VBXHnF/DbYGp3fqGMsyxKbtD1mDyIA7AkTSpKXFhCVuj/oQVOoALfBs77DudA0BE4d5mcpmqw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dynamic-import": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.22.11.tgz", + "integrity": "sha512-g/21plo58sfteWjaO0ZNVb+uEOkJNjAaHhbejrnBmu011l/eNDScmkbjCC3l4FKb10ViaGU4aOkFznSu2zRHgA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.22.5.tgz", + "integrity": "sha512-vIpJFNM/FjZ4rh1myqIya9jXwrwwgFRHPjT3DkUA9ZLHuzox8jiXkOLvwm1H+PQIP3CqfC++WPKeuDi0Sjdj1g==", + "dev": true, + "dependencies": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-export-namespace-from": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.22.11.tgz", + "integrity": "sha512-xa7aad7q7OiT8oNZ1mU7NrISjlSkVdMbNxn9IuLZyL9AJEhs1Apba3I+u5riX1dIkdptP5EKDG5XDPByWxtehw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.22.15.tgz", + "integrity": "sha512-me6VGeHsx30+xh9fbDLLPi0J1HzmeIIyenoOQHuw2D4m2SAU3NrspX5XxJLBpqn5yrLzrlw2Iy3RA//Bx27iOA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.22.5.tgz", + "integrity": "sha512-UIzQNMS0p0HHiQm3oelztj+ECwFnj+ZRV4KnguvlsD2of1whUeM6o7wGNj6oLwcDoAXQ8gEqfgC24D+VdIcevg==", + "dev": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.22.5", + "@babel/helper-function-name": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-json-strings": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.22.11.tgz", + "integrity": "sha512-CxT5tCqpA9/jXFlme9xIBCc5RPtdDq3JpkkhgHQqtDdiTnTI0jtZ0QzXhr5DILeYifDPp2wvY2ad+7+hLMW5Pw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-json-strings": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-literals": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.22.5.tgz", + "integrity": "sha512-fTLj4D79M+mepcw3dgFBTIDYpbcB9Sm0bpm4ppXPaO+U+PKFFyV9MGRvS0gvGw62sd10kT5lRMKXAADb9pWy8g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-logical-assignment-operators": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.22.11.tgz", + "integrity": "sha512-qQwRTP4+6xFCDV5k7gZBF3C31K34ut0tbEcTKxlX/0KXxm9GLcO14p570aWxFvVzx6QAfPgq7gaeIHXJC8LswQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.22.5.tgz", + "integrity": "sha512-RZEdkNtzzYCFl9SE9ATaUMTj2hqMb4StarOJLrZRbqqU4HSBE7UlBw9WBWQiDzrJZJdUWiMTVDI6Gv/8DPvfew==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.22.5.tgz", + "integrity": "sha512-R+PTfLTcYEmb1+kK7FNkhQ1gP4KgjpSO6HfH9+f8/yfp2Nt3ggBjiVpRwmwTlfqZLafYKJACy36yDXlEmI9HjQ==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.22.15.tgz", + "integrity": "sha512-jWL4eh90w0HQOTKP2MoXXUpVxilxsB2Vl4ji69rSjS3EcZ/v4sBmn+A3NpepuJzBhOaEBbR7udonlHHn5DWidg==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-simple-access": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.22.11.tgz", + "integrity": "sha512-rIqHmHoMEOhI3VkVf5jQ15l539KrwhzqcBO6wdCNWPWc/JWt9ILNYNUssbRpeq0qWns8svuw8LnMNCvWBIJ8wA==", + "dev": true, + "dependencies": { + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-module-transforms": "^7.22.9", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.22.5.tgz", + "integrity": "sha512-+S6kzefN/E1vkSsKx8kmQuqeQsvCKCd1fraCM7zXm4SFoggI099Tr4G8U81+5gtMdUeMQ4ipdQffbKLX0/7dBQ==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.22.5.tgz", + "integrity": "sha512-YgLLKmS3aUBhHaxp5hi1WJTgOUb/NCuDHzGT9z9WTt3YG+CPRhJs6nprbStx6DnWM4dh6gt7SU3sZodbZ08adQ==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.22.5.tgz", + "integrity": "sha512-AsF7K0Fx/cNKVyk3a+DW0JLo+Ua598/NxMRvxDnkpCIGFh43+h/v2xyhRUYf6oD8gE4QtL83C7zZVghMjHd+iw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.22.11.tgz", + "integrity": "sha512-YZWOw4HxXrotb5xsjMJUDlLgcDXSfO9eCmdl1bgW4+/lAGdkjaEvOnQ4p5WKKdUgSzO39dgPl0pTnfxm0OAXcg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-numeric-separator": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.22.11.tgz", + "integrity": "sha512-3dzU4QGPsILdJbASKhF/V2TVP+gJya1PsueQCxIPCEcerqF21oEcrob4mzjsp2Py/1nLfF5m+xYNMDpmA8vffg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-rest-spread": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.22.15.tgz", + "integrity": "sha512-fEB+I1+gAmfAyxZcX1+ZUwLeAuuf8VIg67CTznZE0MqVFumWkh8xWtn58I4dxdVf080wn7gzWoF8vndOViJe9Q==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.22.9", + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.22.5.tgz", + "integrity": "sha512-klXqyaT9trSjIUrcsYIfETAzmOEZL3cBYqOYLJxBHfMFFggmXOv+NYSX/Jbs9mzMVESw/WycLFPRx8ba/b2Ipw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-replace-supers": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-catch-binding": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.22.11.tgz", + "integrity": "sha512-rli0WxesXUeCJnMYhzAglEjLWVDF6ahb45HuprcmQuLidBJFWjNnOzssk2kuc6e33FlLaiZhG/kUIzUMWdBKaQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.22.15.tgz", + "integrity": "sha512-ngQ2tBhq5vvSJw2Q2Z9i7ealNkpDMU0rGWnHPKqRZO0tzZ5tlaoz4hDvhXioOoaE0X2vfNss1djwg0DXlfu30A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.22.15.tgz", + "integrity": "sha512-hjk7qKIqhyzhhUvRT683TYQOFa/4cQKwQy7ALvTpODswN40MljzNDa0YldevS6tGbxwaEKVn502JmY0dP7qEtQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-methods": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.22.5.tgz", + "integrity": "sha512-PPjh4gyrQnGe97JTalgRGMuU4icsZFnWkzicB/fUtzlKUqvsWBKEpPPfr5a2JiyirZkHxnAqkQMO5Z5B2kK3fA==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-property-in-object": { + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.22.11.tgz", + "integrity": "sha512-sSCbqZDBKHetvjSwpyWzhuHkmW5RummxJBVbYLkGkaiTOWGxml7SXt0iWa03bzxFIx7wOj3g/ILRd0RcJKBeSQ==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-create-class-features-plugin": "^7.22.11", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.22.5.tgz", + "integrity": "sha512-TiOArgddK3mK/x1Qwf5hay2pxI6wCZnvQqrFSqbtg1GLl2JcNMitVH/YnqjP+M31pLUeTfzY1HAXFDnUBV30rQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-constant-elements": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.22.5.tgz", + "integrity": "sha512-BF5SXoO+nX3h5OhlN78XbbDrBOffv+AxPP2ENaJOVqjWCgBDeOY3WcaUcddutGSfoap+5NEQ/q/4I3WZIvgkXA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-display-name": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.22.5.tgz", + "integrity": "sha512-PVk3WPYudRF5z4GKMEYUrLjPl38fJSKNaEOkFuoprioowGuWN6w2RKznuFNSlJx7pzzXXStPUnNSOEO0jL5EVw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.22.15.tgz", + "integrity": "sha512-oKckg2eZFa8771O/5vi7XeTvmM6+O9cxZu+kanTU7tD4sin5nO/G8jGJhq8Hvt2Z0kUoEDRayuZLaUlYl8QuGA==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-jsx": "^7.22.5", + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-development": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.22.5.tgz", + "integrity": "sha512-bDhuzwWMuInwCYeDeMzyi7TaBgRQei6DqxhbyniL7/VG4RSS7HtSL2QbY4eESy1KJqlWt8g3xeEBGPuo+XqC8A==", + "dev": true, + "dependencies": { + "@babel/plugin-transform-react-jsx": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-pure-annotations": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.22.5.tgz", + "integrity": "sha512-gP4k85wx09q+brArVinTXhWiyzLl9UpmGva0+mWyKxk6JZequ05x3eUcIUE+FyttPKJFRRVtAvQaJ6YF9h1ZpA==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.22.10", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.22.10.tgz", + "integrity": "sha512-F28b1mDt8KcT5bUyJc/U9nwzw6cV+UmTeRlXYIl2TNqMMJif0Jeey9/RQ3C4NOd2zp0/TRsDns9ttj2L523rsw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "regenerator-transform": "^0.15.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.22.5.tgz", + "integrity": "sha512-DTtGKFRQUDm8svigJzZHzb/2xatPc6TzNvAIJ5GqOKDsGFYgAskjRulbR/vGsPKq3OPqtexnz327qYpP57RFyA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-runtime": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.22.15.tgz", + "integrity": "sha512-tEVLhk8NRZSmwQ0DJtxxhTrCht1HVo8VaMzYT4w6lwyKBuHsgoioAUA7/6eT2fRfc5/23fuGdlwIxXhRVgWr4g==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "babel-plugin-polyfill-corejs2": "^0.4.5", + "babel-plugin-polyfill-corejs3": "^0.8.3", + "babel-plugin-polyfill-regenerator": "^0.5.2", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.22.5.tgz", + "integrity": "sha512-vM4fq9IXHscXVKzDv5itkO1X52SmdFBFcMIBZ2FRn2nqVYqw6dBexUgMvAjHW+KXpPPViD/Yo3GrDEBaRC0QYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-spread": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.22.5.tgz", + "integrity": "sha512-5ZzDQIGyvN4w8+dMmpohL6MBo+l2G7tfC/O2Dg7/hjpgeWvUx8FzfeOKxGog9IimPa4YekaQ9PlDqTLOljkcxg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.22.5.tgz", + "integrity": "sha512-zf7LuNpHG0iEeiyCNwX4j3gDg1jgt1k3ZdXBKbZSoA3BbGQGvMiSvfbZRR3Dr3aeJe3ooWFZxOOG3IRStYp2Bw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.22.5.tgz", + "integrity": "sha512-5ciOehRNf+EyUeewo8NkbQiUs4d6ZxiHo6BcBcnFlgiJfu16q0bQUw9Jvo0b0gBKFG1SMhDSjeKXSYuJLeFSMA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.22.5.tgz", + "integrity": "sha512-bYkI5lMzL4kPii4HHEEChkD0rkc+nvnlR6+o/qdqR6zrm0Sv/nodmyLhlq2DO0YKLUNd2VePmPRjJXSBh9OIdA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typescript": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.15.tgz", + "integrity": "sha512-1uirS0TnijxvQLnlv5wQBwOX3E1wCFX7ITv+9pBV2wKEk4K+M5tqDaoNXnTH8tjEIYHLO98MwiTWO04Ggz4XuA==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-create-class-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-typescript": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.22.10", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.22.10.tgz", + "integrity": "sha512-lRfaRKGZCBqDlRU3UIFovdp9c9mEvlylmpod0/OatICsSfuQ9YFthRo1tpTkGsklEefZdqlEFdY4A2dwTb6ohg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-property-regex": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.22.5.tgz", + "integrity": "sha512-HCCIb+CbJIAE6sXn5CjFQXMwkCClcOfPCzTlilJ8cUatfzwHlWQkbtV0zD338u9dZskwvuOYTuuaMaA8J5EI5A==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.22.5.tgz", + "integrity": "sha512-028laaOKptN5vHJf9/Arr/HiJekMd41hOEZYvNsrsXqJ7YPYuX2bQxh31fkZzGmq3YqHRJzYFFAVYvKfMPKqyg==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-sets-regex": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.22.5.tgz", + "integrity": "sha512-lhMfi4FC15j13eKrh3DnYHjpGj6UKQHtNKTbtc1igvAhRy4+kLhV07OpLcsN0VgDEw/MjAvJO4BdMJsHwMhzCg==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/preset-env": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.22.15.tgz", + "integrity": "sha512-tZFHr54GBkHk6hQuVA8w4Fmq+MSPsfvMG0vPnOYyTnJpyfMqybL8/MbNCPRT9zc2KBO2pe4tq15g6Uno4Jpoag==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.22.9", + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-validator-option": "^7.22.15", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.22.15", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.22.15", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-import-assertions": "^7.22.5", + "@babel/plugin-syntax-import-attributes": "^7.22.5", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.22.5", + "@babel/plugin-transform-async-generator-functions": "^7.22.15", + "@babel/plugin-transform-async-to-generator": "^7.22.5", + "@babel/plugin-transform-block-scoped-functions": "^7.22.5", + "@babel/plugin-transform-block-scoping": "^7.22.15", + "@babel/plugin-transform-class-properties": "^7.22.5", + "@babel/plugin-transform-class-static-block": "^7.22.11", + "@babel/plugin-transform-classes": "^7.22.15", + "@babel/plugin-transform-computed-properties": "^7.22.5", + "@babel/plugin-transform-destructuring": "^7.22.15", + "@babel/plugin-transform-dotall-regex": "^7.22.5", + "@babel/plugin-transform-duplicate-keys": "^7.22.5", + "@babel/plugin-transform-dynamic-import": "^7.22.11", + "@babel/plugin-transform-exponentiation-operator": "^7.22.5", + "@babel/plugin-transform-export-namespace-from": "^7.22.11", + "@babel/plugin-transform-for-of": "^7.22.15", + "@babel/plugin-transform-function-name": "^7.22.5", + "@babel/plugin-transform-json-strings": "^7.22.11", + "@babel/plugin-transform-literals": "^7.22.5", + "@babel/plugin-transform-logical-assignment-operators": "^7.22.11", + "@babel/plugin-transform-member-expression-literals": "^7.22.5", + "@babel/plugin-transform-modules-amd": "^7.22.5", + "@babel/plugin-transform-modules-commonjs": "^7.22.15", + "@babel/plugin-transform-modules-systemjs": "^7.22.11", + "@babel/plugin-transform-modules-umd": "^7.22.5", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.22.5", + "@babel/plugin-transform-new-target": "^7.22.5", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.22.11", + "@babel/plugin-transform-numeric-separator": "^7.22.11", + "@babel/plugin-transform-object-rest-spread": "^7.22.15", + "@babel/plugin-transform-object-super": "^7.22.5", + "@babel/plugin-transform-optional-catch-binding": "^7.22.11", + "@babel/plugin-transform-optional-chaining": "^7.22.15", + "@babel/plugin-transform-parameters": "^7.22.15", + "@babel/plugin-transform-private-methods": "^7.22.5", + "@babel/plugin-transform-private-property-in-object": "^7.22.11", + "@babel/plugin-transform-property-literals": "^7.22.5", + "@babel/plugin-transform-regenerator": "^7.22.10", + "@babel/plugin-transform-reserved-words": "^7.22.5", + "@babel/plugin-transform-shorthand-properties": "^7.22.5", + "@babel/plugin-transform-spread": "^7.22.5", + "@babel/plugin-transform-sticky-regex": "^7.22.5", + "@babel/plugin-transform-template-literals": "^7.22.5", + "@babel/plugin-transform-typeof-symbol": "^7.22.5", + "@babel/plugin-transform-unicode-escapes": "^7.22.10", + "@babel/plugin-transform-unicode-property-regex": "^7.22.5", + "@babel/plugin-transform-unicode-regex": "^7.22.5", + "@babel/plugin-transform-unicode-sets-regex": "^7.22.5", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "@babel/types": "^7.22.15", + "babel-plugin-polyfill-corejs2": "^0.4.5", + "babel-plugin-polyfill-corejs3": "^0.8.3", + "babel-plugin-polyfill-regenerator": "^0.5.2", + "core-js-compat": "^3.31.0", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-modules": { + "version": "0.1.6-no-external-plugins", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/preset-react": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.22.15.tgz", + "integrity": "sha512-Csy1IJ2uEh/PecCBXXoZGAZBeCATTuePzCSB7dLYWS0vOEj6CNpjxIhW4duWwZodBNueH7QO14WbGn8YyeuN9w==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-validator-option": "^7.22.15", + "@babel/plugin-transform-react-display-name": "^7.22.5", + "@babel/plugin-transform-react-jsx": "^7.22.15", + "@babel/plugin-transform-react-jsx-development": "^7.22.5", + "@babel/plugin-transform-react-pure-annotations": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-typescript": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.22.15.tgz", + "integrity": "sha512-HblhNmh6yM+cU4VwbBRpxFhxsTdfS1zsvH9W+gEjD0ARV9+8B4sNfpI6GuhePti84nuvhiwKS539jKPFHskA9A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-validator-option": "^7.22.15", + "@babel/plugin-syntax-jsx": "^7.22.5", + "@babel/plugin-transform-modules-commonjs": "^7.22.15", + "@babel/plugin-transform-typescript": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==", + "dev": true + }, + "node_modules/@babel/runtime": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.15.tgz", + "integrity": "sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.22.17", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.17.tgz", + "integrity": "sha512-xK4Uwm0JnAMvxYZxOVecss85WxTEIbTa7bnGyf/+EgCL5Zt3U7htUpEOWv9detPlamGKuRzCqw74xVglDWpPdg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.22.15", + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-function-name": "^7.22.5", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.22.16", + "@babel/types": "^7.22.17", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.22.17", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.17.tgz", + "integrity": "sha512-YSQPHLFtQNE5xN9tHuZnzu8vPr61wVTBZdfv1meex1NBosa4iT05k/Jw06ddJugi4bk7The/oSwQGFcksmEJQg==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.15", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@csstools/selector-specificity": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.2.0.tgz", + "integrity": "sha512-+OJ9konv95ClSTOJCmMZqpd5+YGsB2S+x6w3E1oaM8UuR5j8nTNHYSz8c9BEPGDOCMQYIEEGlVPj/VY64iTbGw==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + }, + "peerDependencies": { + "postcss-selector-parser": "^6.0.10" + } + }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.40.1", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.40.1.tgz", + "integrity": "sha512-YORCdZSusAlBrFpZ77pJjc5r1bQs5caPWtAu+WWmiSo+8XaUzseapVrfAtiRFbQWnrBxxLLEwF6f6ZG/UgCQCg==", + "dev": true, + "dependencies": { + "comment-parser": "1.4.0", + "esquery": "^1.5.0", + "jsdoc-type-pratt-parser": "~4.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.1.tgz", + "integrity": "sha512-PWiOzLIUAjN/w5K17PoF4n6sKBw0gqLHPhywmYHP4t1VFQQVYeb1yWsJwnMVEMl3tUHME7X/SJPZLmtG7XBDxQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.21.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", + "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz", + "integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", + "dev": true + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/reporters/node_modules/istanbul-lib-instrument": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.0.tgz", + "integrity": "sha512-x58orMzEVfzPUKqlbLd1hXCnySCxKdDKa6Rjg97CwuLLRI4g3FHTdnExu1OqffVFay6zeMW+T6/DowFLndWnIw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@jest/reporters/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@jest/reporters/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@jest/reporters/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@leichtgewicht/ip-codec": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", + "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==", + "dev": true + }, + "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { + "version": "5.1.1-v1", + "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", + "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==", + "dev": true, + "dependencies": { + "eslint-scope": "5.1.1" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pmmmwh/react-refresh-webpack-plugin": { + "version": "0.5.11", + "resolved": "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.11.tgz", + "integrity": "sha512-7j/6vdTym0+qZ6u4XbSAxrWBGYSdCfTzySkj7WAFgDLmSyWlOrWvpyzxlFh5jtw9dn0oL/jtW+06XfFiisN3JQ==", + "dev": true, + "dependencies": { + "ansi-html-community": "^0.0.8", + "common-path-prefix": "^3.0.0", + "core-js-pure": "^3.23.3", + "error-stack-parser": "^2.0.6", + "find-up": "^5.0.0", + "html-entities": "^2.1.0", + "loader-utils": "^2.0.4", + "schema-utils": "^3.0.0", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">= 10.13" + }, + "peerDependencies": { + "@types/webpack": "4.x || 5.x", + "react-refresh": ">=0.10.0 <1.0.0", + "sockjs-client": "^1.4.0", + "type-fest": ">=0.17.0 <5.0.0", + "webpack": ">=4.43.0 <6.0.0", + "webpack-dev-server": "3.x || 4.x", + "webpack-hot-middleware": "2.x", + "webpack-plugin-serve": "0.x || 1.x" + }, + "peerDependenciesMeta": { + "@types/webpack": { + "optional": true + }, + "sockjs-client": { + "optional": true + }, + "type-fest": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + }, + "webpack-hot-middleware": { + "optional": true + }, + "webpack-plugin-serve": { + "optional": true + } + } + }, + "node_modules/@polka/url": { + "version": "1.0.0-next.23", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.23.tgz", + "integrity": "sha512-C16M+IYz0rgRhWZdCmK+h58JMv8vijAA61gmz2rspCSwKwzBebpdcsiUmwrtJRdphuY30i6BSLEOP8ppbNLyLg==", + "dev": true + }, + "node_modules/@sideway/address": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==", + "dev": true + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "dev": true + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@svgr/babel-plugin-add-jsx-attribute": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz", + "integrity": "sha512-b9MIk7yhdS1pMCZM8VeNfUlSKVRhsHZNMl5O9SfaX0l0t5wjdgu4IDzGB8bpnGBBOjGST3rRFVsaaEtI4W6f7g==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@svgr/babel-plugin-remove-jsx-attribute": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-remove-jsx-attribute/-/babel-plugin-remove-jsx-attribute-8.0.0.tgz", + "integrity": "sha512-BcCkm/STipKvbCl6b7QFrMh/vx00vIP63k2eM66MfHJzPr6O2U0jYEViXkHJWqXqQYjdeA9cuCl5KWmlwjDvbA==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@svgr/babel-plugin-remove-jsx-empty-expression": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-remove-jsx-empty-expression/-/babel-plugin-remove-jsx-empty-expression-8.0.0.tgz", + "integrity": "sha512-5BcGCBfBxB5+XSDSWnhTThfI9jcO5f0Ai2V24gZpG+wXF14BzwxxdDb4g6trdOux0rhibGs385BeFMSmxtS3uA==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@svgr/babel-plugin-replace-jsx-attribute-value": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-replace-jsx-attribute-value/-/babel-plugin-replace-jsx-attribute-value-8.0.0.tgz", + "integrity": "sha512-KVQ+PtIjb1BuYT3ht8M5KbzWBhdAjjUPdlMtpuw/VjT8coTrItWX6Qafl9+ji831JaJcu6PJNKCV0bp01lBNzQ==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@svgr/babel-plugin-svg-dynamic-title": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-dynamic-title/-/babel-plugin-svg-dynamic-title-8.0.0.tgz", + "integrity": "sha512-omNiKqwjNmOQJ2v6ge4SErBbkooV2aAWwaPFs2vUY7p7GhVkzRkJ00kILXQvRhA6miHnNpXv7MRnnSjdRjK8og==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@svgr/babel-plugin-svg-em-dimensions": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-em-dimensions/-/babel-plugin-svg-em-dimensions-8.0.0.tgz", + "integrity": "sha512-mURHYnu6Iw3UBTbhGwE/vsngtCIbHE43xCRK7kCw4t01xyGqb2Pd+WXekRRoFOBIY29ZoOhUCTEweDMdrjfi9g==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@svgr/babel-plugin-transform-react-native-svg": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-react-native-svg/-/babel-plugin-transform-react-native-svg-8.1.0.tgz", + "integrity": "sha512-Tx8T58CHo+7nwJ+EhUwx3LfdNSG9R2OKfaIXXs5soiy5HtgoAEkDay9LIimLOcG8dJQH1wPZp/cnAv6S9CrR1Q==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@svgr/babel-plugin-transform-svg-component": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-svg-component/-/babel-plugin-transform-svg-component-8.0.0.tgz", + "integrity": "sha512-DFx8xa3cZXTdb/k3kfPeaixecQLgKh5NVBMwD0AQxOzcZawK4oo1Jh9LbrcACUivsCA7TLG8eeWgrDXjTMhRmw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@svgr/babel-preset": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-preset/-/babel-preset-8.1.0.tgz", + "integrity": "sha512-7EYDbHE7MxHpv4sxvnVPngw5fuR6pw79SkcrILHJ/iMpuKySNCl5W1qcwPEpU+LgyRXOaAFgH0KhwD18wwg6ug==", + "dev": true, + "dependencies": { + "@svgr/babel-plugin-add-jsx-attribute": "8.0.0", + "@svgr/babel-plugin-remove-jsx-attribute": "8.0.0", + "@svgr/babel-plugin-remove-jsx-empty-expression": "8.0.0", + "@svgr/babel-plugin-replace-jsx-attribute-value": "8.0.0", + "@svgr/babel-plugin-svg-dynamic-title": "8.0.0", + "@svgr/babel-plugin-svg-em-dimensions": "8.0.0", + "@svgr/babel-plugin-transform-react-native-svg": "8.1.0", + "@svgr/babel-plugin-transform-svg-component": "8.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@svgr/core": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/core/-/core-8.1.0.tgz", + "integrity": "sha512-8QqtOQT5ACVlmsvKOJNEaWmRPmcojMOzCz4Hs2BGG/toAp/K38LcsMRyLp349glq5AzJbCEeimEoxaX6v/fLrA==", + "dev": true, + "dependencies": { + "@babel/core": "^7.21.3", + "@svgr/babel-preset": "8.1.0", + "camelcase": "^6.2.0", + "cosmiconfig": "^8.1.3", + "snake-case": "^3.0.4" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + } + }, + "node_modules/@svgr/hast-util-to-babel-ast": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@svgr/hast-util-to-babel-ast/-/hast-util-to-babel-ast-8.0.0.tgz", + "integrity": "sha512-EbDKwO9GpfWP4jN9sGdYwPBU0kdomaPIL2Eu4YwmgP+sJeXT+L7bMwJUBnhzfH8Q2qMBqZ4fJwpCyYsAN3mt2Q==", + "dev": true, + "dependencies": { + "@babel/types": "^7.21.3", + "entities": "^4.4.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + } + }, + "node_modules/@svgr/plugin-jsx": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/plugin-jsx/-/plugin-jsx-8.1.0.tgz", + "integrity": "sha512-0xiIyBsLlr8quN+WyuxooNW9RJ0Dpr8uOnH/xrCVO8GLUcwHISwj1AG0k+LFzteTkAA0GbX0kj9q6Dk70PTiPA==", + "dev": true, + "dependencies": { + "@babel/core": "^7.21.3", + "@svgr/babel-preset": "8.1.0", + "@svgr/hast-util-to-babel-ast": "8.0.0", + "svg-parser": "^2.0.4" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@svgr/core": "*" + } + }, + "node_modules/@svgr/plugin-svgo": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/plugin-svgo/-/plugin-svgo-8.1.0.tgz", + "integrity": "sha512-Ywtl837OGO9pTLIN/onoWLmDQ4zFUycI1g76vuKGEz6evR/ZTJlJuz3G/fIkb6OVBJ2g0o6CGJzaEjfmEo3AHA==", + "dev": true, + "dependencies": { + "cosmiconfig": "^8.1.3", + "deepmerge": "^4.3.1", + "svgo": "^3.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + }, + "peerDependencies": { + "@svgr/core": "*" + } + }, + "node_modules/@svgr/webpack": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@svgr/webpack/-/webpack-8.1.0.tgz", + "integrity": "sha512-LnhVjMWyMQV9ZmeEy26maJk+8HTIbd59cH4F2MJ439k9DqejRisfFNGAPvRYlKETuh9LrImlS8aKsBgKjMA8WA==", + "dev": true, + "dependencies": { + "@babel/core": "^7.21.3", + "@babel/plugin-transform-react-constant-elements": "^7.21.3", + "@babel/preset-env": "^7.20.2", + "@babel/preset-react": "^7.18.6", + "@babel/preset-typescript": "^7.21.0", + "@svgr/core": "8.1.0", + "@svgr/plugin-jsx": "8.1.0", + "@svgr/plugin-svgo": "8.1.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/gregberge" + } + }, + "node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@trysound/sax": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", + "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", + "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", + "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", + "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/bonjour": { + "version": "3.5.10", + "resolved": "https://registry.npmjs.org/@types/bonjour/-/bonjour-3.5.10.tgz", + "integrity": "sha512-p7ienRMiS41Nu2/igbJxxLDWrSZ0WxM8UQgCeO9KhoVF7cOVFkrKsiDr1EsJIla8vV3oEEjGcz11jc5yimhzZw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.36", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.36.tgz", + "integrity": "sha512-P63Zd/JUGq+PdrM1lv0Wv5SBYeA2+CORvbrXbngriYY0jzLUWfQMQQxOhjONEz/wlHOAxOdY7CY65rgQdTjq2w==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/connect-history-api-fallback": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.1.tgz", + "integrity": "sha512-iaQslNbARe8fctL5Lk+DsmgWOM83lM+7FzP0eQUJs1jd3kBE8NWqBTIT2S8SqQOJjxvt2eyIjpOuYeRXq2AdMw==", + "dev": true, + "dependencies": { + "@types/express-serve-static-core": "*", + "@types/node": "*" + } + }, + "node_modules/@types/eslint": { + "version": "8.44.2", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz", + "integrity": "sha512-sdPRb9K6iL5XZOmBubg8yiFp5yS/JdUDQsq5e6h95km91MCYMuvp7mh1fjPEYUhvHepKpZOjnEaMBR4PxjWDzg==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", + "dev": true, + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", + "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", + "dev": true + }, + "node_modules/@types/express": { + "version": "4.17.17", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz", + "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==", + "dev": true, + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.17.36", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.36.tgz", + "integrity": "sha512-zbivROJ0ZqLAtMzgzIUC4oNqDG9iF0lSsAqpOD9kbs5xcIM3dTiyuHvBc7R8MtWBp3AAWGaovJa+wzWPjLYW7Q==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", + "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==", + "dev": true + }, + "node_modules/@types/http-proxy": { + "version": "1.17.11", + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.11.tgz", + "integrity": "sha512-HC8G7c1WmaF2ekqpnFq626xd3Zz0uvaqFmBJNRZCGEZCXkvSdJoNFn/8Ygbd9fKNQj8UzLdCETaI0UWPAjK7IA==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jsdom": { + "version": "20.0.1", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", + "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", + "dev": true + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, + "node_modules/@types/mime": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", + "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", + "dev": true + }, + "node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true + }, + "node_modules/@types/minimist": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.6.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.0.tgz", + "integrity": "sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==", + "dev": true + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", + "dev": true + }, + "node_modules/@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "node_modules/@types/prop-types": { + "version": "15.7.5", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", + "dev": true + }, + "node_modules/@types/qs": { + "version": "6.9.8", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.8.tgz", + "integrity": "sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg==", + "dev": true + }, + "node_modules/@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", + "dev": true + }, + "node_modules/@types/react": { + "version": "18.2.21", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.21.tgz", + "integrity": "sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA==", + "dev": true, + "dependencies": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.2.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.7.tgz", + "integrity": "sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA==", + "dev": true, + "dependencies": { + "@types/react": "*" + } + }, + "node_modules/@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", + "dev": true + }, + "node_modules/@types/scheduler": { + "version": "0.16.3", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz", + "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==", + "dev": true + }, + "node_modules/@types/semver": { + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.2.tgz", + "integrity": "sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==", + "dev": true + }, + "node_modules/@types/send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz", + "integrity": "sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==", + "dev": true, + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@types/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha512-d/Hs3nWDxNL2xAczmOVZNj92YZCS6RGxfBPjKzuu/XirCgXdpKEb88dYNbrYGint6IVWLNP+yonwVAuRC0T2Dg==", + "dev": true, + "dependencies": { + "@types/express": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.2.tgz", + "integrity": "sha512-J2LqtvFYCzaj8pVYKw8klQXrLLk7TBZmQ4ShlcdkELFKGwGMfevMLneMMRkMgZxotOD9wg497LpC7O8PcvAmfw==", + "dev": true, + "dependencies": { + "@types/http-errors": "*", + "@types/mime": "*", + "@types/node": "*" + } + }, + "node_modules/@types/sockjs": { + "version": "0.3.33", + "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.33.tgz", + "integrity": "sha512-f0KEEe05NvUnat+boPTZ0dgaLZ4SfSouXUgv5noUiefG2ajgKjmETo9ZJyuqsl7dfl2aHlLJUiki6B4ZYldiiw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/source-list-map": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz", + "integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==", + "dev": true + }, + "node_modules/@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "dev": true + }, + "node_modules/@types/tapable": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.9.tgz", + "integrity": "sha512-fOHIwZua0sRltqWzODGUM6b4ffZrf/vzGUmNXdR+4DzuJP42PMbM5dLKcdzlYvv8bMJ3GALOzkk1q7cDm2zPyA==", + "dev": true + }, + "node_modules/@types/tough-cookie": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.3.tgz", + "integrity": "sha512-THo502dA5PzG/sfQH+42Lw3fvmYkceefOspdCwpHRul8ik2Jv1K8I5OZz1AT3/rs46kwgMCe9bSBmDLYkkOMGg==", + "dev": true + }, + "node_modules/@types/uglify-js": { + "version": "3.17.2", + "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.17.2.tgz", + "integrity": "sha512-9SjrHO54LINgC/6Ehr81NjAxAYvwEZqjUHLjJYvC4Nmr9jbLQCIZbWSvl4vXQkkmR1UAuaKDycau3O1kWGFyXQ==", + "dev": true, + "dependencies": { + "source-map": "^0.6.1" + } + }, + "node_modules/@types/uglify-js/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@types/webpack": { + "version": "4.41.33", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.33.tgz", + "integrity": "sha512-PPajH64Ft2vWevkerISMtnZ8rTs4YmRbs+23c402J0INmxDKCrhZNvwZYtzx96gY2wAtXdrK1BS2fiC8MlLr3g==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/tapable": "^1", + "@types/uglify-js": "*", + "@types/webpack-sources": "*", + "anymatch": "^3.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/@types/webpack-sources": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-3.2.0.tgz", + "integrity": "sha512-Ft7YH3lEVRQ6ls8k4Ff1oB4jN6oy/XmU6tQISKdhfh+1mR+viZFphS6WL0IrtDOzvefmJg5a0s7ZQoRXwqTEFg==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/source-list-map": "*", + "source-map": "^0.7.3" + } + }, + "node_modules/@types/webpack/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@types/ws": { + "version": "8.5.5", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", + "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "dev": true + }, + "node_modules/@types/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", + "dev": true, + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", + "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/type-utils": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", + "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", + "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz", + "integrity": "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", + "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz", + "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz", + "integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "eslint-scope": "^5.1.1", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz", + "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.62.0", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", + "integrity": "sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==", + "dev": true, + "dependencies": { + "@webassemblyjs/helper-numbers": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", + "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", + "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.6.tgz", + "integrity": "sha512-z3nFzdcp1mb8nEOFFk8DrYLpHvhKC3grJD2ardfKOzmbmJvEf/tPIqCY+sNcwZIY8ZD7IkB2l7/pqhUhqm7hLA==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", + "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", + "dev": true, + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.11.6", + "@webassemblyjs/helper-api-error": "1.11.6", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", + "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.6.tgz", + "integrity": "sha512-LPpZbSOwTpEC2cgn4hTydySy1Ke+XEu+ETXuoyvuyezHO3Kjdu90KK95Sh9xTbmjrCsUwvWwCOQQNta37VrS9g==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/wasm-gen": "1.11.6" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", + "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", + "dev": true, + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", + "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", + "dev": true, + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", + "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", + "dev": true + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.6.tgz", + "integrity": "sha512-Ybn2I6fnfIGuCR+Faaz7YcvtBKxvoLV3Lebn1tM4o/IAJzmi9AWYIPWpyBfU8cC+JxAO57bk4+zdsTjJR+VTOw==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/helper-wasm-section": "1.11.6", + "@webassemblyjs/wasm-gen": "1.11.6", + "@webassemblyjs/wasm-opt": "1.11.6", + "@webassemblyjs/wasm-parser": "1.11.6", + "@webassemblyjs/wast-printer": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.6.tgz", + "integrity": "sha512-3XOqkZP/y6B4F0PBAXvI1/bky7GryoogUtfwExeP/v7Nzwo1QLcq5oQmpKlftZLbT+ERUOAZVQjuNVak6UXjPA==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.6.tgz", + "integrity": "sha512-cOrKuLRE7PCe6AsOVl7WasYf3wbSo4CeOk6PkrjS7g57MFfVUF9u6ysQBBODX0LdgSvQqRiGz3CXvIDKcPNy4g==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/wasm-gen": "1.11.6", + "@webassemblyjs/wasm-parser": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.6.tgz", + "integrity": "sha512-6ZwPeGzMJM3Dqp3hCsLgESxBGtT/OeCvCZ4TA1JUPYgmhAx38tTPR9JaKy0S5H3evQpO/h2uWs2j6Yc/fjkpTQ==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/helper-api-error": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.6.tgz", + "integrity": "sha512-JM7AhRcE+yW2GWYaKeHL5vt4xqee5N2WcezptmgyhNS+ScggqcT1OtXykhAb13Sn5Yas0j2uv9tHgrjwvzAP4A==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.6", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", + "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "dev": true, + "peerDependencies": { + "webpack": "4.x.x || 5.x.x", + "webpack-cli": "4.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", + "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "dev": true, + "dependencies": { + "envinfo": "^7.7.3" + }, + "peerDependencies": { + "webpack-cli": "4.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", + "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "dev": true, + "peerDependencies": { + "webpack-cli": "4.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@wordpress/babel-plugin-import-jsx-pragma": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@wordpress/babel-plugin-import-jsx-pragma/-/babel-plugin-import-jsx-pragma-4.24.0.tgz", + "integrity": "sha512-qtde+CeTWWnXsLsUSJddKZmOQnbEjqfUk8vUEHySHIDUNd785etG0i6m6YCudpJPKTbacNSZiJ5GVZvWArBUrw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@babel/core": "^7.12.9" + } + }, + "node_modules/@wordpress/babel-preset-default": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@wordpress/babel-preset-default/-/babel-preset-default-7.25.0.tgz", + "integrity": "sha512-wxFDIWxAZs+GcHkByNpzQLJq9LMny79n51ntTwaCTUtjkAJoYqGujCCdwuF7G1EKsv2zmyQhLXa5CWjikYveEQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.16.0", + "@babel/plugin-transform-react-jsx": "^7.16.0", + "@babel/plugin-transform-runtime": "^7.16.0", + "@babel/preset-env": "^7.16.0", + "@babel/preset-typescript": "^7.16.0", + "@babel/runtime": "^7.16.0", + "@wordpress/babel-plugin-import-jsx-pragma": "^4.24.0", + "@wordpress/browserslist-config": "^5.24.0", + "@wordpress/element": "^5.18.0", + "@wordpress/warning": "^2.41.0", + "browserslist": "^4.21.9", + "core-js": "^3.31.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@wordpress/base-styles": { + "version": "4.32.0", + "resolved": "https://registry.npmjs.org/@wordpress/base-styles/-/base-styles-4.32.0.tgz", + "integrity": "sha512-P75dFG2nnoUiTmQTIatnJNB9D0/Th9+47ki1+0/uQwH5zCCc80+TQAXR4DRD/XACg5nDbYHiy0waOGTm9+vuqw==", + "dev": true + }, + "node_modules/@wordpress/browserslist-config": { + "version": "5.24.0", + "resolved": "https://registry.npmjs.org/@wordpress/browserslist-config/-/browserslist-config-5.24.0.tgz", + "integrity": "sha512-6QYbEVeIZxak8Bt0XCQ7msF9QcVjWqdREgDXVcWPD907WdKC5Hmi8ZtY63mY5OouKn5Cnxg7VJRv1AWb9eT0/g==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@wordpress/dependency-extraction-webpack-plugin": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@wordpress/dependency-extraction-webpack-plugin/-/dependency-extraction-webpack-plugin-4.24.0.tgz", + "integrity": "sha512-HS9Ol9dOV6PU4TBxWVE9yDHXFInoOrXzPeoojw7SBKUziiCAh7ZG9JPFt/hJR83rXf9Ro6FEFke4oOtUTZmo6A==", + "dev": true, + "dependencies": { + "json2php": "^0.0.7", + "webpack-sources": "^3.2.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "webpack": "^4.8.3 || ^5.0.0" + } + }, + "node_modules/@wordpress/element": { + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-5.18.0.tgz", + "integrity": "sha512-OynuZuTFdmterh/ASmMSSKjdBj5r1hcwQi37AQnp7+GpyIV3Ol5PR4UWWYB0coW0Gkd0giJkQAwC71/ZkEPYqQ==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.16.0", + "@types/react": "^18.0.21", + "@types/react-dom": "^18.0.6", + "@wordpress/escape-html": "^2.41.0", + "change-case": "^4.1.2", + "is-plain-object": "^5.0.0", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@wordpress/escape-html": { + "version": "2.41.0", + "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.41.0.tgz", + "integrity": "sha512-fFDuAO/csLVemQrJKTrwxjmR7d2a6zEuDVCKi2jUt7j9rpLpz9IZnEVD2q/icOj2+u6joeDwvCyyPyTreqEZHA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.16.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@wordpress/eslint-plugin": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-15.1.0.tgz", + "integrity": "sha512-iKc8YnakbOWUh7b5A79XhZ9nIJfkHmKAkluxd56kwmKhhn1dfreRaCXpjjBk9E170axKmkHPqFar4xEMy9kO7A==", + "dev": true, + "dependencies": { + "@babel/eslint-parser": "^7.16.0", + "@typescript-eslint/eslint-plugin": "^5.62.0", + "@typescript-eslint/parser": "^5.62.0", + "@wordpress/babel-preset-default": "^7.25.0", + "@wordpress/prettier-config": "^2.24.0", + "cosmiconfig": "^7.0.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-jest": "^27.2.1", + "eslint-plugin-jsdoc": "^46.4.6", + "eslint-plugin-jsx-a11y": "^6.5.1", + "eslint-plugin-prettier": "^3.3.0", + "eslint-plugin-react": "^7.27.0", + "eslint-plugin-react-hooks": "^4.3.0", + "globals": "^13.12.0", + "requireindex": "^1.2.0" + }, + "engines": { + "node": ">=14", + "npm": ">=6.14.4" + }, + "peerDependencies": { + "@babel/core": ">=7", + "eslint": ">=8", + "prettier": ">=2", + "typescript": ">=4" + }, + "peerDependenciesMeta": { + "prettier": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/@wordpress/eslint-plugin/node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@wordpress/eslint-plugin/node_modules/globals": { + "version": "13.21.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", + "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wordpress/eslint-plugin/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wordpress/jest-console": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/jest-console/-/jest-console-7.12.0.tgz", + "integrity": "sha512-sSgG65n32wPdKVWT6aaaslpOOn/TcRw9413UY+NqBgyc/HIlsSR9zKeoFwR3RoOyWr055PABOGNLup+RgdPKxw==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.16.0", + "jest-matcher-utils": "^29.6.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "jest": ">=29" + } + }, + "node_modules/@wordpress/jest-preset-default": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/jest-preset-default/-/jest-preset-default-11.12.0.tgz", + "integrity": "sha512-HPpjUZsjxwvDDTw2ZWdgR1QVaVbsENCR/u0GRiC4NAArHABoleoFopwMZXJtbO1ii9vdeLJvgRNg1YXV5Zj79g==", + "dev": true, + "dependencies": { + "@wordpress/jest-console": "^7.12.0", + "babel-jest": "^29.6.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@babel/core": ">=7", + "jest": ">=29" + } + }, + "node_modules/@wordpress/npm-package-json-lint-config": { + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@wordpress/npm-package-json-lint-config/-/npm-package-json-lint-config-4.26.0.tgz", + "integrity": "sha512-LSTk773DE8gSk4y42EcQ4+56ojXY8vUT8F91Zrrsv1Ixdo7EoEbSC84+LEAsN2y60biN71193nbVDeLikgH2jA==", + "dev": true, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "npm-package-json-lint": ">=6.0.0" + } + }, + "node_modules/@wordpress/postcss-plugins-preset": { + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@wordpress/postcss-plugins-preset/-/postcss-plugins-preset-4.25.0.tgz", + "integrity": "sha512-IoCjFYC/p2SchwPg2IXKq0gCWbjmvqTMn9BVpcjAg8NlXngIFrVk23AqHRjRXHyokG9s/3o5D2ILsKbU7u5DaQ==", + "dev": true, + "dependencies": { + "@wordpress/base-styles": "^4.32.0", + "autoprefixer": "^10.2.5" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/@wordpress/prettier-config": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/@wordpress/prettier-config/-/prettier-config-2.24.0.tgz", + "integrity": "sha512-dieaF2lU+7L2wvcg1F5Bn96DanRd7tje1clK97PGVdPia6CHyTVlBAovQjBTh7NePrqfLUCs+8ii4W0UyB5bcg==", + "dev": true, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "prettier": ">=2" + } + }, + "node_modules/@wordpress/scripts": { + "version": "26.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/scripts/-/scripts-26.12.0.tgz", + "integrity": "sha512-fT8tyEA/y2n/TDJ9az26MnhmGm60gNrm1VPbs3/xk8+YuvUdyPU2JjeGQMGGJlITjoRlTk2qE7FqSvQlDLCLbg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.16.0", + "@pmmmwh/react-refresh-webpack-plugin": "^0.5.2", + "@svgr/webpack": "^8.0.1", + "@wordpress/babel-preset-default": "^7.25.0", + "@wordpress/browserslist-config": "^5.24.0", + "@wordpress/dependency-extraction-webpack-plugin": "^4.24.0", + "@wordpress/eslint-plugin": "^15.1.0", + "@wordpress/jest-preset-default": "^11.12.0", + "@wordpress/npm-package-json-lint-config": "^4.26.0", + "@wordpress/postcss-plugins-preset": "^4.25.0", + "@wordpress/prettier-config": "^2.24.0", + "@wordpress/stylelint-config": "^21.24.0", + "adm-zip": "^0.5.9", + "babel-jest": "^29.6.2", + "babel-loader": "^8.2.3", + "browserslist": "^4.21.9", + "chalk": "^4.0.0", + "check-node-version": "^4.1.0", + "clean-webpack-plugin": "^3.0.0", + "copy-webpack-plugin": "^10.2.0", + "cross-spawn": "^5.1.0", + "css-loader": "^6.2.0", + "cssnano": "^6.0.1", + "cwd": "^0.10.0", + "dir-glob": "^3.0.1", + "eslint": "^8.3.0", + "expect-puppeteer": "^4.4.0", + "fast-glob": "^3.2.7", + "filenamify": "^4.2.0", + "jest": "^29.6.2", + "jest-dev-server": "^6.0.2", + "jest-environment-jsdom": "^29.6.2", + "jest-environment-node": "^29.6.2", + "markdownlint-cli": "^0.31.1", + "merge-deep": "^3.0.3", + "mini-css-extract-plugin": "^2.5.1", + "minimist": "^1.2.0", + "npm-package-json-lint": "^6.4.0", + "npm-packlist": "^3.0.0", + "postcss": "^8.4.5", + "postcss-loader": "^6.2.1", + "prettier": "npm:wp-prettier@2.8.5", + "puppeteer-core": "^13.2.0", + "react-refresh": "^0.10.0", + "read-pkg-up": "^7.0.1", + "resolve-bin": "^0.4.0", + "sass": "^1.35.2", + "sass-loader": "^12.1.0", + "source-map-loader": "^3.0.0", + "stylelint": "^14.2.0", + "terser-webpack-plugin": "^5.3.9", + "url-loader": "^4.1.1", + "webpack": "^5.47.1", + "webpack-bundle-analyzer": "^4.4.2", + "webpack-cli": "^4.9.1", + "webpack-dev-server": "^4.4.0" + }, + "bin": { + "wp-scripts": "bin/wp-scripts.js" + }, + "engines": { + "node": ">=14", + "npm": ">=6.14.4" + }, + "peerDependencies": { + "react": "^18.0.0", + "react-dom": "^18.0.0" + } + }, + "node_modules/@wordpress/stylelint-config": { + "version": "21.24.0", + "resolved": "https://registry.npmjs.org/@wordpress/stylelint-config/-/stylelint-config-21.24.0.tgz", + "integrity": "sha512-GJV0rSQL5iTcS/mJ7x/ccZ7Z06yYJhDY0XWNA3qVRNMgkV/iyv2rXNNubpDl+m4kcgi8g3dg3jNccvRO1ZDSgg==", + "dev": true, + "dependencies": { + "stylelint-config-recommended": "^6.0.0", + "stylelint-config-recommended-scss": "^5.0.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "stylelint": "^14.2" + } + }, + "node_modules/@wordpress/warning": { + "version": "2.41.0", + "resolved": "https://registry.npmjs.org/@wordpress/warning/-/warning-2.41.0.tgz", + "integrity": "sha512-kSqx1z7MaNjNFg+/b5H9oY5D6hYpsKPvaonpk5CADTXOoWoEdSSkwDnCZWxaXu3Kgz4qB5EmaC4D3bKTFkFldw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "node_modules/abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", + "dev": true + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-globals": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", + "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", + "dev": true, + "dependencies": { + "acorn": "^8.1.0", + "acorn-walk": "^8.0.2" + } + }, + "node_modules/acorn-import-assertions": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", + "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", + "dev": true, + "peerDependencies": { + "acorn": "^8" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/adm-zip": { + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz", + "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==", + "dev": true, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-errors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", + "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", + "dev": true, + "peerDependencies": { + "ajv": ">=5.0.0" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-html-community": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz", + "integrity": "sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==", + "dev": true, + "engines": [ + "node >= 0.8.0" + ], + "bin": { + "ansi-html": "bin/ansi-html" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/are-docs-informative": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz", + "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-flatten": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", + "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", + "dev": true + }, + "node_modules/array-includes": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", + "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.2.tgz", + "integrity": "sha512-HuQCHOlk1Weat5jzStICBCd83NxiIMwqDg/dHEsoefabn/hJRj5pVdWcPUSpRrwhwxZOsQassMpgN/xRYFBMIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ast-types-flow": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", + "integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==", + "dev": true + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/asynciterator.prototype": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz", + "integrity": "sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, + "node_modules/autoprefixer": { + "version": "10.4.15", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.15.tgz", + "integrity": "sha512-KCuPB8ZCIqFdA4HwKXsvz7j6gvSDNhDP7WnUjBleRkKjPdvCmHFuQ77ocavI8FT6NdvlBnE2UFr2H4Mycn8Vew==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "browserslist": "^4.21.10", + "caniuse-lite": "^1.0.30001520", + "fraction.js": "^4.2.0", + "normalize-range": "^0.1.2", + "picocolors": "^1.0.0", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axe-core": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.8.1.tgz", + "integrity": "sha512-9l850jDDPnKq48nbad8SiEelCv4OrUWrKab/cPj0GScVg6cb6NbCCt/Ulk26QEq5jP9NnGr04Bit1BHyV6r5CQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/axios": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.14.7" + } + }, + "node_modules/axobject-query": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", + "integrity": "sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==", + "dev": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "dependencies": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-loader": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.3.0.tgz", + "integrity": "sha512-H8SvsMF+m9t15HNLMipppzkC+Y2Yq+v3SonZyU70RBL/h1gxPkH08Ot8pEE9Z4Kd+czyWJClmFS8qzIP9OZ04Q==", + "dev": true, + "dependencies": { + "find-cache-dir": "^3.3.1", + "loader-utils": "^2.0.0", + "make-dir": "^3.1.0", + "schema-utils": "^2.6.5" + }, + "engines": { + "node": ">= 8.9" + }, + "peerDependencies": { + "@babel/core": "^7.0.0", + "webpack": ">=2" + } + }, + "node_modules/babel-loader/node_modules/schema-utils": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", + "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.5", + "ajv": "^6.12.4", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 8.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.5.tgz", + "integrity": "sha512-19hwUH5FKl49JEsvyTcoHakh6BE0wgXLLptIyKZ3PijHc/Ci521wygORCUCCred+E/twuqRyAkE02BAWPmsHOg==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.22.6", + "@babel/helper-define-polyfill-provider": "^0.4.2", + "semver": "^6.3.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.3.tgz", + "integrity": "sha512-z41XaniZL26WLrvjy7soabMXrfPWARN25PZoriDEiLMxAp50AUW3t35BGQUMg5xK3UrpVTtagIDklxYa+MhiNA==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.4.2", + "core-js-compat": "^3.31.0" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.2.tgz", + "integrity": "sha512-tAlOptU0Xj34V1Y2PNTL4Y0FOJMDB6bZmoW39FeCQIhigGLkqu3Fj6uiXpxIf6Ij274ENdYx64y6Au+ZKlb1IA==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.4.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", + "dev": true + }, + "node_modules/big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "dev": true, + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/body-parser/node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/bonjour-service": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.1.1.tgz", + "integrity": "sha512-Z/5lQRMOG9k7W+FkeGTNjh7htqn/2LMnfOvBZ8pynNZCM9MwkQkI3zeI4oz09uWdcgmgHugVvBqxGg4VQJ5PCg==", + "dev": true, + "dependencies": { + "array-flatten": "^2.1.2", + "dns-equal": "^1.0.0", + "fast-deep-equal": "^3.1.3", + "multicast-dns": "^7.2.5" + } + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.21.10", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz", + "integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001517", + "electron-to-chromium": "^1.4.477", + "node-releases": "^2.0.13", + "update-browserslist-db": "^1.0.11" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "dependencies": { + "semver": "^7.0.0" + } + }, + "node_modules/builtins/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/builtins/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/builtins/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camel-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", + "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", + "dev": true, + "dependencies": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/camelcase-keys/node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-api": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", + "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", + "dev": true, + "dependencies": { + "browserslist": "^4.0.0", + "caniuse-lite": "^1.0.0", + "lodash.memoize": "^4.1.2", + "lodash.uniq": "^4.5.0" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001534", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001534.tgz", + "integrity": "sha512-vlPVrhsCS7XaSh2VvWluIQEzVhefrUQcEsQWSS5A5V+dM07uv1qHeQzAOTGIMy9i3e9bH15+muvI/UHojVgS/Q==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/capital-case": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", + "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", + "dev": true, + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3", + "upper-case-first": "^2.0.2" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/change-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", + "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", + "dev": true, + "dependencies": { + "camel-case": "^4.1.2", + "capital-case": "^1.0.4", + "constant-case": "^3.0.4", + "dot-case": "^3.0.4", + "header-case": "^2.0.4", + "no-case": "^3.0.4", + "param-case": "^3.0.4", + "pascal-case": "^3.1.2", + "path-case": "^3.0.4", + "sentence-case": "^3.0.4", + "snake-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/check-node-version": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/check-node-version/-/check-node-version-4.2.1.tgz", + "integrity": "sha512-YYmFYHV/X7kSJhuN/QYHUu998n/TRuDe8UenM3+m5NrkiH670lb9ILqHIvBencvJc4SDh+XcbXMR4b+TtubJiw==", + "dev": true, + "dependencies": { + "chalk": "^3.0.0", + "map-values": "^1.0.1", + "minimist": "^1.2.0", + "object-filter": "^1.0.2", + "run-parallel": "^1.1.4", + "semver": "^6.3.0" + }, + "bin": { + "check-node-version": "bin.js" + }, + "engines": { + "node": ">=8.3.0" + } + }, + "node_modules/check-node-version/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "node_modules/chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "dev": true, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/ci-info": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", + "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", + "dev": true + }, + "node_modules/clean-webpack-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/clean-webpack-plugin/-/clean-webpack-plugin-3.0.0.tgz", + "integrity": "sha512-MciirUH5r+cYLGCOL5JX/ZLzOZbVr1ot3Fw+KcvbhUb6PM+yycqd9ZhIlcigQ5gl+XhppNmw3bEFuaaMNyLj3A==", + "dev": true, + "dependencies": { + "@types/webpack": "^4.4.31", + "del": "^4.1.1" + }, + "engines": { + "node": ">=8.9.0" + }, + "peerDependencies": { + "webpack": "*" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/clone-deep": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-0.2.4.tgz", + "integrity": "sha512-we+NuQo2DHhSl+DP6jlUiAhyAjBQrYnpOk15rN6c6JSPScjiCLh8IbSU+VTcph6YS3o7mASE8a0+gbZ7ChLpgg==", + "dev": true, + "dependencies": { + "for-own": "^0.1.3", + "is-plain-object": "^2.0.1", + "kind-of": "^3.0.2", + "lazy-cache": "^1.0.3", + "shallow-clone": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/clone-deep/node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/colord": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", + "dev": true + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/comment-parser": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.0.tgz", + "integrity": "sha512-QLyTNiZ2KDOibvFPlZ6ZngVsZ/0gYnE6uTXi5aoDg8ed3AkJAz4sEje3Y8a29hQ1s6A99MZXe47fLAXQ1rTqaw==", + "dev": true, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/common-path-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", + "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", + "dev": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dev": true, + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", + "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "dev": true, + "dependencies": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/compression/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/compression/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/connect-history-api-fallback": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz", + "integrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/constant-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", + "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", + "dev": true, + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3", + "upper-case": "^2.0.2" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "dev": true + }, + "node_modules/copy-webpack-plugin": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-10.2.4.tgz", + "integrity": "sha512-xFVltahqlsRcyyJqQbDY6EYTtyQZF9rf+JPjwHObLdPFMEISqkFkr7mFoVOC6BfYS/dNThyoQKvziugm+OnwBg==", + "dev": true, + "dependencies": { + "fast-glob": "^3.2.7", + "glob-parent": "^6.0.1", + "globby": "^12.0.2", + "normalize-path": "^3.0.0", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "engines": { + "node": ">= 12.20.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/copy-webpack-plugin/node_modules/array-union": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-3.0.1.tgz", + "integrity": "sha512-1OvF9IbWwaeiM9VhzYXVQacMibxpXOMYVNIvMtKRyX9SImBXpKcFr8XvFDeEslCyuH/t6KRt7HEO94AlP8Iatw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/copy-webpack-plugin/node_modules/globby": { + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-12.2.0.tgz", + "integrity": "sha512-wiSuFQLZ+urS9x2gGPl1H5drc5twabmm4m2gTR27XDFyjUHJUNsS8o/2aKyIF6IoBaR630atdher0XJ5g6OMmA==", + "dev": true, + "dependencies": { + "array-union": "^3.0.1", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.7", + "ignore": "^5.1.9", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/copy-webpack-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/copy-webpack-plugin/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/copy-webpack-plugin/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/core-js": { + "version": "3.32.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.2.tgz", + "integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ==", + "dev": true, + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-js-compat": { + "version": "3.32.2", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.2.tgz", + "integrity": "sha512-+GjlguTDINOijtVRUxrQOv3kfu9rl+qPNdX2LTbJ/ZyVTuxK+ksVSAGX1nHstu4hrv1En/uPTtWgq2gI5wt4AQ==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-js-pure": { + "version": "3.32.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.32.2.tgz", + "integrity": "sha512-Y2rxThOuNywTjnX/PgA5vWM6CZ9QB9sz9oGeCixV8MqXZO70z/5SHzf9EeBrEBK0PN36DnEBBu9O/aGWzKuMZQ==", + "dev": true, + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "node_modules/cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "dev": true, + "dependencies": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/cosmiconfig/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/cosmiconfig/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "dev": true, + "dependencies": { + "node-fetch": "2.6.7" + } + }, + "node_modules/cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==", + "dev": true, + "dependencies": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "node_modules/cross-spawn/node_modules/lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "node_modules/cross-spawn/node_modules/yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", + "dev": true + }, + "node_modules/css-declaration-sorter": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz", + "integrity": "sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==", + "dev": true, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.0.9" + } + }, + "node_modules/css-functions-list": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.2.0.tgz", + "integrity": "sha512-d/jBMPyYybkkLVypgtGv12R+pIFw4/f/IHtCTxWpZc8ofTYOPigIgmA6vu5rMHartZC+WuXhBUHfnyNUIQSYrg==", + "dev": true, + "engines": { + "node": ">=12.22" + } + }, + "node_modules/css-loader": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.8.1.tgz", + "integrity": "sha512-xDAXtEVGlD0gJ07iclwWVkLoZOpEvAWaSyf6W18S2pOC//K8+qUDIx8IIT3D+HjnmkJPQeesOPv5aiUaJsCM2g==", + "dev": true, + "dependencies": { + "icss-utils": "^5.1.0", + "postcss": "^8.4.21", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.3", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "semver": "^7.3.8" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/css-loader/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/css-loader/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/css-loader/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dev": true, + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-tree": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", + "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", + "dev": true, + "dependencies": { + "mdn-data": "2.0.30", + "source-map-js": "^1.0.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "dev": true, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cssnano": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-6.0.1.tgz", + "integrity": "sha512-fVO1JdJ0LSdIGJq68eIxOqFpIJrZqXUsBt8fkrBcztCQqAjQD51OhZp7tc0ImcbwXD4k7ny84QTV90nZhmqbkg==", + "dev": true, + "dependencies": { + "cssnano-preset-default": "^6.0.1", + "lilconfig": "^2.1.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/cssnano" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/cssnano-preset-default": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-6.0.1.tgz", + "integrity": "sha512-7VzyFZ5zEB1+l1nToKyrRkuaJIx0zi/1npjvZfbBwbtNTzhLtlvYraK/7/uqmX2Wb2aQtd983uuGw79jAjLSuQ==", + "dev": true, + "dependencies": { + "css-declaration-sorter": "^6.3.1", + "cssnano-utils": "^4.0.0", + "postcss-calc": "^9.0.0", + "postcss-colormin": "^6.0.0", + "postcss-convert-values": "^6.0.0", + "postcss-discard-comments": "^6.0.0", + "postcss-discard-duplicates": "^6.0.0", + "postcss-discard-empty": "^6.0.0", + "postcss-discard-overridden": "^6.0.0", + "postcss-merge-longhand": "^6.0.0", + "postcss-merge-rules": "^6.0.1", + "postcss-minify-font-values": "^6.0.0", + "postcss-minify-gradients": "^6.0.0", + "postcss-minify-params": "^6.0.0", + "postcss-minify-selectors": "^6.0.0", + "postcss-normalize-charset": "^6.0.0", + "postcss-normalize-display-values": "^6.0.0", + "postcss-normalize-positions": "^6.0.0", + "postcss-normalize-repeat-style": "^6.0.0", + "postcss-normalize-string": "^6.0.0", + "postcss-normalize-timing-functions": "^6.0.0", + "postcss-normalize-unicode": "^6.0.0", + "postcss-normalize-url": "^6.0.0", + "postcss-normalize-whitespace": "^6.0.0", + "postcss-ordered-values": "^6.0.0", + "postcss-reduce-initial": "^6.0.0", + "postcss-reduce-transforms": "^6.0.0", + "postcss-svgo": "^6.0.0", + "postcss-unique-selectors": "^6.0.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/cssnano-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-4.0.0.tgz", + "integrity": "sha512-Z39TLP+1E0KUcd7LGyF4qMfu8ZufI0rDzhdyAMsa/8UyNUU8wpS0fhdBxbQbv32r64ea00h4878gommRVg2BHw==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/csso": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", + "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", + "dev": true, + "dependencies": { + "css-tree": "~2.2.0" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/csso/node_modules/css-tree": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", + "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", + "dev": true, + "dependencies": { + "mdn-data": "2.0.28", + "source-map-js": "^1.0.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/csso/node_modules/mdn-data": { + "version": "2.0.28", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", + "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", + "dev": true + }, + "node_modules/cssom": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", + "dev": true + }, + "node_modules/cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + }, + "node_modules/csstype": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==", + "dev": true + }, + "node_modules/cwd": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/cwd/-/cwd-0.10.0.tgz", + "integrity": "sha512-YGZxdTTL9lmLkCUTpg4j0zQ7IhRB5ZmqNBbGCl3Tg6MP/d5/6sY7L5mmTjzbc6JKgVZYiqTQTNhPFsbXNGlRaA==", + "dev": true, + "dependencies": { + "find-pkg": "^0.1.2", + "fs-exists-sync": "^0.1.0" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/damerau-levenshtein": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", + "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==", + "dev": true + }, + "node_modules/data-urls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", + "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "dev": true, + "dependencies": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decamelize-keys/node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "dev": true + }, + "node_modules/dedent": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true, + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-gateway": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz", + "integrity": "sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==", + "dev": true, + "dependencies": { + "execa": "^5.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/define-data-property": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.0.tgz", + "integrity": "sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/del": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz", + "integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==", + "dev": true, + "dependencies": { + "@types/glob": "^7.1.1", + "globby": "^6.1.0", + "is-path-cwd": "^2.0.0", + "is-path-in-cwd": "^2.0.0", + "p-map": "^2.0.0", + "pify": "^4.0.1", + "rimraf": "^2.6.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/del/node_modules/array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==", + "dev": true, + "dependencies": { + "array-uniq": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/del/node_modules/globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw==", + "dev": true, + "dependencies": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/del/node_modules/globby/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true + }, + "node_modules/devtools-protocol": { + "version": "0.0.981744", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.981744.tgz", + "integrity": "sha512-0cuGS8+jhR67Fy7qG3i3Pc7Aw494sb9yG9QgpG97SFVWwolgYjlhJg7n+UaHxOQT30d1TYu/EYe9k01ivLErIg==", + "dev": true + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dns-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", + "integrity": "sha512-z+paD6YUQsk+AbGCEM4PrOXSss5gd66QfcVBFTKR/HpFL9jCqikS94HYwKww6fQyO7IxrIIyUu+g0Ka9tUS2Cg==", + "dev": true + }, + "node_modules/dns-packet": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz", + "integrity": "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==", + "dev": true, + "dependencies": { + "@leichtgewicht/ip-codec": "^2.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dev": true, + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "dev": true, + "dependencies": { + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dev": true, + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "dev": true, + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dev": true, + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "dev": true + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "dev": true + }, + "node_modules/electron-to-chromium": { + "version": "1.4.520", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.520.tgz", + "integrity": "sha512-Frfus2VpYADsrh1lB3v/ft/WVFlVzOIm+Q0p7U7VqHI6qr7NWHYKe+Wif3W50n7JAFoBsWVsoU0+qDks6WQ60g==", + "dev": true + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/envinfo": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz", + "integrity": "sha512-ZtUjZO6l5mwTHvc1L9+1q5p/R3wTopcfqMW8r5t8SJSKqeVI/LtajORwRFEKpEFuekjD0VBjwu1HMxL4UalIRw==", + "dev": true, + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/error-stack-parser": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz", + "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==", + "dev": true, + "dependencies": { + "stackframe": "^1.3.4" + } + }, + "node_modules/es-abstract": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.1.tgz", + "integrity": "sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.1", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.2.1", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.0", + "safe-array-concat": "^1.0.0", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.7", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-iterator-helpers": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz", + "integrity": "sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g==", + "dev": true, + "dependencies": { + "asynciterator.prototype": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.1", + "es-set-tostringtag": "^2.0.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.2.1", + "globalthis": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "iterator.prototype": "^1.1.2", + "safe-array-concat": "^1.0.1" + } + }, + "node_modules/es-module-lexer": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.1.tgz", + "integrity": "sha512-JUFAyicQV9mXc3YRxPnDlrfBKpqt6hUYzz9/boprUJHs4e4KVr3XwOF70doO6gwXUor6EWZJAyWAfKki84t20Q==", + "dev": true + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/escodegen/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz", + "integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.49.0", + "@humanwhocodes/config-array": "^0.11.11", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-prettier": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", + "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz", + "integrity": "sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.findlastindex": "^1.2.2", + "array.prototype.flat": "^1.3.1", + "array.prototype.flatmap": "^1.3.1", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.7", + "eslint-module-utils": "^2.8.0", + "has": "^1.0.3", + "is-core-module": "^2.13.0", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.6", + "object.groupby": "^1.0.0", + "object.values": "^1.1.6", + "semver": "^6.3.1", + "tsconfig-paths": "^3.14.2" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-jest": { + "version": "27.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.2.3.tgz", + "integrity": "sha512-sRLlSCpICzWuje66Gl9zvdF6mwD5X86I4u55hJyFBsxYOsBCmT5+kSUjf+fkFWVMMgpzNEupjW8WzUqi83hJAQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "^5.10.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0", + "eslint": "^7.0.0 || ^8.0.0", + "jest": "*" + }, + "peerDependenciesMeta": { + "@typescript-eslint/eslint-plugin": { + "optional": true + }, + "jest": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-jsdoc": { + "version": "46.7.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.7.0.tgz", + "integrity": "sha512-VuNF+5WaiqocDDA6zvm+/D6DYo+DPFuSBOb8oSWbu0CVh+aaL3TAtpB0L0XdYYib1HHudMCHd2QeA25Tn1Pkfw==", + "dev": true, + "dependencies": { + "@es-joy/jsdoccomment": "~0.40.1", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.0", + "debug": "^4.3.4", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.5.0", + "is-builtin-module": "^3.2.1", + "semver": "^7.5.4", + "spdx-expression-parse": "^3.0.1" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/eslint-plugin-jsx-a11y": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz", + "integrity": "sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.20.7", + "aria-query": "^5.1.3", + "array-includes": "^3.1.6", + "array.prototype.flatmap": "^1.3.1", + "ast-types-flow": "^0.0.7", + "axe-core": "^4.6.2", + "axobject-query": "^3.1.1", + "damerau-levenshtein": "^1.0.8", + "emoji-regex": "^9.2.2", + "has": "^1.0.3", + "jsx-ast-utils": "^3.3.3", + "language-tags": "=1.0.5", + "minimatch": "^3.1.2", + "object.entries": "^1.1.6", + "object.fromentries": "^2.0.6", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=4.0" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz", + "integrity": "sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0" + }, + "engines": { + "node": ">=6.0.0" + }, + "peerDependencies": { + "eslint": ">=5.0.0", + "prettier": ">=1.13.0" + }, + "peerDependenciesMeta": { + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.33.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz", + "integrity": "sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flatmap": "^1.3.1", + "array.prototype.tosorted": "^1.1.1", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.0.12", + "estraverse": "^5.3.0", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.6", + "object.fromentries": "^2.0.6", + "object.hasown": "^1.1.2", + "object.values": "^1.1.6", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.4", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.8" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", + "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", + "dev": true, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" + } + }, + "node_modules/eslint-plugin-react/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-react/node_modules/resolve": { + "version": "2.0.0-next.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", + "dev": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-scope/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/eslint/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.21.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", + "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/execa/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/execa/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/execa/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expand-tilde": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-1.2.2.tgz", + "integrity": "sha512-rtmc+cjLZqnu9dSYosX9EWmSJhTwpACgJQTfj4hgg2JjOD/6SIQalZrt4a3aQeh++oNxkazcaxrhPUj6+g5G/Q==", + "dev": true, + "dependencies": { + "os-homedir": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/expect-puppeteer": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/expect-puppeteer/-/expect-puppeteer-4.4.0.tgz", + "integrity": "sha512-6Ey4Xy2xvmuQu7z7YQtMsaMV0EHJRpVxIDOd5GRrm04/I3nkTKIutELfECsLp6le+b3SSa3cXhPiw6PgqzxYWA==", + "dev": true + }, + "node_modules/express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "dev": true, + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/express/node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "dev": true + }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/faye-websocket": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", + "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", + "dev": true, + "dependencies": { + "websocket-driver": ">=0.5.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/filenamify": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", + "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", + "dev": true, + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dev": true, + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-file-up": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/find-file-up/-/find-file-up-0.1.3.tgz", + "integrity": "sha512-mBxmNbVyjg1LQIIpgO8hN+ybWBgDQK8qjht+EbrTCGmmPV/sc7RF1i9stPTD6bpvXZywBdrwRYxhSdJv867L6A==", + "dev": true, + "dependencies": { + "fs-exists-sync": "^0.1.0", + "resolve-dir": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/find-parent-dir": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/find-parent-dir/-/find-parent-dir-0.3.1.tgz", + "integrity": "sha512-o4UcykWV/XN9wm+jMEtWLPlV8RXCZnMhQI6F6OdHeSez7iiJWePw8ijOlskJZMsaQoGR/b7dH6lO02HhaTN7+A==", + "dev": true + }, + "node_modules/find-pkg": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/find-pkg/-/find-pkg-0.1.2.tgz", + "integrity": "sha512-0rnQWcFwZr7eO0513HahrWafsc3CTFioEB7DRiEYCUM/70QXSY8f3mCST17HXLcPvEhzH/Ty/Bxd72ZZsr/yvw==", + "dev": true, + "dependencies": { + "find-file-up": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/find-process": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/find-process/-/find-process-1.4.7.tgz", + "integrity": "sha512-/U4CYp1214Xrp3u3Fqr9yNynUrr5Le4y0SsJh2lMDDSbpwYSz3M2SMWQC+wqcx79cN8PQtHQIL8KnuY9M66fdg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "commander": "^5.1.0", + "debug": "^4.1.1" + }, + "bin": { + "find-process": "bin/find-process.js" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz", + "integrity": "sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew==", + "dev": true, + "dependencies": { + "flatted": "^3.2.7", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha512-SKmowqGTJoPzLO1T0BBJpkfp3EMacCMOuH40hOUbrbzElVktk4DioXVM99QkLCyKoiuOmyjgcWMpVz2xjE7LZw==", + "dev": true, + "dependencies": { + "for-in": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fraction.js": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz", + "integrity": "sha512-n2aZ9tNfYDwaHhvFTkhFErqOMIb8uyzSQ+vGJBjZyanAKZVbGUQ1sngfk9FdkBw7G26O7AgNjLcecLffD1c7eg==", + "dev": true, + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, + "node_modules/fs-exists-sync": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz", + "integrity": "sha512-cR/vflFyPZtrN6b38ZyWxpWdhlXrzZEBawlpBQMq7033xVY7/kg0GDMBK5jg8lDYQckdJ5x/YC88lM3C7VMsLg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fs-monkey": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/fs-monkey/-/fs-monkey-1.0.4.tgz", + "integrity": "sha512-INM/fWAxMICjttnD0DX1rBvinKskj5G1w+oy/pnm9u/tSlnBrzFonJMcalKJ30P8RRsPzKcCG7Q8l0jx5Fh9YQ==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stdin": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-9.0.0.tgz", + "integrity": "sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "node_modules/global-modules": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-0.2.3.tgz", + "integrity": "sha512-JeXuCbvYzYXcwE6acL9V2bAOeSIGl4dD+iwLY9iUx2VBJJ80R18HCn+JCwHM9Oegdfya3lEkGCdaRkSyc10hDA==", + "dev": true, + "dependencies": { + "global-prefix": "^0.1.4", + "is-windows": "^0.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-0.1.5.tgz", + "integrity": "sha512-gOPiyxcD9dJGCEArAhF4Hd0BAqvAe/JzERP7tYumE4yIkmIedPUVXcJFWbV3/p/ovIIvKjkrTk+f1UVkq7vvbw==", + "dev": true, + "dependencies": { + "homedir-polyfill": "^1.0.0", + "ini": "^1.3.4", + "is-windows": "^0.2.0", + "which": "^1.2.12" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globjoin": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/globjoin/-/globjoin-0.1.4.tgz", + "integrity": "sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==", + "dev": true + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/gzip-size": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz", + "integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==", + "dev": true, + "dependencies": { + "duplexer": "^0.1.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/handle-thing": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", + "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", + "dev": true + }, + "node_modules/hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/header-case": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", + "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", + "dev": true, + "dependencies": { + "capital-case": "^1.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "dev": true, + "dependencies": { + "parse-passwd": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/hosted-git-info/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/hosted-git-info/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==", + "dev": true, + "dependencies": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "node_modules/hpack.js/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "node_modules/hpack.js/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/hpack.js/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/hpack.js/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/html-entities": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.4.0.tgz", + "integrity": "sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mdevils" + }, + { + "type": "patreon", + "url": "https://patreon.com/mdevils" + } + ] + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/html-tags": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.3.1.tgz", + "integrity": "sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==", + "dev": true + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-parser-js": { + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz", + "integrity": "sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==", + "dev": true + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-proxy-middleware": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", + "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "dev": true, + "dependencies": { + "@types/http-proxy": "^1.17.8", + "http-proxy": "^1.18.1", + "is-glob": "^4.0.1", + "is-plain-obj": "^3.0.0", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "@types/express": "^4.17.13" + }, + "peerDependenciesMeta": { + "@types/express": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/icss-utils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "dev": true, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/ignore-walk": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-4.0.1.tgz", + "integrity": "sha512-rzDQLaW4jQbh2YrOFlJdCtX8qgJTehFRYiUB2r1osqTeDzV/3+Jh8fz1oAPzUThf3iku8Ds4IDqawI5d8mUiQw==", + "dev": true, + "dependencies": { + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/immutable": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.4.tgz", + "integrity": "sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==", + "dev": true + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/import-lazy": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", + "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/internal-slot": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ipaddr.js": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz", + "integrity": "sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/irregular-plurals": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.5.0.tgz", + "integrity": "sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-async-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", + "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "node_modules/is-builtin-module": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", + "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.3.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz", + "integrity": "sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-path-cwd": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", + "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-path-in-cwd": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz", + "integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==", + "dev": true, + "dependencies": { + "is-path-inside": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-path-in-cwd/node_modules/is-path-inside": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz", + "integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==", + "dev": true, + "dependencies": { + "path-is-inside": "^1.0.2" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", + "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.11" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha512-n67eJYmXbniZB7RF4I/FTjK1s6RPOCTxhYrVYLRaCt3lF0mpWZPKr3T2LSZAqyjQsxR2qMmGYXXzK0YWwcPM1Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-report/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/iterator.prototype": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.2.tgz", + "integrity": "sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "reflect.getprototypeof": "^1.0.4", + "set-function-name": "^2.0.1" + } + }, + "node_modules/jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-dev-server": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jest-dev-server/-/jest-dev-server-6.2.0.tgz", + "integrity": "sha512-ZWh8CuvxwjhYfvw4tGeftziqIvw/26R6AG3OTgNTQeXul8aZz48RQjDpnlDwnWX53jxJJl9fcigqIdSU5lYZuw==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "cwd": "^0.10.0", + "find-process": "^1.4.7", + "prompts": "^2.4.2", + "spawnd": "^6.2.0", + "tree-kill": "^1.2.2", + "wait-on": "^6.0.1" + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz", + "integrity": "sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/jsdom": "^20.0.0", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0", + "jsdom": "^20.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/joi": { + "version": "17.10.1", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.10.1.tgz", + "integrity": "sha512-vIiDxQKmRidUVp8KngT8MZSOcmRVm2zV7jbMjNYWuHcJWI0bUck3nRTGQjhpPlQenIQIBC5Vp9AhcnHbWQqafw==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsdoc-type-pratt-parser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", + "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json2php": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/json2php/-/json2php-0.0.7.tgz", + "integrity": "sha512-dnSoUiLAoVaMXxFsVi4CrPVYMKOuDBXTghXSmMINX44RZ8WM9cXlY7UqrQnlAcODCVO7FV3+8t/5nDKAjimLfg==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/keyv": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", + "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", + "dev": true, + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/klona": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz", + "integrity": "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/known-css-properties": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz", + "integrity": "sha512-5FZRzrZzNTBruuurWpvZnvP9pum+fe0HcK8z/ooo+U+Hmp4vtbyp1/QDsqmufirXy4egGzbaH/y2uCZf+6W5Kg==", + "dev": true + }, + "node_modules/language-subtag-registry": { + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", + "integrity": "sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==", + "dev": true + }, + "node_modules/language-tags": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/language-tags/-/language-tags-1.0.5.tgz", + "integrity": "sha512-qJhlO9cGXi6hBGKoxEG/sKZDAHD5Hnu9Hs4WbOY3pCWXDhw0N8x1NenNzm2EnNLkLkk7J2SdxAkDSbb6ftT+UQ==", + "dev": true, + "dependencies": { + "language-subtag-registry": "~0.3.2" + } + }, + "node_modules/launch-editor": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.6.0.tgz", + "integrity": "sha512-JpDCcQnyAAzZZaZ7vEiSqL690w7dAEyLao+KC96zBplnYbJS7TYNjvM3M7y3dGz+v7aIsJk3hllWuc0kWAjyRQ==", + "dev": true, + "dependencies": { + "picocolors": "^1.0.0", + "shell-quote": "^1.7.3" + } + }, + "node_modules/lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha512-RE2g0b5VGZsOCFOCgP7omTRYFqydmZkBwl5oNnQ1lDYC57uyO9KqNnNVxT7COSHTxrRCWVcAVOcbjk+tvh/rgQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/linkify-it": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "dev": true, + "dependencies": { + "uc.micro": "^1.0.1" + } + }, + "node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true, + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/loader-utils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", + "dev": true, + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + }, + "engines": { + "node": ">=8.9.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "dev": true + }, + "node_modules/lodash.escape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-4.0.1.tgz", + "integrity": "sha512-nXEOnb/jK9g0DYMr1/Xvq6l5xMD7GDG55+GSYIYmS0G4tBk/hURD4JR9WCavs04t33WmJx9kCyp9vJ+mr4BOUw==", + "dev": true + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "dev": true + }, + "node_modules/lodash.invokemap": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.invokemap/-/lodash.invokemap-4.6.0.tgz", + "integrity": "sha512-CfkycNtMqgUlfjfdh2BhKO/ZXrP8ePOX5lEU/g0R3ItJcnuxWDwokMGKx1hWcfOikmyOVx6X9IwWnDGlgKl61w==", + "dev": true + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lodash.pullall": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.pullall/-/lodash.pullall-4.2.0.tgz", + "integrity": "sha512-VhqxBKH0ZxPpLhiu68YD1KnHmbhQJQctcipvmFnqIBDYzcIHzf3Zpu0tpeOKtR4x76p9yohc506eGdOjTmyIBg==", + "dev": true + }, + "node_modules/lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", + "dev": true + }, + "node_modules/lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "dev": true + }, + "node_modules/lodash.uniqby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", + "integrity": "sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==", + "dev": true + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dev": true, + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/map-values": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-values/-/map-values-1.0.1.tgz", + "integrity": "sha512-BbShUnr5OartXJe1GeccAWtfro11hhgNJg6G9/UtWKjVGvV5U4C09cg5nk8JUevhXODaXY+hQ3xxMUKSs62ONQ==", + "dev": true + }, + "node_modules/markdown-it": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", + "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1", + "entities": "~2.1.0", + "linkify-it": "^3.0.1", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + }, + "bin": { + "markdown-it": "bin/markdown-it.js" + } + }, + "node_modules/markdown-it/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/markdown-it/node_modules/entities": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", + "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "dev": true, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/markdownlint": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.25.1.tgz", + "integrity": "sha512-AG7UkLzNa1fxiOv5B+owPsPhtM4D6DoODhsJgiaNg1xowXovrYgOnLqAgOOFQpWOlHFVQUzjMY5ypNNTeov92g==", + "dev": true, + "dependencies": { + "markdown-it": "12.3.2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/markdownlint-cli": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.31.1.tgz", + "integrity": "sha512-keIOMwQn+Ch7MoBwA+TdkyVMuxAeZFEGmIIlvwgV0Z1TGS5MxPnRr29XCLhkNzCHU+uNKGjU+VEjLX+Z9kli6g==", + "dev": true, + "dependencies": { + "commander": "~9.0.0", + "get-stdin": "~9.0.0", + "glob": "~7.2.0", + "ignore": "~5.2.0", + "js-yaml": "^4.1.0", + "jsonc-parser": "~3.0.0", + "markdownlint": "~0.25.1", + "markdownlint-rule-helpers": "~0.16.0", + "minimatch": "~3.0.5", + "run-con": "~1.2.10" + }, + "bin": { + "markdownlint": "markdownlint.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/markdownlint-cli/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/markdownlint-cli/node_modules/commander": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.0.0.tgz", + "integrity": "sha512-JJfP2saEKbQqvW+FI93OYUB4ByV5cizMpFMiiJI8xDbBvQvSkIk0VvQdn1CZ8mqAO8Loq2h0gYTYtDFUZUeERw==", + "dev": true, + "engines": { + "node": "^12.20.0 || >=14" + } + }, + "node_modules/markdownlint-cli/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/markdownlint-cli/node_modules/minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/markdownlint-rule-helpers": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.16.0.tgz", + "integrity": "sha512-oEacRUVeTJ5D5hW1UYd2qExYI0oELdYK72k1TKGvIeYJIbqQWAz476NAc7LNixSySUhcNl++d02DvX0ccDk9/w==", + "dev": true + }, + "node_modules/mathml-tag-names": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", + "integrity": "sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdn-data": { + "version": "2.0.30", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", + "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", + "dev": true + }, + "node_modules/mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", + "dev": true + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/memfs": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.5.3.tgz", + "integrity": "sha512-UERzLsxzllchadvbPs5aolHh65ISpKpM+ccLbOJ8/vvpBKmAWf+la7dXFy7Mr0ySHbdHrFv5kGFCUHHe6GFEmw==", + "dev": true, + "dependencies": { + "fs-monkey": "^1.0.4" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/meow": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", + "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", + "dev": true, + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize": "^1.2.0", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow/node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-deep": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.3.tgz", + "integrity": "sha512-qtmzAS6t6grwEkNrunqTBdn0qKwFgNWvlxUbAV8es9M7Ot1EbyApytCnvE0jALPa46ZpKDUo527kKiaWplmlFA==", + "dev": true, + "dependencies": { + "arr-union": "^3.1.0", + "clone-deep": "^0.2.4", + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", + "dev": true + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mini-css-extract-plugin": { + "version": "2.7.6", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.7.6.tgz", + "integrity": "sha512-Qk7HcgaPkGG6eD77mLvZS1nmxlao3j+9PkrT9Uc7HAE1id3F41+DdBRYRYkbyfNRGzm8/YWtzhw7nVPmwhqTQw==", + "dev": true, + "dependencies": { + "schema-utils": "^4.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "dev": true, + "dependencies": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/minimist-options/node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/minimist-options/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mixin-object": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", + "integrity": "sha512-ALGF1Jt9ouehcaXaHhn6t1yGWRqGaHkPFndtFVHfZXOvkIZ/yoGaSi0AHVTafb3ZBGg4dr/bDwnaEKqCXzchMA==", + "dev": true, + "dependencies": { + "for-in": "^0.1.3", + "is-extendable": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mixin-object/node_modules/for-in": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.8.tgz", + "integrity": "sha512-F0to7vbBSHP8E3l6dCjxNOLuSFAACIxFy3UehTUlG7svlXi37HHsDkyVcHo0Pq8QwrE+pXvWSVX3ZT1T9wAZ9g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true + }, + "node_modules/mrmime": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz", + "integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/multicast-dns": { + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz", + "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", + "dev": true, + "dependencies": { + "dns-packet": "^5.2.2", + "thunky": "^1.0.2" + }, + "bin": { + "multicast-dns": "cli.js" + } + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "node_modules/no-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "dev": true, + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "dev": true, + "engines": { + "node": ">= 6.13.0" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "dev": true + }, + "node_modules/normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/normalize-package-data/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/normalize-package-data/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-bundled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", + "integrity": "sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ==", + "dev": true, + "dependencies": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "node_modules/npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", + "dev": true + }, + "node_modules/npm-package-json-lint": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/npm-package-json-lint/-/npm-package-json-lint-6.4.0.tgz", + "integrity": "sha512-cuXAJJB1Rdqz0UO6w524matlBqDBjcNt7Ru+RDIu4y6RI1gVqiWBnylrK8sPRk81gGBA0X8hJbDXolVOoTc+sA==", + "dev": true, + "dependencies": { + "ajv": "^6.12.6", + "ajv-errors": "^1.0.1", + "chalk": "^4.1.2", + "cosmiconfig": "^8.0.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "ignore": "^5.2.0", + "is-plain-obj": "^3.0.0", + "jsonc-parser": "^3.2.0", + "log-symbols": "^4.1.0", + "meow": "^9.0.0", + "plur": "^4.0.0", + "semver": "^7.3.8", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1", + "type-fest": "^3.2.0", + "validate-npm-package-name": "^5.0.0" + }, + "bin": { + "npmPkgJsonLint": "dist/cli.js" + }, + "engines": { + "node": ">=14.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/npm-package-json-lint/node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, + "node_modules/npm-package-json-lint/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-package-json-lint/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-package-json-lint/node_modules/type-fest": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", + "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-package-json-lint/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/npm-packlist": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-3.0.0.tgz", + "integrity": "sha512-L/cbzmutAwII5glUcf2DBRNY/d0TFd4e/FnaZigJV6JD85RHZXJFGwCndjMWiiViiWSsWt3tiOLpI3ByTnIdFQ==", + "dev": true, + "dependencies": { + "glob": "^7.1.6", + "ignore-walk": "^4.0.1", + "npm-bundled": "^1.1.1", + "npm-normalize-package-bin": "^1.0.1" + }, + "bin": { + "npm-packlist": "bin/index.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/nwsapi": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", + "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", + "dev": true + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-filter": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/object-filter/-/object-filter-1.0.2.tgz", + "integrity": "sha512-NahvP2vZcy1ZiiYah30CEPw0FpDcSkSePJBMpzl5EQgCmISijiGuJm3SPYp7U+Lf2TljyaIw3E5EgkEx/TNEVA==", + "dev": true + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz", + "integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", + "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, + "node_modules/object.hasown": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", + "integrity": "sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", + "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dev": true, + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/open": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", + "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", + "dev": true, + "dependencies": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "dev": true, + "bin": { + "opener": "bin/opener-bin.js" + } + }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/p-retry": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", + "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", + "dev": true, + "dependencies": { + "@types/retry": "0.12.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/param-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", + "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", + "dev": true, + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/pascal-case": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", + "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", + "dev": true, + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/path-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", + "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", + "dev": true, + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==", + "dev": true + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "dev": true, + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/plur": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz", + "integrity": "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==", + "dev": true, + "dependencies": { + "irregular-plurals": "^3.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/postcss": { + "version": "8.4.29", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.29.tgz", + "integrity": "sha512-cbI+jaqIeu/VGqXEarWkRCCffhjgXc0qjBtXpqJhTBohMUjUQnbBr0xqX3vEKudc4iviTewcJo5ajcec5+wdJw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-calc": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-9.0.1.tgz", + "integrity": "sha512-TipgjGyzP5QzEhsOZUaIkeO5mKeMFpebWzRogWG/ysonUlnHcq5aJe0jOjpfzUU8PeSaBQnrE8ehR0QA5vs8PQ==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.11", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.2" + } + }, + "node_modules/postcss-colormin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-6.0.0.tgz", + "integrity": "sha512-EuO+bAUmutWoZYgHn2T1dG1pPqHU6L4TjzPlu4t1wZGXQ/fxV16xg2EJmYi0z+6r+MGV1yvpx1BHkUaRrPa2bw==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "caniuse-api": "^3.0.0", + "colord": "^2.9.1", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-convert-values": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-6.0.0.tgz", + "integrity": "sha512-U5D8QhVwqT++ecmy8rnTb+RL9n/B806UVaS3m60lqle4YDFcpbS3ae5bTQIh3wOGUSDHSEtMYLs/38dNG7EYFw==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-comments": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-6.0.0.tgz", + "integrity": "sha512-p2skSGqzPMZkEQvJsgnkBhCn8gI7NzRH2683EEjrIkoMiwRELx68yoUJ3q3DGSGuQ8Ug9Gsn+OuDr46yfO+eFw==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-duplicates": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-6.0.0.tgz", + "integrity": "sha512-bU1SXIizMLtDW4oSsi5C/xHKbhLlhek/0/yCnoMQany9k3nPBq+Ctsv/9oMmyqbR96HYHxZcHyK2HR5P/mqoGA==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-empty": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-6.0.0.tgz", + "integrity": "sha512-b+h1S1VT6dNhpcg+LpyiUrdnEZfICF0my7HAKgJixJLW7BnNmpRH34+uw/etf5AhOlIhIAuXApSzzDzMI9K/gQ==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-overridden": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-6.0.0.tgz", + "integrity": "sha512-4VELwssYXDFigPYAZ8vL4yX4mUepF/oCBeeIT4OXsJPYOtvJumyz9WflmJWTfDwCUcpDR+z0zvCWBXgTx35SVw==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-loader": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-6.2.1.tgz", + "integrity": "sha512-WbbYpmAaKcux/P66bZ40bpWsBucjx/TTgVVzRZ9yUO8yQfVBlameJ0ZGVaPfH64hNSBh63a+ICP5nqOpBA0w+Q==", + "dev": true, + "dependencies": { + "cosmiconfig": "^7.0.0", + "klona": "^2.0.5", + "semver": "^7.3.5" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "postcss": "^7.0.0 || ^8.0.1", + "webpack": "^5.0.0" + } + }, + "node_modules/postcss-loader/node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/postcss-loader/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/postcss-loader/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/postcss-loader/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/postcss-media-query-parser": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz", + "integrity": "sha512-3sOlxmbKcSHMjlUXQZKQ06jOswE7oVkXPxmZdoB1r5l0q6gTFTQSHxNxOrCccElbW7dxNytifNEo8qidX2Vsig==", + "dev": true + }, + "node_modules/postcss-merge-longhand": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-6.0.0.tgz", + "integrity": "sha512-4VSfd1lvGkLTLYcxFuISDtWUfFS4zXe0FpF149AyziftPFQIWxjvFSKhA4MIxMe4XM3yTDgQMbSNgzIVxChbIg==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0", + "stylehacks": "^6.0.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-merge-rules": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-6.0.1.tgz", + "integrity": "sha512-a4tlmJIQo9SCjcfiCcCMg/ZCEe0XTkl/xK0XHBs955GWg9xDX3NwP9pwZ78QUOWB8/0XCjZeJn98Dae0zg6AAw==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "caniuse-api": "^3.0.0", + "cssnano-utils": "^4.0.0", + "postcss-selector-parser": "^6.0.5" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-font-values": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-6.0.0.tgz", + "integrity": "sha512-zNRAVtyh5E8ndZEYXA4WS8ZYsAp798HiIQ1V2UF/C/munLp2r1UGHwf1+6JFu7hdEhJFN+W1WJQKBrtjhFgEnA==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-gradients": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-6.0.0.tgz", + "integrity": "sha512-wO0F6YfVAR+K1xVxF53ueZJza3L+R3E6cp0VwuXJQejnNUH0DjcAFe3JEBeTY1dLwGa0NlDWueCA1VlEfiKgAA==", + "dev": true, + "dependencies": { + "colord": "^2.9.1", + "cssnano-utils": "^4.0.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-params": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-6.0.0.tgz", + "integrity": "sha512-Fz/wMQDveiS0n5JPcvsMeyNXOIMrwF88n7196puSuQSWSa+/Ofc1gDOSY2xi8+A4PqB5dlYCKk/WfqKqsI+ReQ==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "cssnano-utils": "^4.0.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-selectors": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-6.0.0.tgz", + "integrity": "sha512-ec/q9JNCOC2CRDNnypipGfOhbYPuUkewGwLnbv6omue/PSASbHSU7s6uSQ0tcFRVv731oMIx8k0SP4ZX6be/0g==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.5" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-modules-extract-imports": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", + "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", + "dev": true, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-local-by-default": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.3.tgz", + "integrity": "sha512-2/u2zraspoACtrbFRnTijMiQtb4GW4BvatjaG/bCjYQo8kLTdevCUlwuBHx2sCnSyrI3x3qj4ZK1j5LQBgzmwA==", + "dev": true, + "dependencies": { + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.1.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-scope": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", + "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.4" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", + "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "dev": true, + "dependencies": { + "icss-utils": "^5.0.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-normalize-charset": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-6.0.0.tgz", + "integrity": "sha512-cqundwChbu8yO/gSWkuFDmKrCZ2vJzDAocheT2JTd0sFNA4HMGoKMfbk2B+J0OmO0t5GUkiAkSM5yF2rSLUjgQ==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-display-values": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-6.0.0.tgz", + "integrity": "sha512-Qyt5kMrvy7dJRO3OjF7zkotGfuYALETZE+4lk66sziWSPzlBEt7FrUshV6VLECkI4EN8Z863O6Nci4NXQGNzYw==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-positions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-6.0.0.tgz", + "integrity": "sha512-mPCzhSV8+30FZyWhxi6UoVRYd3ZBJgTRly4hOkaSifo0H+pjDYcii/aVT4YE6QpOil15a5uiv6ftnY3rm0igPg==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-repeat-style": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-6.0.0.tgz", + "integrity": "sha512-50W5JWEBiOOAez2AKBh4kRFm2uhrT3O1Uwdxz7k24aKtbD83vqmcVG7zoIwo6xI2FZ/HDlbrCopXhLeTpQib1A==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-string": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-6.0.0.tgz", + "integrity": "sha512-KWkIB7TrPOiqb8ZZz6homet2KWKJwIlysF5ICPZrXAylGe2hzX/HSf4NTX2rRPJMAtlRsj/yfkrWGavFuB+c0w==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-timing-functions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-6.0.0.tgz", + "integrity": "sha512-tpIXWciXBp5CiFs8sem90IWlw76FV4oi6QEWfQwyeREVwUy39VSeSqjAT7X0Qw650yAimYW5gkl2Gd871N5SQg==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-unicode": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-6.0.0.tgz", + "integrity": "sha512-ui5crYkb5ubEUDugDc786L/Me+DXp2dLg3fVJbqyAl0VPkAeALyAijF2zOsnZyaS1HyfPuMH0DwyY18VMFVNkg==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-url": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-6.0.0.tgz", + "integrity": "sha512-98mvh2QzIPbb02YDIrYvAg4OUzGH7s1ZgHlD3fIdTHLgPLRpv1ZTKJDnSAKr4Rt21ZQFzwhGMXxpXlfrUBKFHw==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-whitespace": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-6.0.0.tgz", + "integrity": "sha512-7cfE1AyLiK0+ZBG6FmLziJzqQCpTQY+8XjMhMAz8WSBSCsCNNUKujgIgjCAmDT3cJ+3zjTXFkoD15ZPsckArVw==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-ordered-values": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-6.0.0.tgz", + "integrity": "sha512-K36XzUDpvfG/nWkjs6d1hRBydeIxGpKS2+n+ywlKPzx1nMYDYpoGbcjhj5AwVYJK1qV2/SDoDEnHzlPD6s3nMg==", + "dev": true, + "dependencies": { + "cssnano-utils": "^4.0.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-reduce-initial": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-6.0.0.tgz", + "integrity": "sha512-s2UOnidpVuXu6JiiI5U+fV2jamAw5YNA9Fdi/GRK0zLDLCfXmSGqQtzpUPtfN66RtCbb9fFHoyZdQaxOB3WxVA==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "caniuse-api": "^3.0.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-reduce-transforms": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-6.0.0.tgz", + "integrity": "sha512-FQ9f6xM1homnuy1wLe9lP1wujzxnwt1EwiigtWwuyf8FsqqXUDUp2Ulxf9A5yjlUOTdCJO6lonYjg1mgqIIi2w==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-resolve-nested-selector": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.1.tgz", + "integrity": "sha512-HvExULSwLqHLgUy1rl3ANIqCsvMS0WHss2UOsXhXnQaZ9VCc2oBvIpXrl00IUFT5ZDITME0o6oiXeiHr2SAIfw==", + "dev": true + }, + "node_modules/postcss-safe-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz", + "integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==", + "dev": true, + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.3.3" + } + }, + "node_modules/postcss-scss": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.8.tgz", + "integrity": "sha512-Cr0X8Eu7xMhE96PJck6ses/uVVXDtE5ghUTKNUYgm8ozgP2TkgV3LWs3WgLV1xaSSLq8ZFiXaUrj0LVgG1fGEA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss-scss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "engines": { + "node": ">=12.0" + }, + "peerDependencies": { + "postcss": "^8.4.29" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.13", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz", + "integrity": "sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-svgo": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-6.0.0.tgz", + "integrity": "sha512-r9zvj/wGAoAIodn84dR/kFqwhINp5YsJkLoujybWG59grR/IHx+uQ2Zo+IcOwM0jskfYX3R0mo+1Kip1VSNcvw==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0", + "svgo": "^3.0.2" + }, + "engines": { + "node": "^14 || ^16 || >= 18" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-unique-selectors": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-6.0.0.tgz", + "integrity": "sha512-EPQzpZNxOxP7777t73RQpZE5e9TrnCrkvp7AH7a0l89JmZiPnS82y216JowHXwpBCQitfyxrof9TK3rYbi7/Yw==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.5" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "name": "wp-prettier", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.8.5.tgz", + "integrity": "sha512-gkphzYtVksWV6D7/V530bTehKkhrABUru/Gy4reOLOHJoKH4i9lcE1SxqU2VDxC3gCOx/Nk9alZmWk6xL/IBCw==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-addr/node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, + "node_modules/pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", + "dev": true + }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", + "dev": true + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/puppeteer-core": { + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-13.7.0.tgz", + "integrity": "sha512-rXja4vcnAzFAP1OVLq/5dWNfwBGuzcOARJ6qGV7oAZhnLmVRU8G5MsdeQEAOy332ZhkIOnn9jp15R89LKHyp2Q==", + "dev": true, + "dependencies": { + "cross-fetch": "3.1.5", + "debug": "4.3.4", + "devtools-protocol": "0.0.981744", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.1", + "pkg-dir": "4.2.0", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.5.0" + }, + "engines": { + "node": ">=10.18.1" + } + }, + "node_modules/puppeteer-core/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/puppeteer-core/node_modules/ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/pure-rand": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.3.tgz", + "integrity": "sha512-KddyFewCsO0j3+np81IQ+SweXLDnDQTs5s67BOnrYmYe/yNmUhttQyGsYzy8yUnoljGAQ9sl38YB4vH8ur7Y+w==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ] + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dev": true, + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/raw-body/node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "dev": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "dev": true, + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + }, + "peerDependencies": { + "react": "^18.2.0" + } + }, + "node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "node_modules/react-refresh": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.10.0.tgz", + "integrity": "sha512-PgidR3wST3dDYKr6b4pJoqQFpPGNKDSCDx4cZoshjXipw3LzO7mG1My2pwEzz2JVkF+inx3xRpDeQLFQGH/hsQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/read-pkg/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "dev": true, + "dependencies": { + "resolve": "^1.9.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.4.tgz", + "integrity": "sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "globalthis": "^1.0.3", + "which-builtin-type": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "node_modules/regenerate-unicode-properties": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz", + "integrity": "sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", + "dev": true + }, + "node_modules/regenerator-transform": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", + "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.8.4" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexpu-core": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", + "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", + "dev": true, + "dependencies": { + "@babel/regjsgen": "^0.8.0", + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.1.0", + "regjsparser": "^0.9.1", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsparser": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", + "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", + "dev": true, + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/regjsparser/node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requireindex": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz", + "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==", + "dev": true, + "engines": { + "node": ">=0.10.5" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, + "node_modules/resolve": { + "version": "1.22.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz", + "integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-bin": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/resolve-bin/-/resolve-bin-0.4.3.tgz", + "integrity": "sha512-9u8TMpc+SEHXxQXblXHz5yRvRZERkCZimFN9oz85QI3uhkh7nqfjm6OGTLg+8vucpXGcY4jLK6WkylPmt7GSvw==", + "dev": true, + "dependencies": { + "find-parent-dir": "~0.3.0" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-dir": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-0.1.1.tgz", + "integrity": "sha512-QxMPqI6le2u0dCLyiGzgy92kjkkL6zO0XyvHzjdTNH3zM6e5Hz3BwG6+aEyNgiQ5Xz6PwTwgQEj3U50dByPKIA==", + "dev": true, + "dependencies": { + "expand-tilde": "^1.2.2", + "global-modules": "^0.2.3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/run-con": { + "version": "1.2.12", + "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.12.tgz", + "integrity": "sha512-5257ILMYIF4RztL9uoZ7V9Q97zHtNHn5bN3NobeAnzB1P3ASLgg8qocM2u+R18ttp+VEM78N2LK8XcNVtnSRrg==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~3.0.0", + "minimist": "^1.2.8", + "strip-json-comments": "~3.1.1" + }, + "bin": { + "run-con": "cli.js" + } + }, + "node_modules/run-con/node_modules/ini": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ini/-/ini-3.0.1.tgz", + "integrity": "sha512-it4HyVAUTKBc6m8e1iXWvXSTdndF7HbdN713+kvLrymxTaU4AUBWrJ4vEooP+V7fexnVD3LKcBshjGGPefSMUQ==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-array-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/sass": { + "version": "1.67.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.67.0.tgz", + "integrity": "sha512-SVrO9ZeX/QQyEGtuZYCVxoeAL5vGlYjJ9p4i4HFuekWl8y/LtJ7tJc10Z+ck1c8xOuoBm2MYzcLfTAffD0pl/A==", + "dev": true, + "dependencies": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-loader": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-12.6.0.tgz", + "integrity": "sha512-oLTaH0YCtX4cfnJZxKSLAyglED0naiYfNG1iXfU5w1LNZ+ukoA5DtyDIN5zmKVZwYNJP4KRc5Y3hkWga+7tYfA==", + "dev": true, + "dependencies": { + "klona": "^2.0.4", + "neo-async": "^2.6.2" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "fibers": ">= 3.1.0", + "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", + "sass": "^1.3.0", + "sass-embedded": "*", + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "fibers": { + "optional": true + }, + "node-sass": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + } + } + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "dev": true, + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", + "dev": true + }, + "node_modules/selfsigned": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.1.1.tgz", + "integrity": "sha512-GSL3aowiF7wa/WtSFwnUrludWFoNhftq8bUkH9pkzjpN2XSPOAYEgg6e0sS9s0rZwgJzJiQRPU18A6clnoW5wQ==", + "dev": true, + "dependencies": { + "node-forge": "^1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dev": true, + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/sentence-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", + "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", + "dev": true, + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3", + "upper-case-first": "^2.0.2" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", + "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==", + "dev": true, + "dependencies": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-index/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/serve-index/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==", + "dev": true, + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", + "dev": true + }, + "node_modules/serve-index/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/serve-index/node_modules/setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, + "node_modules/serve-index/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dev": true, + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, + "node_modules/shallow-clone": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-0.1.2.tgz", + "integrity": "sha512-J1zdXCky5GmNnuauESROVu31MQSnLoYvlyEn6j2Ztk6Q5EHFIhxkMhYcv6vuDzl2XEzoRr856QwzMgWM/TmZgw==", + "dev": true, + "dependencies": { + "is-extendable": "^0.1.1", + "kind-of": "^2.0.1", + "lazy-cache": "^0.2.3", + "mixin-object": "^2.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shallow-clone/node_modules/kind-of": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-2.0.1.tgz", + "integrity": "sha512-0u8i1NZ/mg0b+W3MGGw5I7+6Eib2nx72S/QvXa0hYjEkjTknYmEYQJwGu3mLC0BrhtJjtQafTkyRUQ75Kx0LVg==", + "dev": true, + "dependencies": { + "is-buffer": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shallow-clone/node_modules/lazy-cache": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-0.2.7.tgz", + "integrity": "sha512-gkX52wvU/R8DVMMt78ATVPFMJqfW8FPz1GZ1sVHBVQHmu/WvhIWE4cE1GBzhJNFicDeYhnwp6Rl35BcAIM3YOQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "dev": true, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shell-quote": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", + "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/sirv": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.3.tgz", + "integrity": "sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==", + "dev": true, + "dependencies": { + "@polka/url": "^1.0.0-next.20", + "mrmime": "^1.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/snake-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", + "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "dev": true, + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/sockjs": { + "version": "0.3.24", + "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", + "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", + "dev": true, + "dependencies": { + "faye-websocket": "^0.11.3", + "uuid": "^8.3.2", + "websocket-driver": "^0.7.4" + } + }, + "node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-loader": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-3.0.2.tgz", + "integrity": "sha512-BokxPoLjyl3iOrgkWaakaxqnelAJSS+0V+De0kKIq6lyWrXuiPgYTGp6z3iHmqljKAaLXwZa+ctD8GccRJeVvg==", + "dev": true, + "dependencies": { + "abab": "^2.0.5", + "iconv-lite": "^0.6.3", + "source-map-js": "^1.0.1" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/spawnd": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/spawnd/-/spawnd-6.2.0.tgz", + "integrity": "sha512-qX/I4lQy4KgVEcNle0kuc4FxFWHISzBhZW1YemPfwmrmQjyZmfTK/OhBKkhrD2ooAaFZEm1maEBLE6/6enwt+g==", + "dev": true, + "dependencies": { + "exit": "^0.1.2", + "signal-exit": "^3.0.7", + "tree-kill": "^1.2.2" + } + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.13", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz", + "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==", + "dev": true + }, + "node_modules/spdy": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", + "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", + "dev": true, + "dependencies": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/spdy-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", + "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "dev": true, + "dependencies": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/stackframe": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz", + "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==", + "dev": true + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/string.prototype.matchall": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz", + "integrity": "sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "regexp.prototype.flags": "^1.5.0", + "set-function-name": "^2.0.0", + "side-channel": "^1.0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-outer/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/style-search": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz", + "integrity": "sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==", + "dev": true + }, + "node_modules/stylehacks": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-6.0.0.tgz", + "integrity": "sha512-+UT589qhHPwz6mTlCLSt/vMNTJx8dopeJlZAlBMJPWA3ORqu6wmQY7FBXf+qD+FsqoBJODyqNxOUP3jdntFRdw==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "postcss-selector-parser": "^6.0.4" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/stylelint": { + "version": "14.16.1", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.16.1.tgz", + "integrity": "sha512-ErlzR/T3hhbV+a925/gbfc3f3Fep9/bnspMiJPorfGEmcBbXdS+oo6LrVtoUZ/w9fqD6o6k7PtUlCOsCRdjX/A==", + "dev": true, + "dependencies": { + "@csstools/selector-specificity": "^2.0.2", + "balanced-match": "^2.0.0", + "colord": "^2.9.3", + "cosmiconfig": "^7.1.0", + "css-functions-list": "^3.1.0", + "debug": "^4.3.4", + "fast-glob": "^3.2.12", + "fastest-levenshtein": "^1.0.16", + "file-entry-cache": "^6.0.1", + "global-modules": "^2.0.0", + "globby": "^11.1.0", + "globjoin": "^0.1.4", + "html-tags": "^3.2.0", + "ignore": "^5.2.1", + "import-lazy": "^4.0.0", + "imurmurhash": "^0.1.4", + "is-plain-object": "^5.0.0", + "known-css-properties": "^0.26.0", + "mathml-tag-names": "^2.1.3", + "meow": "^9.0.0", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "picocolors": "^1.0.0", + "postcss": "^8.4.19", + "postcss-media-query-parser": "^0.2.3", + "postcss-resolve-nested-selector": "^0.1.1", + "postcss-safe-parser": "^6.0.0", + "postcss-selector-parser": "^6.0.11", + "postcss-value-parser": "^4.2.0", + "resolve-from": "^5.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "style-search": "^0.1.0", + "supports-hyperlinks": "^2.3.0", + "svg-tags": "^1.0.0", + "table": "^6.8.1", + "v8-compile-cache": "^2.3.0", + "write-file-atomic": "^4.0.2" + }, + "bin": { + "stylelint": "bin/stylelint.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/stylelint" + } + }, + "node_modules/stylelint-config-recommended": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-6.0.0.tgz", + "integrity": "sha512-ZorSSdyMcxWpROYUvLEMm0vSZud2uB7tX1hzBZwvVY9SV/uly4AvvJPPhCcymZL3fcQhEQG5AELmrxWqtmzacw==", + "dev": true, + "peerDependencies": { + "stylelint": "^14.0.0" + } + }, + "node_modules/stylelint-config-recommended-scss": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-5.0.2.tgz", + "integrity": "sha512-b14BSZjcwW0hqbzm9b0S/ScN2+3CO3O4vcMNOw2KGf8lfVSwJ4p5TbNEXKwKl1+0FMtgRXZj6DqVUe/7nGnuBg==", + "dev": true, + "dependencies": { + "postcss-scss": "^4.0.2", + "stylelint-config-recommended": "^6.0.0", + "stylelint-scss": "^4.0.0" + }, + "peerDependencies": { + "stylelint": "^14.0.0" + } + }, + "node_modules/stylelint-scss": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-4.7.0.tgz", + "integrity": "sha512-TSUgIeS0H3jqDZnby1UO1Qv3poi1N8wUYIJY6D1tuUq2MN3lwp/rITVo0wD+1SWTmRm0tNmGO0b7nKInnqF6Hg==", + "dev": true, + "dependencies": { + "postcss-media-query-parser": "^0.2.3", + "postcss-resolve-nested-selector": "^0.1.1", + "postcss-selector-parser": "^6.0.11", + "postcss-value-parser": "^4.2.0" + }, + "peerDependencies": { + "stylelint": "^14.5.1 || ^15.0.0" + } + }, + "node_modules/stylelint/node_modules/balanced-match": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", + "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", + "dev": true + }, + "node_modules/stylelint/node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stylelint/node_modules/global-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", + "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", + "dev": true, + "dependencies": { + "global-prefix": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/stylelint/node_modules/global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "dev": true, + "dependencies": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/stylelint/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/svg-parser": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/svg-parser/-/svg-parser-2.0.4.tgz", + "integrity": "sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ==", + "dev": true + }, + "node_modules/svg-tags": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz", + "integrity": "sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==", + "dev": true + }, + "node_modules/svgo": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.0.2.tgz", + "integrity": "sha512-Z706C1U2pb1+JGP48fbazf3KxHrWOsLme6Rv7imFBn5EnuanDW1GPaA/P1/dvObE670JDePC3mnj0k0B7P0jjQ==", + "dev": true, + "dependencies": { + "@trysound/sax": "0.2.0", + "commander": "^7.2.0", + "css-select": "^5.1.0", + "css-tree": "^2.2.1", + "csso": "^5.0.5", + "picocolors": "^1.0.0" + }, + "bin": { + "svgo": "bin/svgo" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/svgo" + } + }, + "node_modules/svgo/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true + }, + "node_modules/table": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", + "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/table/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/table/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.19.4", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.4.tgz", + "integrity": "sha512-6p1DjHeuluwxDXcuT9VR8p64klWJKo1ILiy19s6C9+0Bh2+NWTX6nD9EPppiER4ICkHDVB1RkVpin/YW2nQn/g==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.9", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.9.tgz", + "integrity": "sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.17", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.1", + "terser": "^5.16.8" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/terser-webpack-plugin/node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/terser-webpack-plugin/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/terser/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/terser/node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, + "node_modules/thunky": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", + "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", + "dev": true + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "dev": true, + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/trim-repeated/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/tsconfig-paths/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/tsutils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", + "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dev": true, + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", + "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/upper-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", + "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", + "dev": true, + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/upper-case-first": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", + "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", + "dev": true, + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/url-loader": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-4.1.1.tgz", + "integrity": "sha512-3BTV812+AVHHOJQO8O5MkWgZ5aosP7GnROJwvzLS9hWDj00lZ6Z0wNak423Lp9PBZN05N+Jk/N5Si8jRAlGyWA==", + "dev": true, + "dependencies": { + "loader-utils": "^2.0.0", + "mime-types": "^2.1.27", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "file-loader": "*", + "webpack": "^4.0.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "file-loader": { + "optional": true + } + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/v8-compile-cache": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz", + "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", + "dev": true + }, + "node_modules/v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/validate-npm-package-name": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz", + "integrity": "sha512-YuKoXDAhBYxY7SfOKxHBDoSyENFeW5VvIIQp2TGQuit8gpK6MnWaQelBKxso72DoxTZfZdcP3W90LqpSkgPzLQ==", + "dev": true, + "dependencies": { + "builtins": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dev": true, + "dependencies": { + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/wait-on": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-6.0.1.tgz", + "integrity": "sha512-zht+KASY3usTY5u2LgaNqn/Cd8MukxLGjdcZxT2ns5QzDmTFc4XoWBgC+C/na+sMRZTuVygQoMYwdcVjHnYIVw==", + "dev": true, + "dependencies": { + "axios": "^0.25.0", + "joi": "^17.6.0", + "lodash": "^4.17.21", + "minimist": "^1.2.5", + "rxjs": "^7.5.4" + }, + "bin": { + "wait-on": "bin/wait-on" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dev": true, + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "dependencies": { + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/webpack": { + "version": "5.88.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.88.2.tgz", + "integrity": "sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ==", + "dev": true, + "dependencies": { + "@types/eslint-scope": "^3.7.3", + "@types/estree": "^1.0.0", + "@webassemblyjs/ast": "^1.11.5", + "@webassemblyjs/wasm-edit": "^1.11.5", + "@webassemblyjs/wasm-parser": "^1.11.5", + "acorn": "^8.7.1", + "acorn-import-assertions": "^1.9.0", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.15.0", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.9", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.2.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.7", + "watchpack": "^2.4.0", + "webpack-sources": "^3.2.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-bundle-analyzer": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.9.1.tgz", + "integrity": "sha512-jnd6EoYrf9yMxCyYDPj8eutJvtjQNp8PHmni/e/ulydHBWhT5J3menXt3HEkScsu9YqMAcG4CfFjs3rj5pVU1w==", + "dev": true, + "dependencies": { + "@discoveryjs/json-ext": "0.5.7", + "acorn": "^8.0.4", + "acorn-walk": "^8.0.0", + "commander": "^7.2.0", + "escape-string-regexp": "^4.0.0", + "gzip-size": "^6.0.0", + "is-plain-object": "^5.0.0", + "lodash.debounce": "^4.0.8", + "lodash.escape": "^4.0.1", + "lodash.flatten": "^4.4.0", + "lodash.invokemap": "^4.6.0", + "lodash.pullall": "^4.2.0", + "lodash.uniqby": "^4.7.0", + "opener": "^1.5.2", + "picocolors": "^1.0.0", + "sirv": "^2.0.3", + "ws": "^7.3.1" + }, + "bin": { + "webpack-bundle-analyzer": "lib/bin/analyzer.js" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/webpack-bundle-analyzer/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/webpack-bundle-analyzer/node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "dev": true, + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", + "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", + "dev": true, + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.2.0", + "@webpack-cli/info": "^1.5.0", + "@webpack-cli/serve": "^1.7.0", + "colorette": "^2.0.14", + "commander": "^7.0.0", + "cross-spawn": "^7.0.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "4.x.x || 5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "@webpack-cli/migrate": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/webpack-cli/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/webpack-cli/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/webpack-cli/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/webpack-cli/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/webpack-dev-middleware": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", + "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "dev": true, + "dependencies": { + "colorette": "^2.0.10", + "memfs": "^3.4.3", + "mime-types": "^2.1.31", + "range-parser": "^1.2.1", + "schema-utils": "^4.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/webpack-dev-middleware/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/webpack-dev-middleware/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/webpack-dev-middleware/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/webpack-dev-middleware/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/webpack-dev-server": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-4.15.1.tgz", + "integrity": "sha512-5hbAst3h3C3L8w6W4P96L5vaV0PxSmJhxZvWKYIdgxOQm8pNZ5dEOmmSLBVpP85ReeyRt6AS1QJNyo/oFFPeVA==", + "dev": true, + "dependencies": { + "@types/bonjour": "^3.5.9", + "@types/connect-history-api-fallback": "^1.3.5", + "@types/express": "^4.17.13", + "@types/serve-index": "^1.9.1", + "@types/serve-static": "^1.13.10", + "@types/sockjs": "^0.3.33", + "@types/ws": "^8.5.5", + "ansi-html-community": "^0.0.8", + "bonjour-service": "^1.0.11", + "chokidar": "^3.5.3", + "colorette": "^2.0.10", + "compression": "^1.7.4", + "connect-history-api-fallback": "^2.0.0", + "default-gateway": "^6.0.3", + "express": "^4.17.3", + "graceful-fs": "^4.2.6", + "html-entities": "^2.3.2", + "http-proxy-middleware": "^2.0.3", + "ipaddr.js": "^2.0.1", + "launch-editor": "^2.6.0", + "open": "^8.0.9", + "p-retry": "^4.5.0", + "rimraf": "^3.0.2", + "schema-utils": "^4.0.0", + "selfsigned": "^2.1.1", + "serve-index": "^1.9.1", + "sockjs": "^0.3.24", + "spdy": "^4.0.2", + "webpack-dev-middleware": "^5.3.1", + "ws": "^8.13.0" + }, + "bin": { + "webpack-dev-server": "bin/webpack-dev-server.js" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.37.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + }, + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-dev-server/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/webpack-dev-server/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/webpack-dev-server/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/webpack-dev-server/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/webpack-dev-server/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/webpack-merge": { + "version": "5.9.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.9.0.tgz", + "integrity": "sha512-6NbRQw4+Sy50vYNTw7EyOn41OZItPiXB8GNv3INSoe3PSFaHJEz3SHTrYVaRm2LilNGnFUzh0FAwqPEmU/CwDg==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-merge/node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-merge/node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack-merge/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack-merge/node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/websocket-driver": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", + "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", + "dev": true, + "dependencies": { + "http-parser-js": ">=0.5.1", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/websocket-extensions": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", + "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.1.3.tgz", + "integrity": "sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==", + "dev": true, + "dependencies": { + "function.prototype.name": "^1.1.5", + "has-tostringtag": "^1.0.0", + "is-async-function": "^2.0.0", + "is-date-object": "^1.0.5", + "is-finalizationregistry": "^1.0.2", + "is-generator-function": "^1.0.10", + "is-regex": "^1.1.4", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, + "dependencies": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", + "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/ws": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.1.tgz", + "integrity": "sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/blocks/package.json b/blocks/package.json new file mode 100644 index 000000000..b207c4263 --- /dev/null +++ b/blocks/package.json @@ -0,0 +1,20 @@ +{ + "name": "qsm", + "version": "1.0.0", + "description": "Quiz And Survey Master", + "author": "ExpressTech", + "license": "GPL-2.0-or-later", + "main": "build/index.js", + "scripts": { + "build": "wp-scripts build", + "format": "wp-scripts format", + "lint:css": "wp-scripts lint-style", + "lint:js": "wp-scripts lint-js", + "packages-update": "wp-scripts packages-update", + "plugin-zip": "wp-scripts plugin-zip", + "start": "wp-scripts start" + }, + "devDependencies": { + "@wordpress/scripts": "^26.12.0" + } +} diff --git a/blocks/src/answer-option/block.json b/blocks/src/answer-option/block.json new file mode 100644 index 000000000..3956752cd --- /dev/null +++ b/blocks/src/answer-option/block.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "qsm/quiz-answer-option", + "version": "0.1.0", + "title": "Answer Option", + "category": "widgets", + "parent": [ "qsm/quiz-question" ], + "icon": "feedback", + "description": "QSM Quiz answer option", + "attributes": { + "optionID": { + "type": "string", + "default": "0" + }, + "content": { + "type": "string", + "default": "" + }, + "points":{ + "type": "string", + "default": "0" + }, + "isCorrect": { + "type": "string", + "default": "0" + } + }, + "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/questionID" ], + "example": {}, + "supports": { + "html": false + }, + "textdomain": "main-block", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "render": "file:./render.php", + "viewScript": "file:./view.js" +} \ No newline at end of file diff --git a/blocks/src/answer-option/edit.js b/blocks/src/answer-option/edit.js new file mode 100644 index 000000000..1894176f2 --- /dev/null +++ b/blocks/src/answer-option/edit.js @@ -0,0 +1,125 @@ +import { __ } from '@wordpress/i18n'; +import { useState, useEffect } from '@wordpress/element'; +import apiFetch from '@wordpress/api-fetch'; +import { + InspectorControls, + RichText, + InnerBlocks, + useBlockProps, +} from '@wordpress/block-editor'; +import { store as editorStore } from '@wordpress/editor'; +import { store as coreStore } from '@wordpress/core-data'; +import { useDispatch, useSelect } from '@wordpress/data'; +import { + PanelBody, + PanelRow, + TextControl, + ToggleControl, + RangeControl, + RadioControl, + SelectControl, +} from '@wordpress/components'; +import { createBlock } from '@wordpress/blocks'; +import { qsmIsEmpty, qsmStripTags } from '../helper'; +export default function Edit( props ) { + + //check for QSM initialize data + if ( 'undefined' === typeof qsmBlockData ) { + return null; + } + + const { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace, +onRemove } = props; + + const quizID = context['quiz-master-next/quizID']; + const pageID = context['quiz-master-next/pageID']; + const questionID = context['quiz-master-next/questionID']; + const name = 'qsm/quiz-answer-option'; + const { + optionID, + content, + points, + isCorrect + } = attributes; + + /**Initialize block from server */ + useEffect( () => { + let shouldSetQSMAttr = true; + if ( shouldSetQSMAttr ) { + + + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + + }, [ quizID ] ); + + const blockProps = useBlockProps( { + className: '', + } ); + + //Decode htmlspecialchars + const decodeHtml = (html) => { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; + } + + return ( + <> + + + setAttributes( { points } ) } + /> + setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) } + /> + + +
+ setAttributes( { content: qsmStripTags( content ) } ) } + onSplit={ ( value, isOriginal ) => { + let newAttributes; + + if ( isOriginal || value ) { + newAttributes = { + ...attributes, + content: value, + }; + } + + const block = createBlock( name, newAttributes ); + + if ( isOriginal ) { + block.clientId = clientId; + } + + return block; + } } + onMerge={ mergeBlocks } + onReplace={ onReplace } + onRemove={ onRemove } + allowedFormats={ [ ] } + withoutInteractiveFormatting + className={ 'qsm-question-answer-option' } + identifier='text' + /> +
+ + ); +} diff --git a/blocks/src/answer-option/index.js b/blocks/src/answer-option/index.js new file mode 100644 index 000000000..a2ab5c1fa --- /dev/null +++ b/blocks/src/answer-option/index.js @@ -0,0 +1,14 @@ +import { registerBlockType } from '@wordpress/blocks'; +import Edit from './edit'; +import metadata from './block.json'; + +registerBlockType( metadata.name, { + merge( attributes, attributesToMerge ) { + return { + content: + ( attributes.content || '' ) + + ( attributesToMerge.content || '' ), + }; + }, + edit: Edit, +} ); diff --git a/blocks/src/block.json b/blocks/src/block.json new file mode 100644 index 000000000..254038496 --- /dev/null +++ b/blocks/src/block.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "qsm/quiz", + "version": "0.1.0", + "title": "QSM Quiz", + "category": "widgets", + "icon": "feedback", + "description": "Easily and quickly add quizzes and surveys to your website.", + "attributes": { + "quizID": { + "type": "string", + "default": "0" + } + }, + "providesContext": { + "quiz-master-next/quizID": "quizID" + }, + "example": {}, + "supports": { + "html": false + }, + "textdomain": "main-block", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "render": "file:./render.php", + "viewScript": "file:./view.js" +} \ No newline at end of file diff --git a/blocks/src/edit.js b/blocks/src/edit.js new file mode 100644 index 000000000..08a5d5185 --- /dev/null +++ b/blocks/src/edit.js @@ -0,0 +1,381 @@ +import { __ } from '@wordpress/i18n'; +import { useState, useEffect } from '@wordpress/element'; +import apiFetch from '@wordpress/api-fetch'; +import { + InspectorControls, + InnerBlocks, + useBlockProps, + useInnerBlocksProps, +} from '@wordpress/block-editor'; +import { store as editorStore } from '@wordpress/editor'; +import { store as coreStore } from '@wordpress/core-data'; +import { useDispatch, useSelect } from '@wordpress/data'; +import { + PanelBody, + Button, + PanelRow, + TextControl, + ToggleControl, + RangeControl, + RadioControl, + SelectControl, + Placeholder, + Icon, + __experimentalVStack as VStack, +} from '@wordpress/components'; +import './editor.scss'; +import { qsmIsEmpty } from './helper'; +export default function Edit( props ) { + //check for QSM initialize data + if ( 'undefined' === typeof qsmBlockData ) { + return null; + } + + const { className, attributes, setAttributes, isSelected, clientId } = props; + /* + " quiz_name": { + "type": "string", + "default": "" + }, + "quiz_featured_image": { + "type": "string", + "default": "" + }, + "form_type": { + "type": "string", + "default": "" + }, + "system": { + "type": "string", + "default": "" + }, + "timer_limit": { + "type": "string", + "default": "" + }, + "pagination": { + "type": "string", + "default": "" + }, + "enable_pagination_quiz": { + "type": "number", + "default": 0 + }, + "progress_bar": { + "type": "number", + "default": 0 + }, + "require_log_in": { + "type": "number", + "default": 0 + }, + "disable_first_page": { + "type": "number", + "default": 0 + }, + "comment_section": { + "type": "number", + "default": 1 + } + */ + const { + quizID + } = attributes; + + const [ quizAttr, setQuizAttr ] = useState( qsmBlockData.globalQuizsetting ); + const [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList ); + const [ createQuiz, setCreateQuiz ] = useState( false ); + const [ saveQuiz, setSaveQuiz ] = useState( false ); + const [ showAdvanceOption, setShowAdvanceOption ] = useState( false ); + const [ quizTemplate, setQuizTemplate ] = useState( [] ); + const quizOptions = qsmBlockData.quizOptions; + /**Initialize block from server */ + useEffect( () => { + let shouldSetQSMAttr = true; + if ( shouldSetQSMAttr ) { + + if ( ! qsmIsEmpty( quizID ) && 0 < quizID && ( qsmIsEmpty( quizAttr ) || qsmIsEmpty( quizAttr?.quizID ) || quizID != quizAttr.quiz_id ) ) { + apiFetch( { + path: '/quiz-survey-master/v1/quiz/structure', + method: 'POST', + data: { quizID: quizID }, + } ).then( ( res ) => { + console.log( res ); + if ( 'success' == res.status ) { + let result = res.result; + setQuizAttr( { + ...quizAttr, + ...result + } ); + if ( ! qsmIsEmpty( result.qpages ) ) { + let quizTemp = []; + result.qpages.forEach( page => { + let questions = []; + if ( ! qsmIsEmpty( page.question_arr ) ) { + page.question_arr.forEach( question => { + if ( ! qsmIsEmpty( question ) ) { + let answers = []; + //answers options blocks + if ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) { + + question.answers.forEach( ( answer, aIndex ) => { + answers.push( + [ + 'qsm/quiz-answer-option', + { + optionID:aIndex, + content:answer[0], + points:answer[1], + isCorrect:answer[2] + } + ] + ); + }); + } + //question blocks + questions.push( + [ + 'qsm/quiz-question', + { + questionID: question.question_id, + type: question.question_type_new, + answerEditor: question.settings.answerEditor, + title: question.settings.question_title, + description: question.question_name, + required: question.settings.required, + hint:question.hints, + answers: question.answers, + correctAnswerInfo:question.question_answer_info, + category:question.category, + multicategories:question.multicategories, + commentBox: question.comments, + matchAnswer: question.settings.matchAnswer, + featureImageID: question.settings.featureImageID, + featureImageSrc: question.settings.featureImageSrc, + settings: question.settings + }, + answers + ] + ); + } + }); + } + //console.log("page",page); + quizTemp.push( + [ + 'qsm/quiz-page', + { + pageID:page.id, + pageKey: page.pagekey, + hidePrevBtn: page.hide_prevbtn, + quizID: page.quizID + }, + questions + ] + ) + }); + setQuizTemplate( quizTemp ); + } + // QSM_QUIZ = [ + // [ + + // ] + // ]; + } else { + console.log( "error "+ res.msg ); + } + } ); + + } + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + + }, [ quizID ] ); + + + const feedbackIcon = () => ( + ( + + + + + + + ) + } + /> + ); + const quizPlaceholder = ( ) => { + return ( + + { + <> + { ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& +
+ + setAttributes( { quizID } ) + } + disabled={ createQuiz } + __nextHasNoMarginBottom + /> + { __( 'OR', 'quiz-master-next' ) } + +
+ } + { ( qsmIsEmpty( quizList ) || createQuiz ) && + + setQuizAttributes( val, 'quiz_name') } + /> + + { showAdvanceOption && (<> + {/**Form Type */} + setQuizAttributes( val, 'form_type') } + __nextHasNoMarginBottom + /> + {/**Grading Type */} + setQuizAttributes( val, 'system') } + help={ quizOptions?.system?.help } + __nextHasNoMarginBottom + /> + { + [ + 'timer_limit', + 'pagination', + ].map( ( item ) => ( + setQuizAttributes( val, item) } + /> + ) ) + } + { + [ + 'enable_contact_form', + 'enable_pagination_quiz', + 'show_question_featured_image_in_result', + 'progress_bar', + 'require_log_in', + 'disable_first_page', + 'comment_section' + ].map( ( item ) => ( + setQuizAttributes( ( ( ! qsmIsEmpty( quizAttr[item] ) && '1' == quizAttr[item] ) ? 0 : 1 ), item ) } + /> + ) ) + + } + ) + } + + + } + + } +
+ ); + }; + + const setQuizAttributes = ( value , attr_name ) => { + let newAttr = quizAttr; + newAttr[ attr_name ] = value; + setQuizAttr( { ...newAttr } ); + } + + const createNewQuiz = () => { + + } + + const blockProps = useBlockProps(); + const innerBlocksProps = useInnerBlocksProps( blockProps, { + template: quizTemplate, + allowedBlocks : [ + 'qsm/quiz-page' + ] + } ); + + + return ( + <> + + + setQuizAttributes( val, 'quiz_name') } + /> + + + { ( qsmIsEmpty( quizID ) || '0' == quizID ) ? + quizPlaceholder() + : +
+ } + + + ); +} diff --git a/blocks/src/editor.scss b/blocks/src/editor.scss new file mode 100644 index 000000000..84d61d3ff --- /dev/null +++ b/blocks/src/editor.scss @@ -0,0 +1,55 @@ +/** + * The following styles get applied inside the editor only. + * + * Replace them with your own styles or remove the file completely. + */ + + $qsm_primary_color: #666666; + $qsm_wp_primary_color : #1f8cbe; + +.qsm-placeholder-select-create-quiz{ + display: flex; + gap: 1rem; + align-items: center; + margin-bottom: 1rem; + .components-base-control{ + max-width: 50%; + } +} + +.qsm-placeholder-quiz-create-form{ + width: 50%; + .components-button{ + width: fit-content; + } +} + +.wp-block-qsm-quiz-question { + /*Question Title*/ + .qsm-question-title { + color: $qsm_wp_primary_color; + font-size: 1.38rem; + } + + /*Question description*/ + .qsm-question-description, + .qsm-question-correct-answer-info, + .qsm-question-hint { + font-size: 1rem; + } + + /*Question options*/ + .qsm-question-answer-option{ + color: $qsm_primary_color; + font-size: 0.9rem; + margin-left: 1rem; + } + + /*Question block in editing mode*/ + &.in-editing-mode{ + .qsm-question-title{ + color: $qsm_primary_color; + } + } + +} diff --git a/blocks/src/helper.js b/blocks/src/helper.js new file mode 100644 index 000000000..e6fec85a7 --- /dev/null +++ b/blocks/src/helper.js @@ -0,0 +1,16 @@ +//Check if undefined, null, empty +export const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data ); + +export const qsmSanitizeName = ( name ) => { + if ( qsmIsEmpty( name ) ) { + name = ''; + } else { + name = name.toLowerCase().replace( / /g, '_' ); + name = name.replace(/\W/g, ''); + } + + return name; +} + +// Remove anchor tags from button text content. +export const qsmStripTags = ( text ) => text.replace( /<\/?a[^>]*>/g, '' ); \ No newline at end of file diff --git a/blocks/src/index.js b/blocks/src/index.js new file mode 100644 index 000000000..056571c55 --- /dev/null +++ b/blocks/src/index.js @@ -0,0 +1,12 @@ +import { registerBlockType } from '@wordpress/blocks'; +import './style.scss'; +import Edit from './edit'; +import metadata from './block.json'; +const save = ( props ) => null; +registerBlockType( metadata.name, { + /** + * @see ./edit.js + */ + edit: Edit, + save: save, +} ); diff --git a/blocks/src/page/block.json b/blocks/src/page/block.json new file mode 100644 index 000000000..7caa7fc63 --- /dev/null +++ b/blocks/src/page/block.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "qsm/quiz-page", + "version": "0.1.0", + "title": "Page", + "category": "widgets", + "parent": [ "qsm/quiz" ], + "icon": "feedback", + "description": "QSM Quiz Page", + "attributes": { + "pageID": { + "type": "string", + "default": "0" + }, + "pageKey": { + "type": "string", + "default": "" + }, + "hidePrevBtn": { + "type": "string", + "default": "0" + } + }, + "usesContext": [ "quiz-master-next/quizID" ], + "providesContext": { + "quiz-master-next/pageID": "pageID" + }, + "example": {}, + "supports": { + "html": false + }, + "textdomain": "main-block", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "render": "file:./render.php", + "viewScript": "file:./view.js" +} \ No newline at end of file diff --git a/blocks/src/page/edit.js b/blocks/src/page/edit.js new file mode 100644 index 000000000..83be8c66a --- /dev/null +++ b/blocks/src/page/edit.js @@ -0,0 +1,77 @@ +import { __ } from '@wordpress/i18n'; +import { useState, useEffect } from '@wordpress/element'; +import apiFetch from '@wordpress/api-fetch'; +import { + InspectorControls, + InnerBlocks, + useBlockProps, +} from '@wordpress/block-editor'; +import { + PanelBody, + PanelRow, + TextControl, + ToggleControl, + RangeControl, + RadioControl, + SelectControl, +} from '@wordpress/components'; +import { qsmIsEmpty } from '../helper'; +export default function Edit( props ) { + //check for QSM initialize data + if ( 'undefined' === typeof qsmBlockData ) { + return null; + } + + const { className, attributes, setAttributes, isSelected, clientId, context } = props; + + const quizID = context['quiz-master-next/quizID']; + + const { + pageID, + pageKey, + hidePrevBtn, + } = attributes; + + const [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting ); + + /**Initialize block from server */ + useEffect( () => { + let shouldSetQSMAttr = true; + if ( shouldSetQSMAttr ) { + //console.log("attr",attributes); + + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + + }, [ quizID ] ); + const blockProps = useBlockProps(); + + return ( + <> + + + setAttributes( { pageKey } ) } + /> + setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) } + /> + + + +
+ +
+ + ); +} diff --git a/blocks/src/page/index.js b/blocks/src/page/index.js new file mode 100644 index 000000000..0157b8f28 --- /dev/null +++ b/blocks/src/page/index.js @@ -0,0 +1,10 @@ +import { registerBlockType } from '@wordpress/blocks'; +import Edit from './edit'; +import metadata from './block.json'; + +registerBlockType( metadata.name, { + /** + * @see ./edit.js + */ + edit: Edit, +} ); diff --git a/blocks/src/question/block.json b/blocks/src/question/block.json new file mode 100644 index 000000000..d8cdc035e --- /dev/null +++ b/blocks/src/question/block.json @@ -0,0 +1,93 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "qsm/quiz-question", + "version": "0.1.0", + "title": "Question", + "category": "widgets", + "parent": [ "qsm/quiz-page" ], + "icon": "feedback", + "description": "QSM Quiz Question", + "attributes": { + "questionID": { + "type": "string", + "default": "0" + }, + "type": { + "type": "string", + "default": "0" + }, + "description": { + "type": "string", + "source": "html", + "selector": "p", + "default": "" + }, + "title": { + "type": "string", + "default": "" + }, + "correctAnswerInfo": { + "type": "string", + "source": "html", + "selector": "p", + "default": "" + }, + "commentBox": { + "type": "string", + "default": "0" + }, + "category": { + "type": "number" + }, + "multicategories": { + "type": "array" + }, + "hint": { + "type": "string" + }, + "featureImageID": { + "type": "number" + }, + "featureImageSrc": { + "type": "string" + }, + "answers": { + "type": "array" + }, + "answerEditor": { + "type": "string", + "default": "text" + }, + "matchAnswer": { + "type": "string", + "default": "random" + }, + "required": { + "type": "string", + "default": "0" + }, + "otherSettings": { + "type": "object", + "default": {} + }, + "settings": { + "type": "object", + "default": {} + } + }, + "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID" ], + "providesContext": { + "quiz-master-next/questionID": "questionID" + }, + "example": {}, + "supports": { + "html": false + }, + "textdomain": "main-block", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "render": "file:./render.php", + "viewScript": "file:./view.js" +} \ No newline at end of file diff --git a/blocks/src/question/edit.js b/blocks/src/question/edit.js new file mode 100644 index 000000000..ac02a1266 --- /dev/null +++ b/blocks/src/question/edit.js @@ -0,0 +1,212 @@ +import { __ } from '@wordpress/i18n'; +import { useState, useEffect } from '@wordpress/element'; +import apiFetch from '@wordpress/api-fetch'; +import { + InspectorControls, + RichText, + InnerBlocks, + useBlockProps, +} from '@wordpress/block-editor'; +import { store as editorStore } from '@wordpress/editor'; +import { store as coreStore } from '@wordpress/core-data'; +import { useDispatch, useSelect } from '@wordpress/data'; +import { + PanelBody, + PanelRow, + TextControl, + ToggleControl, + RangeControl, + RadioControl, + SelectControl, +} from '@wordpress/components'; +import { qsmIsEmpty, qsmStripTags } from '../helper'; +/** + * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array + * + */ + +export default function Edit( props ) { + //check for QSM initialize data + if ( 'undefined' === typeof qsmBlockData ) { + return null; + } + + const { className, attributes, setAttributes, isSelected, clientId, context } = props; + + /** https://github.com/WordPress/gutenberg/issues/22282 */ + const isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) ); + + const quizID = context['quiz-master-next/quizID']; + const pageID = context['quiz-master-next/pageID']; + + const { + questionID, + type, + description, + title, + correctAnswerInfo, + commentBox, + category, + multicategories, + hint, + featureImageID, + featureImageSrc, + answers, + answerEditor, + matchAnswer, + otherSettings, + settings, + } = attributes; + + const [ quesAttr, setQuesAttr ] = useState( settings ); + + /**Initialize block from server */ + useEffect( () => { + let shouldSetQSMAttr = true; + if ( shouldSetQSMAttr ) { + + + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + + }, [ quizID ] ); + + const blockProps = useBlockProps( { + className: isParentOfSelectedBlock ? ' in-editing-mode':'' , + } ); + + //Decode htmlspecialchars + const decodeHtml = ( html ) => { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; + } + + const QUESTION_TEMPLATE = [ + [ + 'qsm/quiz-answer-option', + { + optionID:'0' + } + ], + [ + 'qsm/quiz-answer-option', + { + optionID:'1' + } + ] + + ]; + + return ( + <> + + +

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

+ { /** Question Type **/ } + + setAttributes( { type } ) + } + __nextHasNoMarginBottom + > + { + ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => + ( + + { + qtypes.types.map( qtype => + ( + + ) + ) + } + + ) + ) + } + + {/**Answer Type */} + + setAttributes( { answerEditor } ) + } + __nextHasNoMarginBottom + /> +
+ {/**Comment Box */} + + + setAttributes( { commentBox } ) + } + __nextHasNoMarginBottom + /> + +
+
+ setAttributes( { title: qsmStripTags( title ) } ) } + allowedFormats={ [ ] } + withoutInteractiveFormatting + className={ 'qsm-question-title' } + /> + { + isParentOfSelectedBlock && + <> + setAttributes({ description }) } + className={ 'qsm-question-description' } + __unstableEmbedURLOnPaste + __unstableAllowPrefixTransformations + /> + + setAttributes({ correctAnswerInfo }) } + className={ 'qsm-question-correct-answer-info' } + __unstableEmbedURLOnPaste + __unstableAllowPrefixTransformations + /> + setAttributes( { hint: qsmStripTags( hint ) } ) } + allowedFormats={ [ ] } + withoutInteractiveFormatting + className={ 'qsm-question-hint' } + /> + + } +
+ + ); +} diff --git a/blocks/src/question/index.js b/blocks/src/question/index.js new file mode 100644 index 000000000..0157b8f28 --- /dev/null +++ b/blocks/src/question/index.js @@ -0,0 +1,10 @@ +import { registerBlockType } from '@wordpress/blocks'; +import Edit from './edit'; +import metadata from './block.json'; + +registerBlockType( metadata.name, { + /** + * @see ./edit.js + */ + edit: Edit, +} ); diff --git a/blocks/src/render.php b/blocks/src/render.php new file mode 100644 index 000000000..02d32ba52 --- /dev/null +++ b/blocks/src/render.php @@ -0,0 +1,8 @@ + +

> + +

diff --git a/blocks/src/style.scss b/blocks/src/style.scss new file mode 100644 index 000000000..a027aa639 --- /dev/null +++ b/blocks/src/style.scss @@ -0,0 +1,12 @@ +/** + * The following styles get applied both on the front of your site + * and in the editor. + * + * Replace them with your own styles or remove the file completely. + */ + +// .wp-block-qsm-main-block { +// background-color: #21759b; +// color: #fff; +// padding: 2px; +// } diff --git a/blocks/src/view.js b/blocks/src/view.js new file mode 100644 index 000000000..76ee8b15f --- /dev/null +++ b/blocks/src/view.js @@ -0,0 +1,21 @@ +/** + * Use this file for JavaScript code that you want to run in the front-end + * on posts/pages that contain this block. + * + * When this file is defined as the value of the `viewScript` property + * in `block.json` it will be enqueued on the front end of the site. + * + * Example: + * + * ```js + * { + * "viewScript": "file:./view.js" + * } + * ``` + * + * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script + */ + +/* eslint-disable no-console */ +console.log("Hello World! (from qsm-main-block block)"); +/* eslint-enable no-console */ diff --git a/php/rest-api.php b/php/rest-api.php index 509d0f2cc..37b83d691 100644 --- a/php/rest-api.php +++ b/php/rest-api.php @@ -90,6 +90,19 @@ function qsm_register_rest_routes() { }, ) ); + + //get quiz structure data + register_rest_route( + 'quiz-survey-master/v1', + '/quiz/structure', + array( + 'methods' => WP_REST_Server::CREATABLE, + 'callback' => 'qsm_quiz_structure_data', + 'permission_callback' => function () { + return current_user_can( 'edit_posts' ); + }, + ) + ); // Register rest api to get quiz list register_rest_route( 'qsm', @@ -122,6 +135,7 @@ function qsm_register_rest_routes() { }, ) ); + // Get Categories of quiz register_rest_route( 'quiz-survey-master/v1', @@ -783,3 +797,103 @@ function qsm_get_quizzes_list() { } return $qsm_quiz_list; } + +if ( ! function_exists( 'qsm_quiz_structure_data' ) ) { + function qsm_quiz_structure_data( WP_REST_Request $request ) { + + $result = array( + 'status' => 'error', + 'msg' => __( 'User not found', 'quiz-master-next' ), + ); + if ( ! is_user_logged_in() || ! function_exists( 'wp_get_current_user' ) || empty( wp_get_current_user() ) ) { + return $result; + } + + $quiz_id = isset( $request['quizID'] ) ? intval( $request['quizID'] ) : 0; + + if ( empty( $quiz_id ) && ! is_numeric( $quiz_id ) ) { + $result['msg'] = __( 'Invalid quiz id', 'quiz-master-next' ); + return $result; + } + + global $wpdb; + + + $quiz_data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_quizzes WHERE deleted = 0 AND quiz_id = %d ORDER BY quiz_id DESC", $quiz_id ), ARRAY_A ); + + if ( ! empty( $quiz_data ) ) { + + // Cycle through each quiz and retrieve all of quiz's questions. + foreach ( $quiz_data as $key => $quiz ) { + + $question_data = QSM_Questions::load_questions_by_pages( $quiz['quiz_id'] ); + $quiz_data[ $key ]['questions'] = $question_data; + + //unserialize quiz_settings + if ( ! empty( $quiz_data[ $key ]['quiz_settings'] ) ) { + $quiz_data[ $key ]['quiz_settings'] = maybe_unserialize( $quiz_data[ $key ]['quiz_settings'] ); + //unserialize pages + if ( ! empty( $quiz_data[ $key ]['quiz_settings']['qpages'] ) ) { + $quiz_data[ $key ]['qpages'] = maybe_unserialize( $quiz_data[ $key ]['quiz_settings']['qpages'] ); + if ( ! empty( $quiz_data[ $key ]['quiz_settings']['pages'] ) ) { + $quiz_data[ $key ]['pages'] = maybe_unserialize( $quiz_data[ $key ]['quiz_settings']['pages'] ); + //group question under individual pages + if ( is_array( $quiz_data[ $key ]['qpages'] ) ) { + foreach ( $quiz_data[ $key ]['qpages'] as $pageIndex => $page ) { + if ( ! empty( $page['questions'] ) && ! empty( $quiz_data[ $key ]['pages'][ $pageIndex ] ) ) { + $quiz_data[ $key ]['qpages'][$pageIndex]['question_arr'] = array(); + foreach ( $quiz_data[ $key ]['pages'][ $pageIndex ] as $qIndex => $q ) { + $quiz_data[ $key ]['qpages'][$pageIndex]['question_arr'][] = $quiz_data[ $key ]['questions'][$q]; + } + } + } + } + } + } + } + + // checking if logic is updated to tables + $logic_updated = get_option( 'logic_rules_quiz_' . $quiz['quiz_id'] ); + if ( $logic_updated ) { + $query = $wpdb->prepare( "SELECT logic FROM {$wpdb->prefix}mlw_logic where quiz_id = %d", $quiz['quiz_id'] ); + $logic_data = $wpdb->get_results( $query, ARRAY_N ); + $logics = array(); + if ( ! empty( $logic_data ) ) { + foreach ( $logic_data as $logic ) { + $logics[] = maybe_unserialize( $logic[0] ); + } + $serialized_logic = maybe_serialize( $logics ); + $quiz_data[ $key ]['logic'] = $serialized_logic; + } + } + + // get featured image of quiz if available + $qsm_featured_image = get_option( 'quiz_featured_image_' . $quiz['quiz_id'] ); + if ( $qsm_featured_image ) { + $quiz_data[ $key ]['featured_image'] = $qsm_featured_image; + } + + // get themes setting + $query = $wpdb->prepare( "SELECT A.theme, B.quiz_theme_settings, B.active_theme FROM {$wpdb->prefix}mlw_themes A, {$wpdb->prefix}mlw_quiz_theme_settings B where A.id = B.theme_id and B.quiz_id = %d", $quiz['quiz_id'] ); + $themes_data = $wpdb->get_results( $query, ARRAY_N ); + if ( ! empty( $themes_data ) ) { + $themes = array(); + foreach ( $themes_data as $data ) { + $themes[] = $data; + } + $serialized_themes = maybe_serialize( $themes ); + $quiz_data[ $key ]['themes'] = $serialized_themes; + } + } + return array( + 'status' => 'success', + 'result' => $quiz_data[0], + ); + + }else { + $result['msg'] = __( 'Quiz not found!', 'quiz-master-next' ); + return $result; + } + } +} + From ab6e04e44baf81f287e5f82770d19227b069bb33 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Fri, 6 Oct 2023 19:30:49 +0530 Subject: [PATCH 02/27] qsm quiz block - create quiz --- blocks/block.php | 226 ++++++++++++- blocks/build/answer-option/block.json | 2 +- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 26 +- blocks/build/answer-option/index.js.map | 2 +- blocks/build/block.json | 4 +- blocks/build/index.asset.php | 2 +- blocks/build/index.js | 361 +++++++++++++-------- blocks/build/index.js.map | 2 +- blocks/build/page/block.json | 2 +- blocks/build/page/index.asset.php | 2 +- blocks/build/page/index.js | 25 +- blocks/build/page/index.js.map | 2 +- blocks/build/question/block.json | 2 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 29 +- blocks/build/question/index.js.map | 2 +- blocks/src/answer-option/block.json | 2 +- blocks/src/answer-option/edit.js | 1 + blocks/src/block.json | 4 +- blocks/src/edit.js | 243 +++++++++----- blocks/src/helper.js | 22 +- blocks/src/page/block.json | 2 +- blocks/src/question/block.json | 2 +- blocks/src/question/edit.js | 4 + mlw_quizmaster2.php | 23 +- php/admin/functions.php | 10 +- php/classes/class-qmn-quiz-creator.php | 42 +++ php/rest-api.php | 114 ------- 29 files changed, 797 insertions(+), 365 deletions(-) diff --git a/blocks/block.php b/blocks/block.php index 82e07002e..a4f8bf665 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -33,6 +33,9 @@ public function __construct() { add_action( 'init', array( $this, 'register_block' ) ); //Fires after block assets have been enqueued for the editing interface add_action( 'enqueue_block_editor_assets', array( $this, 'register_block_scripts' ) ); + + add_action( 'rest_api_init', array( $this, 'register_editor_rest_routes' ) ); + } /** @@ -138,7 +141,10 @@ public function register_block_scripts() { 'qsmBlockData', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), - 'nonce' => wp_create_nonce( 'qsm_nlock_quiz' ), + 'save_pages_action' => 'qsm_save_pages', + 'saveNonce' => wp_create_nonce( 'ajax-nonce-sandy-page' ),// save page + 'nonce' => wp_create_nonce( 'qsm_block_quiz' ), + 'qsm_new_quiz_nonce' => wp_create_nonce( 'qsm_new_quiz' ),//create quiz 'globalQuizsetting' => array_merge( $globalQuizsetting, array( @@ -195,10 +201,228 @@ public function qsm_block_render( $attributes, $content, $block ) { return $qmnQuizManager->display_shortcode( $attributes ); } + /** + * Render block like page, question, answer-option + */ public function render_block_content( $attributes, $content, $block ) { return $content; } + + /** + * Register REST APIs + */ + public function register_editor_rest_routes() { + if ( ! function_exists( 'register_rest_route' ) ) { + return; + } + + //get quiz structure data + register_rest_route( + 'quiz-survey-master/v1', + '/quiz/structure', + array( + 'methods' => WP_REST_Server::CREATABLE, + 'callback' => array( $this, 'qsm_quiz_structure_data' ), + 'permission_callback' => function () { + return current_user_can( 'edit_posts' ); + }, + ) + ); + + //create Quiz + register_rest_route( + 'quiz-survey-master/v1', + '/quiz/create_quiz', + array( + 'methods' => WP_REST_Server::CREATABLE, + 'callback' => array( $this, 'create_new_quiz_from_editor' ), + 'permission_callback' => function () { + return current_user_can( 'edit_posts' ); + }, + ) + ); + + //save pages and question order inside page : qsm_ajax_save_pages() + + } + + //get post id from quiz id + private function get_post_id_from_quiz_id( $quiz_id ) { + $post_ids = get_posts( array( + 'posts_per_page' => 1, + 'post_type' => 'qsm_quiz', + 'fields' => 'ids', + 'meta_query' => array( + array( + 'key' => 'quiz_id', + 'value' => $quiz_id, + 'compare' => '=', + ), + ), + ) ); + wp_reset_postdata(); + return ( empty( $post_ids ) || ! is_array( $post_ids ) )? 0 : $post_ids[0]; + } + + /** + * REST API + * Get quiz structural data i.e. details, pages, questions, attributes + * + * @param { integer } $_POST[quiz_id] + * + * @return { array } status and quiz details, pages, questions, attributes + * + */ + public function qsm_quiz_structure_data( WP_REST_Request $request ) { + + $result = array( + 'status' => 'error', + 'msg' => __( 'User not found', 'quiz-master-next' ), + ); + if ( ! is_user_logged_in() || ! function_exists( 'wp_get_current_user' ) || empty( wp_get_current_user() ) ) { + return $result; + } + + $quiz_id = isset( $request['quizID'] ) ? intval( $request['quizID'] ) : 0; + + if ( empty( $quiz_id ) && ! is_numeric( $quiz_id ) ) { + $result['msg'] = __( 'Invalid quiz id', 'quiz-master-next' ); + return $result; + } + + global $wpdb; + + + $quiz_data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_quizzes WHERE deleted = 0 AND quiz_id = %d ORDER BY quiz_id DESC", $quiz_id ), ARRAY_A ); + + if ( ! empty( $quiz_data ) ) { + $quiz_data[0]['post_id'] = $this->get_post_id_from_quiz_id( intval( $quiz_id ) ); + // Cycle through each quiz and retrieve all of quiz's questions. + foreach ( $quiz_data as $key => $quiz ) { + + $question_data = QSM_Questions::load_questions_by_pages( $quiz['quiz_id'] ); + $quiz_data[ $key ]['questions'] = $question_data; + + //unserialize quiz_settings + if ( ! empty( $quiz_data[ $key ]['quiz_settings'] ) ) { + $quiz_data[ $key ]['quiz_settings'] = maybe_unserialize( $quiz_data[ $key ]['quiz_settings'] ); + //unserialize pages + if ( ! empty( $quiz_data[ $key ]['quiz_settings']['qpages'] ) ) { + $quiz_data[ $key ]['qpages'] = maybe_unserialize( $quiz_data[ $key ]['quiz_settings']['qpages'] ); + if ( ! empty( $quiz_data[ $key ]['quiz_settings']['pages'] ) ) { + $quiz_data[ $key ]['pages'] = maybe_unserialize( $quiz_data[ $key ]['quiz_settings']['pages'] ); + //group question under individual pages + if ( is_array( $quiz_data[ $key ]['qpages'] ) ) { + foreach ( $quiz_data[ $key ]['qpages'] as $pageIndex => $page ) { + if ( ! empty( $page['questions'] ) && ! empty( $quiz_data[ $key ]['pages'][ $pageIndex ] ) ) { + $quiz_data[ $key ]['qpages'][$pageIndex]['question_arr'] = array(); + foreach ( $quiz_data[ $key ]['pages'][ $pageIndex ] as $qIndex => $q ) { + $quiz_data[ $key ]['qpages'][$pageIndex]['question_arr'][] = $quiz_data[ $key ]['questions'][$q]; + } + } + } + } + } + } + } + + // checking if logic is updated to tables + $logic_updated = get_option( 'logic_rules_quiz_' . $quiz['quiz_id'] ); + if ( $logic_updated ) { + $query = $wpdb->prepare( "SELECT logic FROM {$wpdb->prefix}mlw_logic where quiz_id = %d", $quiz['quiz_id'] ); + $logic_data = $wpdb->get_results( $query, ARRAY_N ); + $logics = array(); + if ( ! empty( $logic_data ) ) { + foreach ( $logic_data as $logic ) { + $logics[] = maybe_unserialize( $logic[0] ); + } + $serialized_logic = maybe_serialize( $logics ); + $quiz_data[ $key ]['logic'] = $serialized_logic; + } + } + + // get featured image of quiz if available + $qsm_featured_image = get_option( 'quiz_featured_image_' . $quiz['quiz_id'] ); + if ( $qsm_featured_image ) { + $quiz_data[ $key ]['featured_image'] = $qsm_featured_image; + } + + // get themes setting + $query = $wpdb->prepare( "SELECT A.theme, B.quiz_theme_settings, B.active_theme FROM {$wpdb->prefix}mlw_themes A, {$wpdb->prefix}mlw_quiz_theme_settings B where A.id = B.theme_id and B.quiz_id = %d", $quiz['quiz_id'] ); + $themes_data = $wpdb->get_results( $query, ARRAY_N ); + if ( ! empty( $themes_data ) ) { + $themes = array(); + foreach ( $themes_data as $data ) { + $themes[] = $data; + } + $serialized_themes = maybe_serialize( $themes ); + $quiz_data[ $key ]['themes'] = $serialized_themes; + } + } + return array( + 'status' => 'success', + 'result' => $quiz_data[0], + ); + + }else { + $result['msg'] = __( 'Quiz not found!', 'quiz-master-next' ); + return $result; + } + } + + /** + * REST API + * Create quiz using quiz name and other options + * + * + * @return { integer } quizID quiz id of newly created quiz + * + */ + public function create_new_quiz_from_editor( WP_REST_Request $request ) { + if ( empty( $_POST['quiz_name'] ) ) { + return array( + 'status' => 'error', + 'msg' => __( 'Missing Input', 'quiz-master-next' ), + 'post' => $_POST + ); + } + if ( function_exists( 'qsm_create_new_quiz_from_wizard' ) ) { + //create Quiz + qsm_create_new_quiz_from_wizard(); + global $mlwQuizMasterNext; + //get created quiz id + $quizID = $mlwQuizMasterNext->quizCreator->get_id(); + $quizPostID = $mlwQuizMasterNext->quizCreator->get_quiz_post_id(); + + if ( empty( $quizID ) ) { + return array( + 'status' => 'error', + 'msg' => __( 'Failed to create quiz.', 'quiz-master-next' ), + ); + } + + return array( + 'status' => 'success', + 'quizID' => $quizID, + 'quizPostID' => $quizPostID, + 'msg' => __( 'Quiz created successfully.', 'quiz-master-next' ), + ); + } + + return array( + 'status' => 'error', + 'msg' => __( 'Failed to create quiz. Function not found', 'quiz-master-next' ), + 'is_admin' => is_admin() + ); + } + } QSMBlock::get_instance(); } + +if ( ! function_exists( 'is_qsm_block_api_call' ) ) { + function is_qsm_block_api_call() { + return ! empty( $_POST['qsm_block_api_call'] ); + } +} diff --git a/blocks/build/answer-option/block.json b/blocks/build/answer-option/block.json index c6f25bbb3..dbc36a9af 100644 --- a/blocks/build/answer-option/block.json +++ b/blocks/build/answer-option/block.json @@ -8,7 +8,7 @@ "parent": [ "qsm/quiz-question" ], - "icon": "feedback", + "icon": "remove", "description": "QSM Quiz answer option", "attributes": { "optionID": { diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index de48ae5dc..306370753 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => 'e5c6fb3f75353889483d'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '2079a58810d02f1613a0'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index b33b58a87..047ba84cd 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -110,6 +110,7 @@ function Edit(props) { ...blockProps }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { tagName: "p", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer options', 'quiz-master-next'), "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question answer', 'quiz-master-next'), placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Your Answer', 'quiz-master-next'), value: content, @@ -150,9 +151,11 @@ function Edit(props) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, /* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, /* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; } +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; } /* harmony export */ }); //Check if undefined, null, empty const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; @@ -169,6 +172,25 @@ const qsmSanitizeName = name => { // Remove anchor tags from button text content. const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); +//prepare form data +const qsmFormData = (obj = false) => { + let newData = new FormData(); + newData.append('qsm_block_api_call', '1'); + if (false !== obj) { + for (let k in obj) { + if (obj.hasOwnProperty(k)) { + newData.append(k, obj[k]); + } + } + } + return newData; +}; +const qsmUniqid = (prefix = "", random = false) => { + const sec = Date.now() * 1000 + Math.random() * 1000; + const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); + return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; +}; + /***/ }), /***/ "@wordpress/api-fetch": @@ -267,7 +289,7 @@ module.exports = window["wp"]["i18n"]; \**************************************/ /***/ (function(module) { -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-answer-option","version":"0.1.0","title":"Answer Option","category":"widgets","parent":["qsm/quiz-question"],"icon":"feedback","description":"QSM Quiz answer option","attributes":{"optionID":{"type":"string","default":"0"},"content":{"type":"string","default":""},"points":{"type":"string","default":"0"},"isCorrect":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/questionID"],"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-answer-option","version":"0.1.0","title":"Answer Option","category":"widgets","parent":["qsm/quiz-question"],"icon":"remove","description":"QSM Quiz answer option","attributes":{"optionID":{"type":"string","default":"0"},"content":{"type":"string","default":""},"points":{"type":"string","default":"0"},"isCorrect":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/questionID"],"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); /***/ }) diff --git a/blocks/build/answer-option/index.js.map b/blocks/build/answer-option/index.js.map index 10350c53d..45362e5f7 100644 --- a/blocks/build/answer-option/index.js.map +++ b/blocks/build/answer-option/index.js.map @@ -1 +1 @@ -{"version":3,"file":"answer-option/index.js","mappings":";;;;;;;;;;;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UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCE,oEAAiB,CAAEC,6CAAa,EAAE;EACjCC,KAAKA,CAAElD,UAAU,EAAEmD,iBAAiB,EAAG;IACtC,OAAO;MACNtC,OAAO,EACN,CAAEb,UAAU,CAACa,OAAO,IAAI,EAAE,KACxBsC,iBAAiB,CAACtC,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACDuC,IAAI,EAAExD,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/answer-option/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/answer-option/index.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\nexport default function Edit( props ) {\n\t\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace,\nonRemove } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\tconst questionID = context['quiz-master-next/questionID'];\n\tconst name = 'qsm/quiz-answer-option';\n\tconst {\n\t\toptionID,\n\t\tcontent,\n\t\tpoints,\n\t\tisCorrect\n\t} = attributes;\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: '',\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = (html) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\t\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { points } ) }\n\t\t\t/>\n\t\t\t setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\n\t
\n\t\t setAttributes( { content: qsmStripTags( content ) } ) }\n\t\t\tonSplit={ ( value, isOriginal ) => {\n\t\t\t\tlet newAttributes;\n\n\t\t\t\tif ( isOriginal || value ) {\n\t\t\t\t\tnewAttributes = {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst block = createBlock( name, newAttributes );\n\n\t\t\t\tif ( isOriginal ) {\n\t\t\t\t\tblock.clientId = clientId;\n\t\t\t\t}\n\n\t\t\t\treturn block;\n\t\t\t} }\n\t\t\tonMerge={ mergeBlocks }\n\t\t\tonReplace={ onReplace }\n\t\t\tonRemove={ onRemove }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-answer-option' }\n\t\t\tidentifier='text'\n\t\t/>\n\t
\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit: Edit,\n} );\n"],"names":["__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","createBlock","qsmIsEmpty","qsmStripTags","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","mergeBlocks","onReplace","onRemove","quizID","pageID","questionID","name","optionID","content","points","isCorrect","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","Fragment","title","initialOpen","type","label","help","onChange","checked","tagName","placeholder","onSplit","isOriginal","newAttributes","block","onMerge","allowedFormats","withoutInteractiveFormatting","identifier","data","qsmSanitizeName","toLowerCase","replace","text","registerBlockType","metadata","merge","attributesToMerge","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"answer-option/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AACb;AAMX;AACwB;AACC;AACD;AAS1B;AACiB;AACK;AACtC,SAASuB,IAAIA,CAAEC,KAAK,EAAG;EAErC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,WAAW;IAAEC,SAAS;IACpGC;EAAS,CAAC,GAAGV,KAAK;EAEjB,MAAMW,MAAM,GAAGJ,OAAO,CAAC,yBAAyB,CAAC;EACjD,MAAMK,MAAM,GAAGL,OAAO,CAAC,yBAAyB,CAAC;EACjD,MAAMM,UAAU,GAAGN,OAAO,CAAC,6BAA6B,CAAC;EACzD,MAAMO,IAAI,GAAG,wBAAwB;EACrC,MAAM;IACLC,QAAQ;IACRC,OAAO;IACPC,MAAM;IACNC;EACD,CAAC,GAAGf,UAAU;;EAEd;EACAzB,6DAAS,CAAE,MAAM;IAChB,IAAIyC,gBAAgB,GAAG,IAAI;IAC3B,IAAKA,gBAAgB,EAAG,CAGxB;;IAEA;IACA,OAAO,MAAM;MACZA,gBAAgB,GAAG,KAAK;IACzB,CAAC;EAEF,CAAC,EAAE,CAAER,MAAM,CAAG,CAAC;EAEf,MAAMS,UAAU,GAAGrC,sEAAa,CAAE;IACjCmB,SAAS,EAAE;EACZ,CAAE,CAAC;;EAEH;EACA,MAAMmB,UAAU,GAAIC,IAAI,IAAK;IAC5B,IAAIC,GAAG,GAAGC,QAAQ,CAACC,aAAa,CAAC,UAAU,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;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCS,oEAAiB,CAAEC,6CAAa,EAAE;EACjCC,KAAKA,CAAEpE,UAAU,EAAEqE,iBAAiB,EAAG;IACtC,OAAO;MACNxD,OAAO,EACN,CAAEb,UAAU,CAACa,OAAO,IAAI,EAAE,KACxBwD,iBAAiB,CAACxD,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACDyD,IAAI,EAAE1E,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/answer-option/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/answer-option/index.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\nexport default function Edit( props ) {\n\t\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace,\nonRemove } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\tconst questionID = context['quiz-master-next/questionID'];\n\tconst name = 'qsm/quiz-answer-option';\n\tconst {\n\t\toptionID,\n\t\tcontent,\n\t\tpoints,\n\t\tisCorrect\n\t} = attributes;\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: '',\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = (html) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\t\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { points } ) }\n\t\t\t/>\n\t\t\t setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\n\t
\n\t\t setAttributes( { content: qsmStripTags( content ) } ) }\n\t\t\tonSplit={ ( value, isOriginal ) => {\n\t\t\t\tlet newAttributes;\n\n\t\t\t\tif ( isOriginal || value ) {\n\t\t\t\t\tnewAttributes = {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst block = createBlock( name, newAttributes );\n\n\t\t\t\tif ( isOriginal ) {\n\t\t\t\t\tblock.clientId = clientId;\n\t\t\t\t}\n\n\t\t\t\treturn block;\n\t\t\t} }\n\t\t\tonMerge={ mergeBlocks }\n\t\t\tonReplace={ onReplace }\n\t\t\tonRemove={ onRemove }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-answer-option' }\n\t\t\tidentifier='text'\n\t\t/>\n\t
\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit: Edit,\n} );\n"],"names":["__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","createBlock","qsmIsEmpty","qsmStripTags","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","mergeBlocks","onReplace","onRemove","quizID","pageID","questionID","name","optionID","content","points","isCorrect","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","Fragment","title","initialOpen","type","label","help","onChange","checked","tagName","placeholder","onSplit","isOriginal","newAttributes","block","onMerge","allowedFormats","withoutInteractiveFormatting","identifier","data","qsmSanitizeName","toLowerCase","replace","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","registerBlockType","metadata","merge","attributesToMerge","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/block.json b/blocks/build/block.json index 5afcaf659..e330bf261 100644 --- a/blocks/build/block.json +++ b/blocks/build/block.json @@ -5,8 +5,8 @@ "version": "0.1.0", "title": "QSM Quiz", "category": "widgets", - "icon": "feedback", - "description": "Easily and quickly add quizzes and surveys to your website.", + "icon": "vault", + "description": "Easily and quickly add quizzes and surveys inside the block editor.", "attributes": { "quizID": { "type": "string", diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 8f4d4c645..c9cf4c532 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '5c207d9bba4eae05e9c0'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '9cafe50c50a91a50ec41'); diff --git a/blocks/build/index.js b/blocks/build/index.js index 5d5a72bf4..07fc1a398 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -20,17 +20,14 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./helper */ "./src/helper.js"); - +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./helper */ "./src/helper.js"); @@ -53,67 +50,38 @@ function Edit(props) { isSelected, clientId } = props; - /* - " quiz_name": { - "type": "string", - "default": "" - }, - "quiz_featured_image": { - "type": "string", - "default": "" - }, - "form_type": { - "type": "string", - "default": "" - }, - "system": { - "type": "string", - "default": "" - }, - "timer_limit": { - "type": "string", - "default": "" - }, - "pagination": { - "type": "string", - "default": "" - }, - "enable_pagination_quiz": { - "type": "number", - "default": 0 - }, - "progress_bar": { - "type": "number", - "default": 0 - }, - "require_log_in": { - "type": "number", - "default": 0 - }, - "disable_first_page": { - "type": "number", - "default": 0 - }, - "comment_section": { - "type": "number", - "default": 1 - } - */ + const { + createNotice + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__.store); const { quizID } = attributes; + + //quiz attribute const [quizAttr, setQuizAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.globalQuizsetting); + //quiz list const [quizList, setQuizList] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.QSMQuizList); + //quiz list + const [quizMessage, setQuizMessage] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)({ + error: false, + msg: '' + }); + //weather creating a new quiz const [createQuiz, setCreateQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + //weather saving quiz const [saveQuiz, setSaveQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + //weather to show advance option const [showAdvanceOption, setShowAdvanceOption] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + //Quiz template on set Quiz ID const [quizTemplate, setQuizTemplate] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)([]); + //Quiz Options to create attributes label, description and layout const quizOptions = qsmBlockData.quizOptions; + /**Initialize block from server */ (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { let shouldSetQSMAttr = true; if (shouldSetQSMAttr) { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizID) && 0 < quizID && ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr) || (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr?.quizID) || quizID != quizAttr.quiz_id)) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizID) && 0 < quizID && ((0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr) || (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr?.quizID) || quizID != quizAttr.quiz_id)) { _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ path: '/quiz-survey-master/v1/quiz/structure', method: 'POST', @@ -128,16 +96,16 @@ function Edit(props) { ...quizAttr, ...result }); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(result.qpages)) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(result.qpages)) { let quizTemp = []; result.qpages.forEach(page => { let questions = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(page.question_arr)) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(page.question_arr)) { page.question_arr.forEach(question => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(question)) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(question)) { let answers = []; //answers options blocks - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(question.answers) && 0 < question.answers.length) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(question.answers) && 0 < question.answers.length) { question.answers.forEach((answer, aIndex) => { answers.push(['qsm/quiz-answer-option', { optionID: aIndex, @@ -196,48 +164,28 @@ function Edit(props) { shouldSetQSMAttr = false; }; }, [quizID]); - const feedbackIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg", - color: "#ffffff" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "2.75", - y: "3.75", - width: "18.5", - height: "16.5", - stroke: "#0EA489", - strokeWidth: "1.5" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "6", - y: "7", - width: "12", - height: "1", - fill: "#0EA489" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "6", - y: "11", - width: "12", - height: "1", - fill: "#0EA489" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "6", - y: "15", - width: "12", - height: "1", - fill: "#0EA489" - })) + + /** + * vault dash Icon + * @returns vault dash Icon + */ + const feedbackIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Icon, { + icon: "vault", + size: "36" }); + + /** + * + * @returns Placeholder for quiz in case quiz ID is not set + */ const quizPlaceholder = () => { - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Placeholder, { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Placeholder, { icon: feedbackIcon, - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz And Survey Master') - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizList) && 0 < quizList.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz And Survey Master', 'quiz-master-next'), + instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Easily and quickly add quizzes and surveys inside the block editor.', 'quiz-master-next') + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, !(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizList) && 0 < quizList.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { className: "qsm-placeholder-select-create-quiz" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.SelectControl, { label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('', 'quiz-master-next'), value: quizID, options: quizList, @@ -246,50 +194,58 @@ function Edit(props) { }), disabled: createQuiz, __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('OR', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('OR', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Button, { variant: "link", onClick: () => setCreateQuiz(!createQuiz) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New', 'quiz-master-next'))), ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizList) || createQuiz) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.__experimentalVStack, { + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New', 'quiz-master-next'))), ((0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizList) || createQuiz) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.__experimentalVStack, { spacing: "3", className: "qsm-placeholder-quiz-create-form" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextControl, { label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), value: quizAttr?.quiz_name || '', onChange: val => setQuizAttributes(val, 'quiz_name') - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Button, { variant: "link", onClick: () => setShowAdvanceOption(!showAdvanceOption) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance options', 'quiz-master-next')), showAdvanceOption && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance options', 'quiz-master-next')), showAdvanceOption && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.SelectControl, { label: quizOptions?.form_type?.label, value: quizAttr?.form_type, options: quizOptions?.form_type?.options, onChange: val => setQuizAttributes(val, 'form_type'), __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.SelectControl, { label: quizOptions?.system?.label, value: quizAttr?.system, options: quizOptions?.system?.options, onChange: val => setQuizAttributes(val, 'system'), help: quizOptions?.system?.help, __nextHasNoMarginBottom: true - }), ['timer_limit', 'pagination'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + }), ['timer_limit', 'pagination'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextControl, { + key: 'quiz-create-text-' + item, type: "number", label: quizOptions?.[item]?.label, help: quizOptions?.[item]?.help, - value: (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) ? 0 : quizAttr[item], + value: (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr[item]) ? 0 : quizAttr[item], onChange: val => setQuizAttributes(val, item) - })), ['enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { + })), ['enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.ToggleControl, { + key: 'quiz-create-toggle-' + item, label: quizOptions?.[item]?.label, help: quizOptions?.[item]?.help, - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item], - onChange: () => setQuizAttributes(!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item] ? 0 : 1, item) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item], + onChange: () => setQuizAttributes(!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item] ? 0 : 1, item) + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Button, { variant: "primary", - disabled: saveQuiz || (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr.quiz_name), + disabled: saveQuiz || (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr.quiz_name), onClick: () => createNewQuiz() }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Create Quiz', 'quiz-master-next'))))); }; + + /** + * Set attribute value + * @param { any } value attribute value to set + * @param { string } attr_name attribute name + */ const setQuizAttributes = (value, attr_name) => { let newAttr = quizAttr; newAttr[attr_name] = value; @@ -297,21 +253,137 @@ function Edit(props) { ...newAttr }); }; - const createNewQuiz = () => {}; + const createNewQuiz = () => { + if ((0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr.quiz_name)) { + console.log("empty quiz_name"); + return; + } + //save quiz status + setSaveQuiz(true); + // let quizData = { + // "quiz_name": quizAttr.quiz_name, + // "qsm_new_quiz_nonce": qsmBlockData.qsm_new_quiz_nonce + // }; + let quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmFormData)({ + 'quiz_name': quizAttr.quiz_name, + 'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce + }); + if (showAdvanceOption) { + ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => 'undefined' === typeof quizAttr[item] || null === quizAttr[item] ? '' : quizData.append(item, quizAttr[item])); + } + + //AJAX call + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/quiz/create_quiz', + method: 'POST', + body: quizData + }).then(res => { + console.log(res); + //save quiz status + setSaveQuiz(false); + if ('success' == res.status) { + //create a question + let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmFormData)({ + "id": null, + "quizID": res.quizID, + "type": "0", + "name": "", + "question_title": "", + "answerInfo": "", + "comments": "1", + "hint": "", + "category": "", + "required": 1, + "answers": [], + "page": 0 + }); + //AJAX call + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/questions', + method: 'POST', + body: newQuestion + }).then(response => { + console.log("question response", response); + if ('success' == response.status) { + let question_id = response.id; + + /**Page attributes required format */ + // pages[0][]: 2512 + // qpages[0][id]: 2 + // qpages[0][quizID]: 76 + // qpages[0][pagekey]: Ipj90nNT + // qpages[0][hide_prevbtn]: 0 + // qpages[0][questions][]: 2512 + // post_id: 111 + + let newPage = (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmFormData)({ + "action": qsmBlockData.save_pages_action, + "quiz_id": res.quizID, + "nonce": qsmBlockData.saveNonce, + "post_id": res.quizPostID + }); + newPage.append('pages[0][]', question_id); + newPage.append('qpages[0][id]', 1); + newPage.append('qpages[0][quizID]', res.quizID); + newPage.append('qpages[0][pagekey]', (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmUniqid)()); + newPage.append('qpages[0][hide_prevbtn]', 0); + newPage.append('qpages[0][questions][]', question_id); + + //create a page + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + url: qsmBlockData.ajax_url, + method: 'POST', + body: newPage + }).then(pageResponse => { + console.log("pageResponse", pageResponse); + if ('success' == pageResponse.status) { + //set new quiz ID + setAttributes({ + quizID: res.quizID + }); + } + }); + } + }).catch(error => { + console.log('error', error); + createNotice('error', error.message, { + isDismissible: true, + type: 'snackbar' + }); + }); + } + + //create notice + createNotice(res.status, res.msg, { + isDismissible: true, + type: 'snackbar' + }); + }).catch(error => { + console.log('error', error); + createNotice('error', error.message, { + isDismissible: true, + type: 'snackbar' + }); + }); + }; + + /** + * Inner Blocks + */ const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); const innerBlocksProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useInnerBlocksProps)(blockProps, { template: quizTemplate, allowedBlocks: ['qsm/quiz-page'] }); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.PanelBody, { title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz settings', 'quiz-master-next'), initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextControl, { label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), value: quizAttr?.quiz_name || '', onChange: val => setQuizAttributes(val, 'quiz_name') - }))), (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizID) || '0' == quizID ? quizPlaceholder() : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + }))), (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizID) || '0' == quizID ? quizPlaceholder() : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { ...innerBlocksProps })); } @@ -326,9 +398,11 @@ function Edit(props) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, /* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, /* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; } +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; } /* harmony export */ }); //Check if undefined, null, empty const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; @@ -345,6 +419,25 @@ const qsmSanitizeName = name => { // Remove anchor tags from button text content. const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); +//prepare form data +const qsmFormData = (obj = false) => { + let newData = new FormData(); + newData.append('qsm_block_api_call', '1'); + if (false !== obj) { + for (let k in obj) { + if (obj.hasOwnProperty(k)) { + newData.append(k, obj[k]); + } + } + } + return newData; +}; +const qsmUniqid = (prefix = "", random = false) => { + const sec = Date.now() * 1000 + Math.random() * 1000; + const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); + return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; +}; + /***/ }), /***/ "./src/index.js": @@ -438,16 +531,6 @@ module.exports = window["wp"]["components"]; /***/ }), -/***/ "@wordpress/core-data": -/*!**********************************!*\ - !*** external ["wp","coreData"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["coreData"]; - -/***/ }), - /***/ "@wordpress/data": /*!******************************!*\ !*** external ["wp","data"] ***! @@ -458,16 +541,6 @@ module.exports = window["wp"]["data"]; /***/ }), -/***/ "@wordpress/editor": -/*!********************************!*\ - !*** external ["wp","editor"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["editor"]; - -/***/ }), - /***/ "@wordpress/element": /*!*********************************!*\ !*** external ["wp","element"] ***! @@ -488,13 +561,23 @@ module.exports = window["wp"]["i18n"]; /***/ }), +/***/ "@wordpress/notices": +/*!*********************************!*\ + !*** external ["wp","notices"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["notices"]; + +/***/ }), + /***/ "./src/block.json": /*!************************!*\ !*** ./src/block.json ***! \************************/ /***/ (function(module) { -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz","version":"0.1.0","title":"QSM Quiz","category":"widgets","icon":"feedback","description":"Easily and quickly add quizzes and surveys to your website.","attributes":{"quizID":{"type":"string","default":"0"}},"providesContext":{"quiz-master-next/quizID":"quizID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz","version":"0.1.0","title":"QSM Quiz","category":"widgets","icon":"vault","description":"Easily and quickly add quizzes and surveys inside the block editor.","attributes":{"quizID":{"type":"string","default":"0"}},"providesContext":{"quiz-master-next/quizID":"quizID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); /***/ }) diff --git a/blocks/build/index.js.map b/blocks/build/index.js.map index 27f9a2144..86d37f264 100644 --- a/blocks/build/index.js.map +++ b/blocks/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AACb;AAMX;AACwB;AACC;AACD;AAa1B;AACR;AACe;AACvB,SAAS0B,IAAIA,CAAEC,KAAK,EAAG;EACrC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGN,KAAK;EAC5E;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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I;EACViI,IAAI,EAAEA;AACP,CAAE,CAAC;;;;;;;;;;;ACXH;;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;UAEA;UACA;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC,oHAAoH,iDAAiD;WACrK;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,8CAA8C;;WAE9C;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,iCAAiC,mCAAmC;WACpE;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA,2FAA2F,+CAA+C;UAC1I","sources":["webpack://qsm/./src/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/./src/index.js","webpack://qsm/./src/editor.scss","webpack://qsm/./src/style.scss","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/chunk loaded","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/webpack/runtime/jsonp chunk loading","webpack://qsm/webpack/before-startup","webpack://qsm/webpack/startup","webpack://qsm/webpack/after-startup"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tButton,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n\tPlaceholder,\n\tIcon,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport './editor.scss';\nimport { qsmIsEmpty } from './helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId } = props;\n\t/*\n\t\"\tquiz_name\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"quiz_featured_image\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"form_type\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"system\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"timer_limit\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"pagination\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"enable_pagination_quiz\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"progress_bar\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"require_log_in\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"disable_first_page\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"comment_section\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 1\n\t\t}\n\t*/\n\tconst {\n\t\tquizID \n\t} = attributes;\n\n\tconst [ quizAttr, setQuizAttr ] = useState( qsmBlockData.globalQuizsetting );\n\tconst [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList );\n\tconst [ createQuiz, setCreateQuiz ] = useState( false );\n\tconst [ saveQuiz, setSaveQuiz ] = useState( false );\n\tconst [ showAdvanceOption, setShowAdvanceOption ] = useState( false );\n\tconst [ quizTemplate, setQuizTemplate ] = useState( [] );\n\tconst quizOptions = qsmBlockData.quizOptions;\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\tif ( ! qsmIsEmpty( quizID ) && 0 < quizID && ( qsmIsEmpty( quizAttr ) || qsmIsEmpty( quizAttr?.quizID ) || quizID != quizAttr.quiz_id ) ) {\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/quiz/structure',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: { quizID: quizID },\n\t\t\t\t} ).then( ( res ) => {\n\t\t\t\t\tconsole.log( res );\n\t\t\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t\t\tlet result = res.result;\n\t\t\t\t\t\tsetQuizAttr( {\n\t\t\t\t\t\t\t...quizAttr,\n\t\t\t\t\t\t\t...result\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( ! qsmIsEmpty( result.qpages ) ) {\n\t\t\t\t\t\t\tlet quizTemp = [];\n\t\t\t\t\t\t\tresult.qpages.forEach( page => {\n\t\t\t\t\t\t\t\tlet questions = [];\n\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( page.question_arr ) ) {\n\t\t\t\t\t\t\t\t\tpage.question_arr.forEach( question => {\n\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question ) ) {\n\t\t\t\t\t\t\t\t\t\t\tlet answers = [];\n\t\t\t\t\t\t\t\t\t\t\t//answers options blocks\n\t\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tquestion.answers.forEach( ( answer, aIndex ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-answer-option',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptionID:aIndex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontent:answer[0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoints:answer[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect:answer[2]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t//question blocks\n\t\t\t\t\t\t\t\t\t\t\tquestions.push(\n\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-question',\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquestionID: question.question_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: question.question_type_new,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswerEditor: question.settings.answerEditor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: question.settings.question_title,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: question.question_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: question.settings.required,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thint:question.hints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswers: question.answers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcorrectAnswerInfo:question.question_answer_info,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcategory:question.category,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmulticategories:question.multicategories,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcommentBox: question.comments,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatchAnswer: question.settings.matchAnswer,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageID: question.settings.featureImageID,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageSrc: question.settings.featureImageSrc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings: question.settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers\n\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//console.log(\"page\",page);\n\t\t\t\t\t\t\t\tquizTemp.push(\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'qsm/quiz-page',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpageID:page.id,\n\t\t\t\t\t\t\t\t\t\t\tpageKey: page.pagekey,\n\t\t\t\t\t\t\t\t\t\t\thidePrevBtn: page.hide_prevbtn,\n\t\t\t\t\t\t\t\t\t\t\tquizID: page.quizID\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tquestions\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsetQuizTemplate( quizTemp );\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// QSM_QUIZ = [\n\t\t\t\t\t\t// \t[\n\n\t\t\t\t\t\t// \t]\n\t\t\t\t\t\t// ];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log( \"error \"+ res.msg );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\t\n\tconst feedbackIcon = () => (\n\t (\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t)\n\t\t\t}\n\t/>\n\t);\n\tconst quizPlaceholder = ( ) => {\n\t\treturn (\n\t\t\t\n\t\t\t\t{\n\t\t\t\t\t<>\n\t\t\t\t\t{ ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& \n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( { quizID } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdisabled={ createQuiz }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t\t{ __( 'OR', 'quiz-master-next' ) }\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t}\n\t\t\t\t\t{ ( qsmIsEmpty( quizList ) || createQuiz ) &&\n\t\t\t\t\t\n\t\t\t\t\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ showAdvanceOption && (<>\n\t\t\t\t\t\t\t{/**Form Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'form_type') }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{/**Grading Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'system') }\n\t\t\t\t\t\t\t\thelp={ quizOptions?.system?.help }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'timer_limit', \n\t\t\t\t\t\t\t\t\t'pagination',\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t\t setQuizAttributes( val, item) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'enable_contact_form', \n\t\t\t\t\t\t\t\t\t'enable_pagination_quiz', \n\t\t\t\t\t\t\t\t\t'show_question_featured_image_in_result',\n\t\t\t\t\t\t\t\t\t'progress_bar',\n\t\t\t\t\t\t\t\t\t'require_log_in',\n\t\t\t\t\t\t\t\t\t'disable_first_page',\n\t\t\t\t\t\t\t\t\t'comment_section'\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t setQuizAttributes( ( ( ! qsmIsEmpty( quizAttr[item] ) && '1' == quizAttr[item] ) ? 0 : 1 ), item ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t }\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t);\n\t};\n\n\tconst setQuizAttributes = ( value , attr_name ) => {\n\t\tlet newAttr = quizAttr;\n\t\tnewAttr[ attr_name ] = value;\n\t\tsetQuizAttr( { ...newAttr } );\n\t}\n\n\tconst createNewQuiz = () => {\n\n\t}\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: quizTemplate,\n\t\tallowedBlocks : [\n\t\t\t'qsm/quiz-page'\n\t\t]\n\t} );\n\t\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t/>\n\t\t\n\t\n\t{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? \n quizPlaceholder() \n\t:\n\t
\n\t}\n\t\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );","import { registerBlockType } from '@wordpress/blocks';\nimport './style.scss';\nimport Edit from './edit';\nimport metadata from './block.json';\nconst save = ( props ) => null;\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n\tsave: save,\n} );\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkqsm\"] = self[\"webpackChunkqsm\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], function() { return __webpack_require__(\"./src/index.js\"); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","useInnerBlocksProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","Button","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Placeholder","Icon","__experimentalVStack","VStack","qsmIsEmpty","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","quizID","quizAttr","setQuizAttr","globalQuizsetting","quizList","setQuizList","QSMQuizList","createQuiz","setCreateQuiz","saveQuiz","setSaveQuiz","showAdvanceOption","setShowAdvanceOption","quizTemplate","setQuizTemplate","quizOptions","shouldSetQSMAttr","quiz_id","path","method","data","then","res","console","log","status","result","qpages","quizTemp","forEach","page","questions","question_arr","question","answers","length","answer","aIndex","push","optionID","content","points","isCorrect","questionID","question_id","type","question_type_new","answerEditor","settings","title","question_title","description","question_name","required","hint","hints","correctAnswerInfo","question_answer_info","category","multicategories","commentBox","comments","matchAnswer","featureImageID","featureImageSrc","pageID","id","pageKey","pagekey","hidePrevBtn","hide_prevbtn","msg","feedbackIcon","createElement","icon","width","height","viewBox","fill","xmlns","color","x","y","stroke","strokeWidth","quizPlaceholder","label","Fragment","value","options","onChange","disabled","__nextHasNoMarginBottom","variant","onClick","spacing","help","quiz_name","val","setQuizAttributes","form_type","system","map","item","checked","createNewQuiz","attr_name","newAttr","blockProps","innerBlocksProps","template","allowedBlocks","initialOpen","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","registerBlockType","metadata","save","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AACb;AAMX;AAC0B;AACF;AAa1B;AACR;AACuC;AAC/C,SAAS2B,IAAIA,CAAEC,KAAK,EAAG;EACrC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGN,KAAK;EAC5E,MAAM;IAAEO;EAAa,CAAC,GAAGzB,4DAAW,CAAED,qDAAa,CAAC;EACpD,MAAM;IACL2B;EACD,CAAC,GAAGL,UAAU;;EAEd;EACA,MAAM,CAAEM,QAAQ,EAAEC,WAAW,CAAE,GAAGrC,4DAAQ,CAAE4B,YAAY,CAACU,iBAAkB,CAAC;EAC5E;EACA,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAGxC,4DAAQ,CAAE4B,YAAY,CAACa,WAAY,C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AiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCE,IAAI,EAAE7J,6CAAI;EACV4J,IAAI,EAAEA;AACP,CAAE,CAAC;;;;;;;;;;;ACXH;;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;UAEA;UACA;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC,oHAAoH,iDAAiD;WACrK;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,8CAA8C;;WAE9C;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,iCAAiC,mCAAmC;WACpE;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA,2FAA2F,+CAA+C;UAC1I","sources":["webpack://qsm/./src/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/./src/index.js","webpack://qsm/./src/editor.scss","webpack://qsm/./src/style.scss","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/chunk loaded","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/webpack/runtime/jsonp chunk loading","webpack://qsm/webpack/before-startup","webpack://qsm/webpack/startup","webpack://qsm/webpack/after-startup"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tButton,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n\tPlaceholder,\n\tIcon,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport './editor.scss';\nimport { qsmIsEmpty, qsmFormData, qsmUniqid } from './helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId } = props;\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tquizID \n\t} = attributes;\n\n\t//quiz attribute\n\tconst [ quizAttr, setQuizAttr ] = useState( qsmBlockData.globalQuizsetting );\n\t//quiz list\n\tconst [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList );\n\t//quiz list\n\tconst [ quizMessage, setQuizMessage ] = useState( {\n\t\terror: false,\n\t\tmsg: ''\n\t} );\n\t//weather creating a new quiz\n\tconst [ createQuiz, setCreateQuiz ] = useState( false );\n\t//weather saving quiz\n\tconst [ saveQuiz, setSaveQuiz ] = useState( false );\n\t//weather to show advance option\n\tconst [ showAdvanceOption, setShowAdvanceOption ] = useState( false );\n\t//Quiz template on set Quiz ID\n\tconst [ quizTemplate, setQuizTemplate ] = useState( [] );\n\t//Quiz Options to create attributes label, description and layout\n\tconst quizOptions = qsmBlockData.quizOptions;\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\tif ( ! qsmIsEmpty( quizID ) && 0 < quizID && ( qsmIsEmpty( quizAttr ) || qsmIsEmpty( quizAttr?.quizID ) || quizID != quizAttr.quiz_id ) ) {\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/quiz/structure',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: { quizID: quizID },\n\t\t\t\t} ).then( ( res ) => {\n\t\t\t\t\tconsole.log( res );\n\t\t\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t\t\tlet result = res.result;\n\t\t\t\t\t\tsetQuizAttr( {\n\t\t\t\t\t\t\t...quizAttr,\n\t\t\t\t\t\t\t...result\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( ! qsmIsEmpty( result.qpages ) ) {\n\t\t\t\t\t\t\tlet quizTemp = [];\n\t\t\t\t\t\t\tresult.qpages.forEach( page => {\n\t\t\t\t\t\t\t\tlet questions = [];\n\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( page.question_arr ) ) {\n\t\t\t\t\t\t\t\t\tpage.question_arr.forEach( question => {\n\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question ) ) {\n\t\t\t\t\t\t\t\t\t\t\tlet answers = [];\n\t\t\t\t\t\t\t\t\t\t\t//answers options blocks\n\t\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tquestion.answers.forEach( ( answer, aIndex ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-answer-option',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptionID:aIndex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontent:answer[0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoints:answer[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect:answer[2]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t//question blocks\n\t\t\t\t\t\t\t\t\t\t\tquestions.push(\n\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-question',\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquestionID: question.question_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: question.question_type_new,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswerEditor: question.settings.answerEditor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: question.settings.question_title,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: question.question_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: question.settings.required,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thint:question.hints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswers: question.answers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcorrectAnswerInfo:question.question_answer_info,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcategory:question.category,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmulticategories:question.multicategories,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcommentBox: question.comments,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatchAnswer: question.settings.matchAnswer,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageID: question.settings.featureImageID,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageSrc: question.settings.featureImageSrc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings: question.settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers\n\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//console.log(\"page\",page);\n\t\t\t\t\t\t\t\tquizTemp.push(\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'qsm/quiz-page',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpageID:page.id,\n\t\t\t\t\t\t\t\t\t\t\tpageKey: page.pagekey,\n\t\t\t\t\t\t\t\t\t\t\thidePrevBtn: page.hide_prevbtn,\n\t\t\t\t\t\t\t\t\t\t\tquizID: page.quizID\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tquestions\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsetQuizTemplate( quizTemp );\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// QSM_QUIZ = [\n\t\t\t\t\t\t// \t[\n\n\t\t\t\t\t\t// \t]\n\t\t\t\t\t\t// ];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log( \"error \"+ res.msg );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\t/**\n\t * vault dash Icon\n\t * @returns vault dash Icon\n\t */\n\tconst feedbackIcon = () => (\n\t\n\t);\n\n\t/**\n\t * \n\t * @returns Placeholder for quiz in case quiz ID is not set\n\t */\n\tconst quizPlaceholder = ( ) => {\n\t\treturn (\n\t\t\t\n\t\t\t\t{\n\t\t\t\t\t<>\n\t\t\t\t\t{ ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& \n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( { quizID } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdisabled={ createQuiz }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t\t{ __( 'OR', 'quiz-master-next' ) }\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t}\n\t\t\t\t\t{ ( qsmIsEmpty( quizList ) || createQuiz ) &&\n\t\t\t\t\t\n\t\t\t\t\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ showAdvanceOption && (<>\n\t\t\t\t\t\t\t{/**Form Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'form_type') }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{/**Grading Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'system') }\n\t\t\t\t\t\t\t\thelp={ quizOptions?.system?.help }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'timer_limit', \n\t\t\t\t\t\t\t\t\t'pagination',\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t\t setQuizAttributes( val, item) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'enable_contact_form', \n\t\t\t\t\t\t\t\t\t'enable_pagination_quiz', \n\t\t\t\t\t\t\t\t\t'show_question_featured_image_in_result',\n\t\t\t\t\t\t\t\t\t'progress_bar',\n\t\t\t\t\t\t\t\t\t'require_log_in',\n\t\t\t\t\t\t\t\t\t'disable_first_page',\n\t\t\t\t\t\t\t\t\t'comment_section'\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t setQuizAttributes( ( ( ! qsmIsEmpty( quizAttr[item] ) && '1' == quizAttr[item] ) ? 0 : 1 ), item ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t }\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t);\n\t};\n\n\t/**\n\t * Set attribute value\n\t * @param { any } value attribute value to set\n\t * @param { string } attr_name attribute name\n\t */\n\tconst setQuizAttributes = ( value , attr_name ) => {\n\t\tlet newAttr = quizAttr;\n\t\tnewAttr[ attr_name ] = value;\n\t\tsetQuizAttr( { ...newAttr } );\n\t}\n\n\tconst createNewQuiz = () => {\n\t\tif ( qsmIsEmpty( quizAttr.quiz_name ) ) {\n\t\t\tconsole.log(\"empty quiz_name\");\n\t\t\treturn;\n\t\t}\n\t\t//save quiz status\n\t\tsetSaveQuiz( true );\n\t\t// let quizData = {\n\t\t// \t\"quiz_name\": quizAttr.quiz_name,\n\t\t// \t\"qsm_new_quiz_nonce\": qsmBlockData.qsm_new_quiz_nonce\n\t\t// };\n\t\tlet quizData = qsmFormData({\n\t\t\t'quiz_name': quizAttr.quiz_name,\n\t\t\t'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce\n\t\t});\n\t\t\n\t\tif ( showAdvanceOption ) {\n\t\t\t['form_type', \n\t\t\t'system', \n\t\t\t'timer_limit', \n\t\t\t'pagination',\n\t\t\t'enable_contact_form', \n\t\t\t'enable_pagination_quiz', \n\t\t\t'show_question_featured_image_in_result',\n\t\t\t'progress_bar',\n\t\t\t'require_log_in',\n\t\t\t'disable_first_page',\n\t\t\t'comment_section'\n\t\t\t].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) );\n\t\t}\n\n\t\t//AJAX call\n\t\tapiFetch( {\n\t\t\tpath: '/quiz-survey-master/v1/quiz/create_quiz',\n\t\t\tmethod: 'POST',\n\t\t\tbody: quizData\n\t\t} ).then( ( res ) => {\n\t\t\tconsole.log( res );\n\t\t\t//save quiz status\n\t\t\tsetSaveQuiz( false );\n\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t//create a question\n\t\t\t\tlet newQuestion = qsmFormData( {\n\t\t\t\t\t\"id\": null,\n\t\t\t\t\t\"quizID\": res.quizID,\n\t\t\t\t\t\"type\": \"0\",\n\t\t\t\t\t\"name\": \"\",\n\t\t\t\t\t\"question_title\": \"\",\n\t\t\t\t\t\"answerInfo\": \"\",\n\t\t\t\t\t\"comments\": \"1\",\n\t\t\t\t\t\"hint\": \"\",\n\t\t\t\t\t\"category\": \"\",\n\t\t\t\t\t\"required\": 1,\n\t\t\t\t\t\"answers\": [],\n\t\t\t\t\t\"page\": 0\n\t\t\t\t} );\n\t\t\t\t//AJAX call\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: newQuestion\n\t\t\t\t} ).then( ( response ) => {\n\t\t\t\t\tconsole.log(\"question response\", response);\n\t\t\t\t\tif ( 'success' == response.status ) {\n\t\t\t\t\t\tlet question_id = response.id;\n\n\t\t\t\t\t\t/**Page attributes required format */\n\t\t\t\t\t\t// pages[0][]: 2512\n\t\t\t\t\t\t// \tqpages[0][id]: 2\n\t\t\t\t\t\t// \tqpages[0][quizID]: 76\n\t\t\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\n\t\t\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\n\t\t\t\t\t\t// \tqpages[0][questions][]: 2512\n\t\t\t\t\t\t// \tpost_id: 111\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet newPage = qsmFormData( {\n\t\t\t\t\t\t\t\"action\": qsmBlockData.save_pages_action,\n\t\t\t\t\t\t\t\"quiz_id\": res.quizID,\n\t\t\t\t\t\t\t\"nonce\": qsmBlockData.saveNonce,\n\t\t\t\t\t\t\t\"post_id\": res.quizPostID,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tnewPage.append( 'pages[0][]', question_id );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][id]', 1 );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][quizID]', res.quizID );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][pagekey]', qsmUniqid() );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][hide_prevbtn]', 0 );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][questions][]', question_id );\n\n\n\t\t\t\t\t\t//create a page\n\t\t\t\t\t\tapiFetch( {\n\t\t\t\t\t\t\turl: qsmBlockData.ajax_url,\n\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\tbody: newPage\n\t\t\t\t\t\t} ).then( ( pageResponse ) => {\n\t\t\t\t\t\t\tconsole.log(\"pageResponse\", pageResponse);\n\t\t\t\t\t\t\tif ( 'success' == pageResponse.status ) {\n\t\t\t\t\t\t\t\t//set new quiz ID\n\t\t\t\t\t\t\t\tsetAttributes( { quizID: res.quizID } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}).catch(\n\t\t\t\t\t( error ) => {\n\t\t\t\t\t\tconsole.log( 'error',error );\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\n\t\t\t\t\t\t\tisDismissible: true,\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t\n\t\t\t} \n\n\t\t\t//create notice\n\t\t\tcreateNotice( res.status, res.msg, {\n\t\t\t\tisDismissible: true,\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} ).catch(\n\t\t\t( error ) => {\n\t\t\t\tconsole.log( 'error',error );\n\t\t\t\tcreateNotice( 'error', error.message, {\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\t \n\t}\n\n\t/**\n\t * Inner Blocks\n\t */\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: quizTemplate,\n\t\tallowedBlocks : [\n\t\t\t'qsm/quiz-page'\n\t\t]\n\t} );\n\t\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t/>\n\t\t\n\t\n\t{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? \n quizPlaceholder() \n\t:\n\t
\n\t}\n\t\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};","import { registerBlockType } from '@wordpress/blocks';\nimport './style.scss';\nimport Edit from './edit';\nimport metadata from './block.json';\nconst save = ( props ) => null;\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n\tsave: save,\n} );\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkqsm\"] = self[\"webpackChunkqsm\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], function() { return __webpack_require__(\"./src/index.js\"); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","useInnerBlocksProps","store","noticesStore","useDispatch","useSelect","PanelBody","Button","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Placeholder","Icon","__experimentalVStack","VStack","qsmIsEmpty","qsmFormData","qsmUniqid","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","createNotice","quizID","quizAttr","setQuizAttr","globalQuizsetting","quizList","setQuizList","QSMQuizList","quizMessage","setQuizMessage","error","msg","createQuiz","setCreateQuiz","saveQuiz","setSaveQuiz","showAdvanceOption","setShowAdvanceOption","quizTemplate","setQuizTemplate","quizOptions","shouldSetQSMAttr","quiz_id","path","method","data","then","res","console","log","status","result","qpages","quizTemp","forEach","page","questions","question_arr","question","answers","length","answer","aIndex","push","optionID","content","points","isCorrect","questionID","question_id","type","question_type_new","answerEditor","settings","title","question_title","description","question_name","required","hint","hints","correctAnswerInfo","question_answer_info","category","multicategories","commentBox","comments","matchAnswer","featureImageID","featureImageSrc","pageID","id","pageKey","pagekey","hidePrevBtn","hide_prevbtn","feedbackIcon","createElement","icon","size","quizPlaceholder","label","instructions","Fragment","value","options","onChange","disabled","__nextHasNoMarginBottom","variant","onClick","spacing","help","quiz_name","val","setQuizAttributes","form_type","system","map","item","key","checked","createNewQuiz","attr_name","newAttr","quizData","qsm_new_quiz_nonce","append","body","newQuestion","response","newPage","save_pages_action","saveNonce","quizPostID","url","ajax_url","pageResponse","catch","message","isDismissible","blockProps","innerBlocksProps","template","allowedBlocks","initialOpen","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","obj","newData","FormData","k","hasOwnProperty","prefix","random","sec","Date","now","Math","toString","padEnd","trunc","registerBlockType","metadata","save","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/page/block.json b/blocks/build/page/block.json index 754fe0e3d..a839d2a2b 100644 --- a/blocks/build/page/block.json +++ b/blocks/build/page/block.json @@ -8,7 +8,7 @@ "parent": [ "qsm/quiz" ], - "icon": "feedback", + "icon": "text-page", "description": "QSM Quiz Page", "attributes": { "pageID": { diff --git a/blocks/build/page/index.asset.php b/blocks/build/page/index.asset.php index dd5c6c060..2bbb93bf5 100644 --- a/blocks/build/page/index.asset.php +++ b/blocks/build/page/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'd24b88e85555402d01c5'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '1539da1fe8c77d325d58'); diff --git a/blocks/build/page/index.js b/blocks/build/page/index.js index 8d8aef49a..35a00e2a4 100644 --- a/blocks/build/page/index.js +++ b/blocks/build/page/index.js @@ -10,9 +10,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, /* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, /* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; } +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; } /* harmony export */ }); //Check if undefined, null, empty const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; @@ -29,6 +31,25 @@ const qsmSanitizeName = name => { // Remove anchor tags from button text content. const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); +//prepare form data +const qsmFormData = (obj = false) => { + let newData = new FormData(); + newData.append('qsm_block_api_call', '1'); + if (false !== obj) { + for (let k in obj) { + if (obj.hasOwnProperty(k)) { + newData.append(k, obj[k]); + } + } + } + return newData; +}; +const qsmUniqid = (prefix = "", random = false) => { + const sec = Date.now() * 1000 + Math.random() * 1000; + const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); + return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; +}; + /***/ }), /***/ "./src/page/edit.js": @@ -183,7 +204,7 @@ module.exports = window["wp"]["i18n"]; \*****************************/ /***/ (function(module) { -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-page","version":"0.1.0","title":"Page","category":"widgets","parent":["qsm/quiz"],"icon":"feedback","description":"QSM Quiz Page","attributes":{"pageID":{"type":"string","default":"0"},"pageKey":{"type":"string","default":""},"hidePrevBtn":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID"],"providesContext":{"quiz-master-next/pageID":"pageID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-page","version":"0.1.0","title":"Page","category":"widgets","parent":["qsm/quiz"],"icon":"text-page","description":"QSM Quiz Page","attributes":{"pageID":{"type":"string","default":"0"},"pageKey":{"type":"string","default":""},"hidePrevBtn":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID"],"providesContext":{"quiz-master-next/pageID":"pageID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); /***/ }) diff --git a/blocks/build/page/index.js.map b/blocks/build/page/index.js.map index 907bb0c65..adc2063e8 100644 --- a/blocks/build/page/index.js.map +++ b/blocks/build/page/index.js.map @@ -1 +1 @@ -{"version":3,"file":"page/index.js","mappings":";;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;AAE9F,MAAMC,eAAe,GAAKC,IAAI,IAAM;EAC1C,IAAKH,UAAU,CAAEG,IAAK,CAAC,EAAG;IACzBA,IAAI,GAAG,EAAE;EACV,CAAC,MAAM;IACNA,IAAI,GAAGA,IAAI,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,IAAI,EAAE,GAAI,CAAC;IAC9CF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAC/B;EAEA,OAAOF,IAAI;AACZ,CAAC;;AAED;AACO,MAAMG,YAAY,GAAKC,IAAI,IAAMA,IAAI,CAACF,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;ACfrC;AACoB;AACb;AAKX;AASF;AACQ;AACxB,SAASiB,IAAIA,CAAEC,KAAK,EAAG;EACrC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGP,KAAK;EAErF,MAAMQ,MAAM,GAAGD,OAAO,CAAC,yBAAyB,CAAC;EAEjD,MAAM;IACLE,MAAM;IACNC,OAAO;IACPC;EACD,CAAC,GAAGR,UAAU;EAEd,MAAM,CAAES,WAAW,EAAEC,cAAc,CAAE,GAAG3B,4DAAQ,CA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;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCC,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAE7B,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/page/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/page/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty } from '../helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\t\n\tconst {\n\t\tpageID,\n\t\tpageKey,\n\t\thidePrevBtn,\n\t} = attributes;\n\n\tconst [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting );\n\t\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\t\t\t//console.log(\"attr\",attributes);\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { pageKey } ) }\n\t\t\t/>\n\t\t\t setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\t\n\t\n\t
\n\t\t\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","quizID","pageID","pageKey","hidePrevBtn","qsmPageAttr","setQsmPageAttr","globalQuizsetting","shouldSetQSMAttr","blockProps","createElement","Fragment","title","initialOpen","label","value","onChange","checked","allowedBlocks","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"page/index.js","mappings":";;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;AAE9F,MAAMC,eAAe,GAAKC,IAAI,IAAM;EAC1C,IAAKH,UAAU,CAAEG,IAAK,CAAC,EAAG;IACzBA,IAAI,GAAG,EAAE;EACV,CAAC,MAAM;IACNA,IAAI,GAAGA,IAAI,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,IAAI,EAAE,GAAI,CAAC;IAC9CF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAC/B;EAEA,OAAOF,IAAI;AACZ,CAAC;;AAED;AACO,MAAMG,YAAY,GAAKC,IAAI,IAAMA,IAAI,CAACF,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;;AAE1E;AACO,MAAMG,WAAW,GAAGA,CAAEC,GAAG,GAAG,KAAK,KAAM;EAC7C,IAAIC,OAAO,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAC5BD,OAAO,CAACE,MAAM,CAAC,oBAAoB,EAAE,GAAG,CAAC;EACzC,IAAK,KAAK,KAAKH,GAAG,EAAG;IACpB,KAAM,IAAII,CAAC,IAAIJ,GAAG,EAAG;MACpB,IAAKA,GAAG,CAACK,cAAc,CAAED,CAAE,CAAC,EAAG;QAC5BH,OAAO,CAACE,MAAM,CAAEC,CAAC,EAAEJ,GAAG,CAACI,CAAC,CAAE,CAAC;MAC9B;IACD;EACD;EACA,OAAOH,OAAO;AACf,CAAC;AAEM,MAAMK,SAAS,GAAGA,CAACC,MAAM,GA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ACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCC,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAE7B,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/page/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/page/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty } from '../helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\t\n\tconst {\n\t\tpageID,\n\t\tpageKey,\n\t\thidePrevBtn,\n\t} = attributes;\n\n\tconst [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting );\n\t\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\t\t\t//console.log(\"attr\",attributes);\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { pageKey } ) }\n\t\t\t/>\n\t\t\t setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\t\n\t\n\t
\n\t\t\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","quizID","pageID","pageKey","hidePrevBtn","qsmPageAttr","setQsmPageAttr","globalQuizsetting","shouldSetQSMAttr","blockProps","createElement","Fragment","title","initialOpen","label","value","onChange","checked","allowedBlocks","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/question/block.json b/blocks/build/question/block.json index 46b3e66c0..456d7d8ca 100644 --- a/blocks/build/question/block.json +++ b/blocks/build/question/block.json @@ -8,7 +8,7 @@ "parent": [ "qsm/quiz-page" ], - "icon": "feedback", + "icon": "move", "description": "QSM Quiz Question", "attributes": { "questionID": { diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php index 5dc25b0a3..455f59020 100644 --- a/blocks/build/question/index.asset.php +++ b/blocks/build/question/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => 'e24fa8eab73b21b3b2c2'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '06faf5faf439152da8ef'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index f4c10f2df..6cd6b44b0 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -10,9 +10,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, /* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, /* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; } +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; } /* harmony export */ }); //Check if undefined, null, empty const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; @@ -29,6 +31,25 @@ const qsmSanitizeName = name => { // Remove anchor tags from button text content. const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); +//prepare form data +const qsmFormData = (obj = false) => { + let newData = new FormData(); + newData.append('qsm_block_api_call', '1'); + if (false !== obj) { + for (let k in obj) { + if (obj.hasOwnProperty(k)) { + newData.append(k, obj[k]); + } + } + } + return newData; +}; +const qsmUniqid = (prefix = "", random = false) => { + const sec = Date.now() * 1000 + Math.random() * 1000; + const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); + return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; +}; + /***/ }), /***/ "./src/question/edit.js": @@ -176,6 +197,7 @@ function Edit(props) { ...blockProps }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { tagName: "h4", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Type your question here', 'quiz-master-next'), value: title, @@ -187,6 +209,7 @@ function Edit(props) { className: 'qsm-question-title' }), isParentOfSelectedBlock && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { tagName: "p", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Description goes here', 'quiz-master-next'), value: decodeHtml(description), @@ -201,6 +224,7 @@ function Edit(props) { template: QUESTION_TEMPLATE }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { tagName: "p", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct answer info goes here', 'quiz-master-next'), value: decodeHtml(correctAnswerInfo), @@ -212,6 +236,7 @@ function Edit(props) { __unstableAllowPrefixTransformations: true }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { tagName: "p", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hint', 'quiz-master-next'), "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hint', 'quiz-master-next'), placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('hint goes here', 'quiz-master-next'), value: hint, @@ -322,7 +347,7 @@ module.exports = window["wp"]["i18n"]; \*********************************/ /***/ (function(module) { -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-question","version":"0.1.0","title":"Question","category":"widgets","parent":["qsm/quiz-page"],"icon":"feedback","description":"QSM Quiz Question","attributes":{"questionID":{"type":"string","default":"0"},"type":{"type":"string","default":"0"},"description":{"type":"string","source":"html","selector":"p","default":""},"title":{"type":"string","default":""},"correctAnswerInfo":{"type":"string","source":"html","selector":"p","default":""},"commentBox":{"type":"string","default":"0"},"category":{"type":"number"},"multicategories":{"type":"array"},"hint":{"type":"string"},"featureImageID":{"type":"number"},"featureImageSrc":{"type":"string"},"answers":{"type":"array"},"answerEditor":{"type":"string","default":"text"},"matchAnswer":{"type":"string","default":"random"},"required":{"type":"string","default":"0"},"otherSettings":{"type":"object","default":{}},"settings":{"type":"object","default":{}}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID"],"providesContext":{"quiz-master-next/questionID":"questionID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-question","version":"0.1.0","title":"Question","category":"widgets","parent":["qsm/quiz-page"],"icon":"move","description":"QSM Quiz Question","attributes":{"questionID":{"type":"string","default":"0"},"type":{"type":"string","default":"0"},"description":{"type":"string","source":"html","selector":"p","default":""},"title":{"type":"string","default":""},"correctAnswerInfo":{"type":"string","source":"html","selector":"p","default":""},"commentBox":{"type":"string","default":"0"},"category":{"type":"number"},"multicategories":{"type":"array"},"hint":{"type":"string"},"featureImageID":{"type":"number"},"featureImageSrc":{"type":"string"},"answers":{"type":"array"},"answerEditor":{"type":"string","default":"text"},"matchAnswer":{"type":"string","default":"random"},"required":{"type":"string","default":"0"},"otherSettings":{"type":"object","default":{}},"settings":{"type":"object","default":{}}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID"],"providesContext":{"quiz-master-next/questionID":"questionID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); /***/ }) diff --git a/blocks/build/question/index.js.map b/blocks/build/question/index.js.map index 613ecae05..c1cdd3f74 100644 --- a/blocks/build/question/index.js.map +++ b/blocks/build/question/index.js.map @@ -1 +1 @@ -{"version":3,"file":"question/index.js","mappings":";;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;AAE9F,MAAMC,eAAe,GAAKC,IAAI,IAAM;EAC1C,IAAKH,UAAU,CAAEG,IAAK,CAAC,EAAG;IACzBA,IAAI,GAAG,EAAE;EACV,CAAC,MAAM;IACNA,IAAI,GAAGA,IAAI,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,IAAI,EAAE,GAAI,CAAC;IAC9CF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAC/B;EAEA,OAAOF,IAAI;AACZ,CAAC;;AAED;AACO,MAAMG,YAAY,GAAKC,IAAI,IAAMA,IAAI,CAACF,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACfrC;AACoB;AACb;AAMX;AACwB;AACC;AACD;AAS1B;AACsB;AACrD;AACA;AACA;AACA;;AAEe,SAASuB,IAAIA,CAAEC,KAAK,EAAG;EACrC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGP,KAAK;;EAErF;EACA,MAAMQ,uBAAuB,GAAGjB,0DAAS,CAAIkB,MAAM,IAAMJ,UAAU,IAAII,MAAM,CAAE,mBAAoB,CAAC,CAACC,qBAAqB,CAAEJ,QAAQ,EAAE,IAAK,CAAE,CAAC;EAE9I,MAAMK,MAAM,GAAGJ,OAAO,C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;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpC+D,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAEpE,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/question/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/question/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\n/**\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\n * \n */\n\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\t\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\t\n\tconst {\n\t\tquestionID,\n\t\ttype,\n\t\tdescription,\n\t\ttitle,\n\t\tcorrectAnswerInfo,\n\t\tcommentBox,\n\t\tcategory,\n\t\tmulticategories,\n\t\thint,\n\t\tfeatureImageID,\n\t\tfeatureImageSrc,\n\t\tanswers,\n\t\tanswerEditor,\n\t\tmatchAnswer,\n\t\totherSettings,\n\t\tsettings,\n\t} = attributes;\n\n\tconst [ quesAttr, setQuesAttr ] = useState( settings );\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = ( html ) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\n\tconst QUESTION_TEMPLATE = [\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'0'\n\t\t\t}\n\t\t],\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'1'\n\t\t\t}\n\t\t]\n\n\t];\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\n\t\t{ /** Question Type **/ }\n\t\t\n\t\t\t\tsetAttributes( { type } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t{\n\t\t\t ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \n\t\t\t\t(\n\t\t\t\t\n\t\t\t\t\t{\n\t\t\t\t\t\tqtypes.types.map( qtype => \n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t \t\n\t\t{/**Answer Type */}\n\t\t\n\t\t\t\tsetAttributes( { answerEditor } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t
\n\t\t{/**Comment Box */}\n\t\t\n\t\t\n\t\t\t\tsetAttributes( { commentBox } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t\n\t
\n\t
\n\t\t setAttributes( { title: qsmStripTags( title ) } ) }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-title' }\n\t\t/>\n\t\t{\n\t\t\tisParentOfSelectedBlock && \n\t\t\t<>\n\t\t\t setAttributes({ description }) }\n\t\t\t\tclassName={ 'qsm-question-description' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t\n\t\t\t setAttributes({ correctAnswerInfo }) }\n\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\n\t\t\t\tallowedFormats={ [ ] }\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\tclassName={ 'qsm-question-hint' }\n\t\t\t/>\n\t\t\t\n\t\t}\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","select","hasSelectedInnerBlock","quizID","pageID","questionID","type","description","title","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageID","featureImageSrc","answers","answerEditor","matchAnswer","otherSettings","settings","quesAttr","setQuesAttr","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","QUESTION_TEMPLATE","optionID","Fragment","initialOpen","label","question_type","default","onChange","__nextHasNoMarginBottom","options","map","qtypes","key","types","qtype","slug","heading","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"question/index.js","mappings":";;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,I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,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAEpE,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/question/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/question/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\n/**\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\n * \n */\n\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\t\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\t\n\tconst {\n\t\tquestionID,\n\t\ttype,\n\t\tdescription,\n\t\ttitle,\n\t\tcorrectAnswerInfo,\n\t\tcommentBox,\n\t\tcategory,\n\t\tmulticategories,\n\t\thint,\n\t\tfeatureImageID,\n\t\tfeatureImageSrc,\n\t\tanswers,\n\t\tanswerEditor,\n\t\tmatchAnswer,\n\t\totherSettings,\n\t\tsettings,\n\t} = attributes;\n\n\tconst [ quesAttr, setQuesAttr ] = useState( settings );\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = ( html ) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\n\tconst QUESTION_TEMPLATE = [\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'0'\n\t\t\t}\n\t\t],\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'1'\n\t\t\t}\n\t\t]\n\n\t];\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\n\t\t{ /** Question Type **/ }\n\t\t\n\t\t\t\tsetAttributes( { type } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t{\n\t\t\t ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \n\t\t\t\t(\n\t\t\t\t\n\t\t\t\t\t{\n\t\t\t\t\t\tqtypes.types.map( qtype => \n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t \t\n\t\t{/**Answer Type */}\n\t\t\n\t\t\t\tsetAttributes( { answerEditor } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t
\n\t\t{/**Comment Box */}\n\t\t\n\t\t\n\t\t\t\tsetAttributes( { commentBox } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t\n\t
\n\t
\n\t\t setAttributes( { title: qsmStripTags( title ) } ) }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-title' }\n\t\t/>\n\t\t{\n\t\t\tisParentOfSelectedBlock && \n\t\t\t<>\n\t\t\t setAttributes({ description }) }\n\t\t\t\tclassName={ 'qsm-question-description' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t\n\t\t\t setAttributes({ correctAnswerInfo }) }\n\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\n\t\t\t\tallowedFormats={ [ ] }\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\tclassName={ 'qsm-question-hint' }\n\t\t\t/>\n\t\t\t\n\t\t}\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","select","hasSelectedInnerBlock","quizID","pageID","questionID","type","description","title","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageID","featureImageSrc","answers","answerEditor","matchAnswer","otherSettings","settings","quesAttr","setQuesAttr","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","QUESTION_TEMPLATE","optionID","Fragment","initialOpen","label","question_type","default","onChange","__nextHasNoMarginBottom","options","map","qtypes","key","types","qtype","slug","heading","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/src/answer-option/block.json b/blocks/src/answer-option/block.json index 3956752cd..a5e76e8ec 100644 --- a/blocks/src/answer-option/block.json +++ b/blocks/src/answer-option/block.json @@ -6,7 +6,7 @@ "title": "Answer Option", "category": "widgets", "parent": [ "qsm/quiz-question" ], - "icon": "feedback", + "icon": "remove", "description": "QSM Quiz answer option", "attributes": { "optionID": { diff --git a/blocks/src/answer-option/edit.js b/blocks/src/answer-option/edit.js index 1894176f2..df6f2891f 100644 --- a/blocks/src/answer-option/edit.js +++ b/blocks/src/answer-option/edit.js @@ -89,6 +89,7 @@ onRemove } = props;
{ let shouldSetQSMAttr = true; @@ -196,40 +163,27 @@ export default function Edit( props ) { }, [ quizID ] ); - + /** + * vault dash Icon + * @returns vault dash Icon + */ const feedbackIcon = () => ( ( - - - - - - - ) - } + icon="vault" + size="36" /> ); + + /** + * + * @returns Placeholder for quiz in case quiz ID is not set + */ const quizPlaceholder = ( ) => { return ( { <> @@ -295,6 +249,7 @@ export default function Edit( props ) { 'pagination', ].map( ( item ) => ( ( { let newAttr = quizAttr; newAttr[ attr_name ] = value; @@ -346,9 +307,141 @@ export default function Edit( props ) { } const createNewQuiz = () => { + if ( qsmIsEmpty( quizAttr.quiz_name ) ) { + console.log("empty quiz_name"); + return; + } + //save quiz status + setSaveQuiz( true ); + // let quizData = { + // "quiz_name": quizAttr.quiz_name, + // "qsm_new_quiz_nonce": qsmBlockData.qsm_new_quiz_nonce + // }; + let quizData = qsmFormData({ + 'quiz_name': quizAttr.quiz_name, + 'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce + }); + + if ( showAdvanceOption ) { + ['form_type', + 'system', + 'timer_limit', + 'pagination', + 'enable_contact_form', + 'enable_pagination_quiz', + 'show_question_featured_image_in_result', + 'progress_bar', + 'require_log_in', + 'disable_first_page', + 'comment_section' + ].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) ); + } + + //AJAX call + apiFetch( { + path: '/quiz-survey-master/v1/quiz/create_quiz', + method: 'POST', + body: quizData + } ).then( ( res ) => { + console.log( res ); + //save quiz status + setSaveQuiz( false ); + if ( 'success' == res.status ) { + //create a question + let newQuestion = qsmFormData( { + "id": null, + "quizID": res.quizID, + "type": "0", + "name": "", + "question_title": "", + "answerInfo": "", + "comments": "1", + "hint": "", + "category": "", + "required": 1, + "answers": [], + "page": 0 + } ); + //AJAX call + apiFetch( { + path: '/quiz-survey-master/v1/questions', + method: 'POST', + body: newQuestion + } ).then( ( response ) => { + console.log("question response", response); + if ( 'success' == response.status ) { + let question_id = response.id; + /**Page attributes required format */ + // pages[0][]: 2512 + // qpages[0][id]: 2 + // qpages[0][quizID]: 76 + // qpages[0][pagekey]: Ipj90nNT + // qpages[0][hide_prevbtn]: 0 + // qpages[0][questions][]: 2512 + // post_id: 111 + + let newPage = qsmFormData( { + "action": qsmBlockData.save_pages_action, + "quiz_id": res.quizID, + "nonce": qsmBlockData.saveNonce, + "post_id": res.quizPostID, + } ); + newPage.append( 'pages[0][]', question_id ); + newPage.append( 'qpages[0][id]', 1 ); + newPage.append( 'qpages[0][quizID]', res.quizID ); + newPage.append( 'qpages[0][pagekey]', qsmUniqid() ); + newPage.append( 'qpages[0][hide_prevbtn]', 0 ); + newPage.append( 'qpages[0][questions][]', question_id ); + + + //create a page + apiFetch( { + url: qsmBlockData.ajax_url, + method: 'POST', + body: newPage + } ).then( ( pageResponse ) => { + console.log("pageResponse", pageResponse); + if ( 'success' == pageResponse.status ) { + //set new quiz ID + setAttributes( { quizID: res.quizID } ); + } + }); + + } + + }).catch( + ( error ) => { + console.log( 'error',error ); + createNotice( 'error', error.message, { + isDismissible: true, + type: 'snackbar', + } ); + } + ); + + } + + //create notice + createNotice( res.status, res.msg, { + isDismissible: true, + type: 'snackbar', + } ); + } ).catch( + ( error ) => { + console.log( 'error',error ); + createNotice( 'error', error.message, { + isDismissible: true, + type: 'snackbar', + } ); + } + ); + } + /** + * Inner Blocks + */ const blockProps = useBlockProps(); const innerBlocksProps = useInnerBlocksProps( blockProps, { template: quizTemplate, diff --git a/blocks/src/helper.js b/blocks/src/helper.js index e6fec85a7..26af818fc 100644 --- a/blocks/src/helper.js +++ b/blocks/src/helper.js @@ -13,4 +13,24 @@ export const qsmSanitizeName = ( name ) => { } // Remove anchor tags from button text content. -export const qsmStripTags = ( text ) => text.replace( /<\/?a[^>]*>/g, '' ); \ No newline at end of file +export const qsmStripTags = ( text ) => text.replace( /<\/?a[^>]*>/g, '' ); + +//prepare form data +export const qsmFormData = ( obj = false ) => { + let newData = new FormData(); + newData.append('qsm_block_api_call', '1'); + if ( false !== obj ) { + for ( let k in obj ) { + if ( obj.hasOwnProperty( k ) ) { + newData.append( k, obj[k] ); + } + } + } + return newData; +} + +export const qsmUniqid = (prefix = "", random = false) => { + const sec = Date.now() * 1000 + Math.random() * 1000; + const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); + return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:""}`; +}; \ No newline at end of file diff --git a/blocks/src/page/block.json b/blocks/src/page/block.json index 7caa7fc63..a613e61c6 100644 --- a/blocks/src/page/block.json +++ b/blocks/src/page/block.json @@ -6,7 +6,7 @@ "title": "Page", "category": "widgets", "parent": [ "qsm/quiz" ], - "icon": "feedback", + "icon": "text-page", "description": "QSM Quiz Page", "attributes": { "pageID": { diff --git a/blocks/src/question/block.json b/blocks/src/question/block.json index d8cdc035e..4587cb05c 100644 --- a/blocks/src/question/block.json +++ b/blocks/src/question/block.json @@ -6,7 +6,7 @@ "title": "Question", "category": "widgets", "parent": [ "qsm/quiz-page" ], - "icon": "feedback", + "icon": "move", "description": "QSM Quiz Question", "attributes": { "questionID": { diff --git a/blocks/src/question/edit.js b/blocks/src/question/edit.js index ac02a1266..e399ba8a3 100644 --- a/blocks/src/question/edit.js +++ b/blocks/src/question/edit.js @@ -159,6 +159,7 @@ export default function Edit( props ) {
add_hooks(); } + //Check admin capabilities + public function qsm_is_admin( $check_permission = 'manage_options' ) { + if ( ! function_exists( 'wp_get_current_user' ) && file_exists( ABSPATH . "wp-includes/pluggable.php" ) ) { + require_once( ABSPATH . "wp-includes/pluggable.php" ); + } + if ( ! function_exists( 'current_user_can' ) && file_exists( ABSPATH . "wp-includes/capabilities.php" ) ) { + require_once( ABSPATH . "wp-includes/capabilities.php" ); + } + return ( function_exists( 'wp_get_current_user' ) && function_exists( 'current_user_can' ) && current_user_can( $check_permission ) ); + } + /** * Load File Dependencies * @@ -161,6 +172,8 @@ public function __construct() { */ private function load_dependencies() { + include_once 'blocks/block.php'; + include_once 'php/classes/class-qsm-install.php'; include_once 'php/classes/class-qsm-fields.php'; @@ -170,7 +183,7 @@ private function load_dependencies() { include_once 'php/classes/class-qsm-audit.php'; $this->audit_manager = new QSM_Audit(); - if ( is_admin() ) { + if ( is_admin() || $this->qsm_is_admin() ) { include_once 'php/admin/functions.php'; include_once 'php/admin/stats-page.php'; include_once 'php/admin/quizzes-page.php'; @@ -205,11 +218,7 @@ private function load_dependencies() { include_once 'php/adverts-generate.php'; include_once 'php/question-types.php'; include_once 'php/default-templates.php'; - include_once 'php/shortcodes.php'; - - if ( function_exists( 'register_block_type' ) ) { - include_once 'blocks/block.php'; - } + include_once 'php/shortcodes.php'; include_once 'php/classes/class-qmn-alert-manager.php'; $this->alertManager = new MlwQmnAlertManager(); diff --git a/php/admin/functions.php b/php/admin/functions.php index 18d95720a..c7843ac32 100644 --- a/php/admin/functions.php +++ b/php/admin/functions.php @@ -26,10 +26,12 @@ function qsm_fetch_data_from_xml() { * @param int $quiz_id Quiz id. */ function qsm_redirect_to_edit_page( $quiz_id ) { - link_featured_image( $quiz_id ); - $url = admin_url( 'admin.php?page=mlw_quiz_options&quiz_id=' . $quiz_id ); - wp_safe_redirect( $url ); - exit; + if ( ! is_qsm_block_api_call() ) { + link_featured_image( $quiz_id ); + $url = admin_url( 'admin.php?page=mlw_quiz_options&quiz_id=' . $quiz_id ); + wp_safe_redirect( $url ); + exit; + } } /** diff --git a/php/classes/class-qmn-quiz-creator.php b/php/classes/class-qmn-quiz-creator.php index 324c0bc9c..5b89a5c6b 100644 --- a/php/classes/class-qmn-quiz-creator.php +++ b/php/classes/class-qmn-quiz-creator.php @@ -24,6 +24,15 @@ class QMNQuizCreator { */ private $quiz_id; + + /** + * QMN POST ID of quiz + * + * @var integer + * @since 8.1.17 + */ + private $quiz_post_id; + /** * If the quiz ID is set, store it as the class quiz ID * @@ -61,6 +70,32 @@ public function get_id() { } } + /** + * Sets quiz post ID + * + * @since 8.1.17 + * @param int $quiz_post_id The post ID of the quiz. + * @access public + * @return void + */ + public function set_quiz_post_id( $quiz_post_id ) { + $this->quiz_post_id = intval( $quiz_post_id ); + } + + /** + * Gets the quiz post ID stored + * + * @since 8.1.17 + * @return int|false The post ID of the quiz stored or false + */ + public function get_quiz_post_id() { + if ( $this->quiz_post_id ) { + return intval( $this->quiz_post_id ); + } else { + return false; + } + } + /** * Creates a new quiz with the default settings * @@ -211,6 +246,13 @@ public function create_quiz( $quiz_name, $theme_id, $quiz_settings = array() ) { // Hook called after new quiz or survey has been created. Passes quiz_id to hook do_action( 'qmn_quiz_created', $new_quiz ); + + //set quiz id + if ( is_numeric( $new_quiz ) && is_numeric( $quiz_post_id ) ) { + $this->set_id( $new_quiz ); + $this->set_quiz_post_id( $quiz_post_id ); + } + } else { $mlwQuizMasterNext->alertManager->newAlert( __( 'There has been an error in this action. Please share this with the developer. Error Code: 0001', 'quiz-master-next' ), 'error' ); $mlwQuizMasterNext->log_manager->add( 'Error 0001', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' ); diff --git a/php/rest-api.php b/php/rest-api.php index 37b83d691..509d0f2cc 100644 --- a/php/rest-api.php +++ b/php/rest-api.php @@ -90,19 +90,6 @@ function qsm_register_rest_routes() { }, ) ); - - //get quiz structure data - register_rest_route( - 'quiz-survey-master/v1', - '/quiz/structure', - array( - 'methods' => WP_REST_Server::CREATABLE, - 'callback' => 'qsm_quiz_structure_data', - 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); - }, - ) - ); // Register rest api to get quiz list register_rest_route( 'qsm', @@ -135,7 +122,6 @@ function qsm_register_rest_routes() { }, ) ); - // Get Categories of quiz register_rest_route( 'quiz-survey-master/v1', @@ -797,103 +783,3 @@ function qsm_get_quizzes_list() { } return $qsm_quiz_list; } - -if ( ! function_exists( 'qsm_quiz_structure_data' ) ) { - function qsm_quiz_structure_data( WP_REST_Request $request ) { - - $result = array( - 'status' => 'error', - 'msg' => __( 'User not found', 'quiz-master-next' ), - ); - if ( ! is_user_logged_in() || ! function_exists( 'wp_get_current_user' ) || empty( wp_get_current_user() ) ) { - return $result; - } - - $quiz_id = isset( $request['quizID'] ) ? intval( $request['quizID'] ) : 0; - - if ( empty( $quiz_id ) && ! is_numeric( $quiz_id ) ) { - $result['msg'] = __( 'Invalid quiz id', 'quiz-master-next' ); - return $result; - } - - global $wpdb; - - - $quiz_data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_quizzes WHERE deleted = 0 AND quiz_id = %d ORDER BY quiz_id DESC", $quiz_id ), ARRAY_A ); - - if ( ! empty( $quiz_data ) ) { - - // Cycle through each quiz and retrieve all of quiz's questions. - foreach ( $quiz_data as $key => $quiz ) { - - $question_data = QSM_Questions::load_questions_by_pages( $quiz['quiz_id'] ); - $quiz_data[ $key ]['questions'] = $question_data; - - //unserialize quiz_settings - if ( ! empty( $quiz_data[ $key ]['quiz_settings'] ) ) { - $quiz_data[ $key ]['quiz_settings'] = maybe_unserialize( $quiz_data[ $key ]['quiz_settings'] ); - //unserialize pages - if ( ! empty( $quiz_data[ $key ]['quiz_settings']['qpages'] ) ) { - $quiz_data[ $key ]['qpages'] = maybe_unserialize( $quiz_data[ $key ]['quiz_settings']['qpages'] ); - if ( ! empty( $quiz_data[ $key ]['quiz_settings']['pages'] ) ) { - $quiz_data[ $key ]['pages'] = maybe_unserialize( $quiz_data[ $key ]['quiz_settings']['pages'] ); - //group question under individual pages - if ( is_array( $quiz_data[ $key ]['qpages'] ) ) { - foreach ( $quiz_data[ $key ]['qpages'] as $pageIndex => $page ) { - if ( ! empty( $page['questions'] ) && ! empty( $quiz_data[ $key ]['pages'][ $pageIndex ] ) ) { - $quiz_data[ $key ]['qpages'][$pageIndex]['question_arr'] = array(); - foreach ( $quiz_data[ $key ]['pages'][ $pageIndex ] as $qIndex => $q ) { - $quiz_data[ $key ]['qpages'][$pageIndex]['question_arr'][] = $quiz_data[ $key ]['questions'][$q]; - } - } - } - } - } - } - } - - // checking if logic is updated to tables - $logic_updated = get_option( 'logic_rules_quiz_' . $quiz['quiz_id'] ); - if ( $logic_updated ) { - $query = $wpdb->prepare( "SELECT logic FROM {$wpdb->prefix}mlw_logic where quiz_id = %d", $quiz['quiz_id'] ); - $logic_data = $wpdb->get_results( $query, ARRAY_N ); - $logics = array(); - if ( ! empty( $logic_data ) ) { - foreach ( $logic_data as $logic ) { - $logics[] = maybe_unserialize( $logic[0] ); - } - $serialized_logic = maybe_serialize( $logics ); - $quiz_data[ $key ]['logic'] = $serialized_logic; - } - } - - // get featured image of quiz if available - $qsm_featured_image = get_option( 'quiz_featured_image_' . $quiz['quiz_id'] ); - if ( $qsm_featured_image ) { - $quiz_data[ $key ]['featured_image'] = $qsm_featured_image; - } - - // get themes setting - $query = $wpdb->prepare( "SELECT A.theme, B.quiz_theme_settings, B.active_theme FROM {$wpdb->prefix}mlw_themes A, {$wpdb->prefix}mlw_quiz_theme_settings B where A.id = B.theme_id and B.quiz_id = %d", $quiz['quiz_id'] ); - $themes_data = $wpdb->get_results( $query, ARRAY_N ); - if ( ! empty( $themes_data ) ) { - $themes = array(); - foreach ( $themes_data as $data ) { - $themes[] = $data; - } - $serialized_themes = maybe_serialize( $themes ); - $quiz_data[ $key ]['themes'] = $serialized_themes; - } - } - return array( - 'status' => 'success', - 'result' => $quiz_data[0], - ); - - }else { - $result['msg'] = __( 'Quiz not found!', 'quiz-master-next' ); - return $result; - } - } -} - From d7dded4e743235b4e7ccb68b5576d14ed8ec670b Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Tue, 10 Oct 2023 18:43:05 +0530 Subject: [PATCH 03/27] compile quiz block inner data in quiz block on save page --- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 8 +- blocks/build/answer-option/index.js.map | 2 +- blocks/build/index.asset.php | 2 +- blocks/build/index.js | 211 +++++++++++++++++---- blocks/build/index.js.map | 2 +- blocks/build/page/index.asset.php | 2 +- blocks/build/page/index.js | 8 +- blocks/build/page/index.js.map | 2 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 8 +- blocks/build/question/index.js.map | 2 +- blocks/src/edit.js | 138 +++++++++++++- blocks/src/helper.js | 6 +- 14 files changed, 347 insertions(+), 48 deletions(-) diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index 306370753..4fe50fac3 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '2079a58810d02f1613a0'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => 'e5ff0d1c46cfa66822e9'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index 047ba84cd..c1f4b40d4 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -155,7 +155,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, /* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, /* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; } +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, +/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } /* harmony export */ }); //Check if undefined, null, empty const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; @@ -185,12 +186,17 @@ const qsmFormData = (obj = false) => { } return newData; }; + +//generate uiniq id const qsmUniqid = (prefix = "", random = false) => { const sec = Date.now() * 1000 + Math.random() * 1000; const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; }; +//return data if not empty otherwise default value +const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; + /***/ }), /***/ "@wordpress/api-fetch": diff --git a/blocks/build/answer-option/index.js.map b/blocks/build/answer-option/index.js.map index 45362e5f7..6f8f4ff02 100644 --- a/blocks/build/answer-option/index.js.map +++ b/blocks/build/answer-option/index.js.map @@ -1 +1 @@ -{"version":3,"file":"answer-option/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AACb;AAMX;AACwB;AACC;AACD;AAS1B;AACiB;AACK;AACtC,SAASuB,IAAIA,CAAEC,KAAK,EAAG;EAErC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,WAAW;IAAEC,SAAS;IACpGC;EAAS,CAAC,GAAGV,KAAK;EAEjB,MAAMW,MAAM,GAAGJ,OAAO,CAAC,yBAAyB,CAAC;EACjD,MAAMK,MAAM,GAAGL,OA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C,GAAG,IAAI;EACpD,MAAMK,EAAE,GAAGJ,GAAG,CAACK,QAAQ,CAAC,EAAE,CAAC,CAACjB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAACkB,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC;EAC7D,OAAQ,GAAER,MAAO,GAAEM,EAAG,GAAEL,MAAM,GAAI,IAAGI,IAAI,CAACI,KAAK,CAACJ,IAAI,CAACJ,MAAM,CAAC,CAAC,GAAG,SAAS,CAAE,EAAC,GAAC,EAAG,EAAC;AACrF,CAAC;;;;;;;;;;ACnCD;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCS,oEAAiB,CAAEC,6CAAa,EAAE;EACjCC,KAAKA,CAAEpE,UAAU,EAAEqE,iBAAiB,EAAG;IACtC,OAAO;MACNxD,OAAO,EACN,CAAEb,UAAU,CAACa,OAAO,IAAI,EAAE,KACxBwD,iBAAiB,CAACxD,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACDyD,IAAI,EAAE1E,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/answer-option/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/answer-option/index.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\nexport default function Edit( props ) {\n\t\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace,\nonRemove } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\tconst questionID = context['quiz-master-next/questionID'];\n\tconst name = 'qsm/quiz-answer-option';\n\tconst {\n\t\toptionID,\n\t\tcontent,\n\t\tpoints,\n\t\tisCorrect\n\t} = attributes;\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: '',\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = (html) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\t\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { points } ) }\n\t\t\t/>\n\t\t\t setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\n\t
\n\t\t setAttributes( { content: qsmStripTags( content ) } ) }\n\t\t\tonSplit={ ( value, isOriginal ) => {\n\t\t\t\tlet newAttributes;\n\n\t\t\t\tif ( isOriginal || value ) {\n\t\t\t\t\tnewAttributes = {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst block = createBlock( name, newAttributes );\n\n\t\t\t\tif ( isOriginal ) {\n\t\t\t\t\tblock.clientId = clientId;\n\t\t\t\t}\n\n\t\t\t\treturn block;\n\t\t\t} }\n\t\t\tonMerge={ mergeBlocks }\n\t\t\tonReplace={ onReplace }\n\t\t\tonRemove={ onRemove }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-answer-option' }\n\t\t\tidentifier='text'\n\t\t/>\n\t
\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit: Edit,\n} );\n"],"names":["__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","createBlock","qsmIsEmpty","qsmStripTags","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","mergeBlocks","onReplace","onRemove","quizID","pageID","questionID","name","optionID","content","points","isCorrect","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","Fragment","title","initialOpen","type","label","help","onChange","checked","tagName","placeholder","onSplit","isOriginal","newAttributes","block","onMerge","allowedFormats","withoutInteractiveFormatting","identifier","data","qsmSanitizeName","toLowerCase","replace","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","registerBlockType","metadata","merge","attributesToMerge","edit"],"sour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AEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCyB,oEAAiB,CAAEC,6CAAa,EAAE;EACjCC,KAAKA,CAAEtE,UAAU,EAAEuE,iBAAiB,EAAG;IACtC,OAAO;MACN1D,OAAO,EACN,CAAEb,UAAU,CAACa,OAAO,IAAI,EAAE,KACxB0D,iBAAiB,CAAC1D,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACD2D,IAAI,EAAE5E,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/answer-option/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/answer-option/index.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\nexport default function Edit( props ) {\n\t\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace,\nonRemove } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\tconst questionID = context['quiz-master-next/questionID'];\n\tconst name = 'qsm/quiz-answer-option';\n\tconst {\n\t\toptionID,\n\t\tcontent,\n\t\tpoints,\n\t\tisCorrect\n\t} = attributes;\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: '',\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = (html) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\t\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { points } ) }\n\t\t\t/>\n\t\t\t setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\n\t
\n\t\t setAttributes( { content: qsmStripTags( content ) } ) }\n\t\t\tonSplit={ ( value, isOriginal ) => {\n\t\t\t\tlet newAttributes;\n\n\t\t\t\tif ( isOriginal || value ) {\n\t\t\t\t\tnewAttributes = {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst block = createBlock( name, newAttributes );\n\n\t\t\t\tif ( isOriginal ) {\n\t\t\t\t\tblock.clientId = clientId;\n\t\t\t\t}\n\n\t\t\t\treturn block;\n\t\t\t} }\n\t\t\tonMerge={ mergeBlocks }\n\t\t\tonReplace={ onReplace }\n\t\t\tonRemove={ onRemove }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-answer-option' }\n\t\t\tidentifier='text'\n\t\t/>\n\t
\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\n//generate uiniq id\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};\n\n//return data if not empty otherwise default value\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit: Edit,\n} );\n"],"names":["__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","createBlock","qsmIsEmpty","qsmStripTags","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","mergeBlocks","onReplace","onRemove","quizID","pageID","questionID","name","optionID","content","points","isCorrect","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","Fragment","title","initialOpen","type","label","help","onChange","checked","tagName","placeholder","onSplit","isOriginal","newAttributes","block","onMerge","allowedFormats","withoutInteractiveFormatting","identifier","data","qsmSanitizeName","toLowerCase","replace","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","registerBlockType","metadata","merge","attributesToMerge","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index c9cf4c532..5e9bb92ab 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '9cafe50c50a91a50ec41'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '8dbcc3b3def5a4bdad4a'); diff --git a/blocks/build/index.js b/blocks/build/index.js index 07fc1a398..8dafc9b24 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -24,10 +24,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./helper */ "./src/helper.js"); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./helper */ "./src/helper.js"); + @@ -77,11 +80,133 @@ function Edit(props) { //Quiz Options to create attributes label, description and layout const quizOptions = qsmBlockData.quizOptions; + //check if page is saving + const isSavingPage = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + const { + isAutosavingPost, + isSavingPost + } = select(_wordpress_editor__WEBPACK_IMPORTED_MODULE_6__.store); + return isSavingPost() || isAutosavingPost(); + }, []); + const { + getBlock + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.store); + + /** + * Prepare quiz data e.g. quiz details, questions, answers etc to save + * @returns quiz data + */ + const getQuizDataToSave = () => { + let blocks = getBlock(clientId); + if ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(blocks)) { + return false; + } + console.log("blocks", blocks); + blocks = blocks.innerBlocks; + let quizDataToSave = { + quiz_id: quizAttr.quiz_id, + post_id: quizAttr.post_id, + quiz: {}, + pages: [], + qpages: [], + questions: [] + }; + let pageSNo = 0; + //loop through inner blocks + blocks.forEach(block => { + if ('qsm/quiz-page' === block.name) { + let pageID = block.attributes.pageID; + let questions = []; + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(block.innerBlocks) && 0 < block.innerBlocks.length) { + let questionBlocks = block.innerBlocks; + //Question Blocks + questionBlocks.forEach(questionBlock => { + if ('qsm/quiz-question' !== questionBlock.name) { + return true; + } + let answers = []; + //Answer option blocks + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(questionBlock.innerBlocks) && 0 < questionBlock.innerBlocks.length) { + let answerOptionBlocks = questionBlock.innerBlocks; + answerOptionBlocks.forEach(answerOptionBlock => { + if ('qsm/quiz-answer-option' !== answerOptionBlock.name) { + return true; + } + let answerAttr = answerOptionBlock.attributes; + answers.push([(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(answerAttr?.content), (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(answerAttr?.points), (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(answerAttr?.isCorrect)]); + }); + } + + //questions Data + let questionAttr = questionBlock.attributes; + questions.push(questionAttr.questionID); + quizDataToSave.questions.push({ + "id": questionAttr.questionID, + "quizID": quizAttr.quiz_id, + "postID": quizAttr.post_id, + "type": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.type, '0'), + "name": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.description), + "question_title": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.title), + "answerInfo": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.correctAnswerInfo), + "comments": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.commentBox, '1'), + "hint": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.hint), + "category": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.category), + "required": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.required, 1), + "answers": answers, + "page": pageSNo + }); + }); + } + + // pages[0][]: 2512 + // qpages[0][id]: 2 + // qpages[0][quizID]: 76 + // qpages[0][pagekey]: Ipj90nNT + // qpages[0][hide_prevbtn]: 0 + // qpages[0][questions][]: 2512 + // post_id: 111 + //page data + quizDataToSave.pages.push(questions); + quizDataToSave.qpages.push({ + 'id': pageID, + 'quizID': quizAttr.quiz_id, + 'pagekey': block.attributes.pageKey, + 'hide_prevbtn': block.attributes.hidePrevBtn, + 'questions': questions + }); + pageSNo++; + } + }); + + //Quiz details + quizDataToSave.quiz = { + 'quiz_name': quizAttr.quiz_name, + 'quiz_id': quizAttr.quiz_id, + 'post_id': quizAttr.post_id + }; + if (showAdvanceOption) { + ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => { + if ('undefined' !== typeof quizAttr[item] && null !== quizAttr[item]) { + quizDataToSave.quiz[item] = quizAttr[item]; + } + }); + } + return quizDataToSave; + }; + + //saving Quiz on save page + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (isSavingPage) { + let qsmData = getQuizDataToSave(); + console.log("qsmData", qsmData); + } + }, [isSavingPage]); + /**Initialize block from server */ (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { let shouldSetQSMAttr = true; if (shouldSetQSMAttr) { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizID) && 0 < quizID && ((0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr) || (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr?.quizID) || quizID != quizAttr.quiz_id)) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizID) && 0 < quizID && ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr) || (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr?.quizID) || quizID != quizAttr.quiz_id)) { _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ path: '/quiz-survey-master/v1/quiz/structure', method: 'POST', @@ -96,16 +221,16 @@ function Edit(props) { ...quizAttr, ...result }); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(result.qpages)) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(result.qpages)) { let quizTemp = []; result.qpages.forEach(page => { let questions = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(page.question_arr)) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(page.question_arr)) { page.question_arr.forEach(question => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(question)) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(question)) { let answers = []; //answers options blocks - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(question.answers) && 0 < question.answers.length) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(question.answers) && 0 < question.answers.length) { question.answers.forEach((answer, aIndex) => { answers.push(['qsm/quiz-answer-option', { optionID: aIndex, @@ -169,7 +294,7 @@ function Edit(props) { * vault dash Icon * @returns vault dash Icon */ - const feedbackIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Icon, { + const feedbackIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Icon, { icon: "vault", size: "36" }); @@ -179,13 +304,13 @@ function Edit(props) { * @returns Placeholder for quiz in case quiz ID is not set */ const quizPlaceholder = () => { - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Placeholder, { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Placeholder, { icon: feedbackIcon, label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz And Survey Master', 'quiz-master-next'), instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Easily and quickly add quizzes and surveys inside the block editor.', 'quiz-master-next') - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, !(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizList) && 0 < quizList.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizList) && 0 < quizList.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { className: "qsm-placeholder-select-create-quiz" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.SelectControl, { + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('', 'quiz-master-next'), value: quizID, options: quizList, @@ -194,49 +319,49 @@ function Edit(props) { }), disabled: createQuiz, __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('OR', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Button, { + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('OR', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { variant: "link", onClick: () => setCreateQuiz(!createQuiz) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New', 'quiz-master-next'))), ((0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizList) || createQuiz) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.__experimentalVStack, { + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New', 'quiz-master-next'))), ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizList) || createQuiz) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.__experimentalVStack, { spacing: "3", className: "qsm-placeholder-quiz-create-form" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextControl, { + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), value: quizAttr?.quiz_name || '', onChange: val => setQuizAttributes(val, 'quiz_name') - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Button, { + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { variant: "link", onClick: () => setShowAdvanceOption(!showAdvanceOption) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance options', 'quiz-master-next')), showAdvanceOption && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.SelectControl, { + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance options', 'quiz-master-next')), showAdvanceOption && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { label: quizOptions?.form_type?.label, value: quizAttr?.form_type, options: quizOptions?.form_type?.options, onChange: val => setQuizAttributes(val, 'form_type'), __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.SelectControl, { + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { label: quizOptions?.system?.label, value: quizAttr?.system, options: quizOptions?.system?.options, onChange: val => setQuizAttributes(val, 'system'), help: quizOptions?.system?.help, __nextHasNoMarginBottom: true - }), ['timer_limit', 'pagination'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextControl, { + }), ['timer_limit', 'pagination'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { key: 'quiz-create-text-' + item, type: "number", label: quizOptions?.[item]?.label, help: quizOptions?.[item]?.help, - value: (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr[item]) ? 0 : quizAttr[item], + value: (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) ? 0 : quizAttr[item], onChange: val => setQuizAttributes(val, item) - })), ['enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.ToggleControl, { + })), ['enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { key: 'quiz-create-toggle-' + item, label: quizOptions?.[item]?.label, help: quizOptions?.[item]?.help, - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item], - onChange: () => setQuizAttributes(!(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item] ? 0 : 1, item) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Button, { + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item], + onChange: () => setQuizAttributes(!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item] ? 0 : 1, item) + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { variant: "primary", - disabled: saveQuiz || (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr.quiz_name), + disabled: saveQuiz || (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr.quiz_name), onClick: () => createNewQuiz() }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Create Quiz', 'quiz-master-next'))))); }; @@ -254,7 +379,7 @@ function Edit(props) { }); }; const createNewQuiz = () => { - if ((0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizAttr.quiz_name)) { + if ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr.quiz_name)) { console.log("empty quiz_name"); return; } @@ -264,7 +389,7 @@ function Edit(props) { // "quiz_name": quizAttr.quiz_name, // "qsm_new_quiz_nonce": qsmBlockData.qsm_new_quiz_nonce // }; - let quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmFormData)({ + let quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmFormData)({ 'quiz_name': quizAttr.quiz_name, 'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce }); @@ -283,7 +408,7 @@ function Edit(props) { setSaveQuiz(false); if ('success' == res.status) { //create a question - let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmFormData)({ + let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmFormData)({ "id": null, "quizID": res.quizID, "type": "0", @@ -316,7 +441,7 @@ function Edit(props) { // qpages[0][questions][]: 2512 // post_id: 111 - let newPage = (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmFormData)({ + let newPage = (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmFormData)({ "action": qsmBlockData.save_pages_action, "quiz_id": res.quizID, "nonce": qsmBlockData.saveNonce, @@ -325,7 +450,7 @@ function Edit(props) { newPage.append('pages[0][]', question_id); newPage.append('qpages[0][id]', 1); newPage.append('qpages[0][quizID]', res.quizID); - newPage.append('qpages[0][pagekey]', (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmUniqid)()); + newPage.append('qpages[0][pagekey]', (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmUniqid)()); newPage.append('qpages[0][hide_prevbtn]', 0); newPage.append('qpages[0][questions][]', question_id); @@ -375,15 +500,15 @@ function Edit(props) { template: quizTemplate, allowedBlocks: ['qsm/quiz-page'] }); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.PanelBody, { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz settings', 'quiz-master-next'), initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextControl, { + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), value: quizAttr?.quiz_name || '', onChange: val => setQuizAttributes(val, 'quiz_name') - }))), (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(quizID) || '0' == quizID ? quizPlaceholder() : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + }))), (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizID) || '0' == quizID ? quizPlaceholder() : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { ...innerBlocksProps })); } @@ -402,7 +527,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, /* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, /* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; } +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, +/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } /* harmony export */ }); //Check if undefined, null, empty const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; @@ -432,12 +558,17 @@ const qsmFormData = (obj = false) => { } return newData; }; + +//generate uiniq id const qsmUniqid = (prefix = "", random = false) => { const sec = Date.now() * 1000 + Math.random() * 1000; const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; }; +//return data if not empty otherwise default value +const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; + /***/ }), /***/ "./src/index.js": @@ -541,6 +672,16 @@ module.exports = window["wp"]["data"]; /***/ }), +/***/ "@wordpress/editor": +/*!********************************!*\ + !*** external ["wp","editor"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["editor"]; + +/***/ }), + /***/ "@wordpress/element": /*!*********************************!*\ !*** external ["wp","element"] ***! diff --git a/blocks/build/index.js.map b/blocks/build/index.js.map index 86d37f264..e99a9e1cd 100644 --- a/blocks/build/index.js.map +++ b/blocks/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AACb;AAMX;AAC0B;AACF;AAa1B;AACR;AACuC;AAC/C,SAAS2B,IAAIA,CAAEC,KAAK,EAAG;EACrC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IA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,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,8CAA8C;;WAE9C;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,iCAAiC,mCAAmC;WACpE;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA,2FAA2F,+CAA+C;UAC1I","sources":["webpack://qsm/./src/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/./src/index.js","webpack://qsm/./src/editor.scss","webpack://qsm/./src/style.scss","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/chunk loaded","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/webpack/runtime/jsonp chunk loading","webpack://qsm/webpack/before-startup","webpack://qsm/webpack/startup","webpack://qsm/webpack/after-startup"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tButton,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n\tPlaceholder,\n\tIcon,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport './editor.scss';\nimport { qsmIsEmpty, qsmFormData, qsmUniqid } from './helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId } = props;\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tquizID \n\t} = attributes;\n\n\t//quiz attribute\n\tconst [ quizAttr, setQuizAttr ] = useState( qsmBlockData.globalQuizsetting );\n\t//quiz list\n\tconst [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList );\n\t//quiz list\n\tconst [ quizMessage, setQuizMessage ] = useState( {\n\t\terror: false,\n\t\tmsg: ''\n\t} );\n\t//weather creating a new quiz\n\tconst [ createQuiz, setCreateQuiz ] = useState( false );\n\t//weather saving quiz\n\tconst [ saveQuiz, setSaveQuiz ] = useState( false );\n\t//weather to show advance option\n\tconst [ showAdvanceOption, setShowAdvanceOption ] = useState( false );\n\t//Quiz template on set Quiz ID\n\tconst [ quizTemplate, setQuizTemplate ] = useState( [] );\n\t//Quiz Options to create attributes label, description and layout\n\tconst quizOptions = qsmBlockData.quizOptions;\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\tif ( ! qsmIsEmpty( quizID ) && 0 < quizID && ( qsmIsEmpty( quizAttr ) || qsmIsEmpty( quizAttr?.quizID ) || quizID != quizAttr.quiz_id ) ) {\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/quiz/structure',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: { quizID: quizID },\n\t\t\t\t} ).then( ( res ) => {\n\t\t\t\t\tconsole.log( res );\n\t\t\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t\t\tlet result = res.result;\n\t\t\t\t\t\tsetQuizAttr( {\n\t\t\t\t\t\t\t...quizAttr,\n\t\t\t\t\t\t\t...result\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( ! qsmIsEmpty( result.qpages ) ) {\n\t\t\t\t\t\t\tlet quizTemp = [];\n\t\t\t\t\t\t\tresult.qpages.forEach( page => {\n\t\t\t\t\t\t\t\tlet questions = [];\n\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( page.question_arr ) ) {\n\t\t\t\t\t\t\t\t\tpage.question_arr.forEach( question => {\n\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question ) ) {\n\t\t\t\t\t\t\t\t\t\t\tlet answers = [];\n\t\t\t\t\t\t\t\t\t\t\t//answers options blocks\n\t\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tquestion.answers.forEach( ( answer, aIndex ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-answer-option',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptionID:aIndex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontent:answer[0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoints:answer[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect:answer[2]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t//question blocks\n\t\t\t\t\t\t\t\t\t\t\tquestions.push(\n\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-question',\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquestionID: question.question_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: question.question_type_new,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswerEditor: question.settings.answerEditor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: question.settings.question_title,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: question.question_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: question.settings.required,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thint:question.hints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswers: question.answers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcorrectAnswerInfo:question.question_answer_info,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcategory:question.category,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmulticategories:question.multicategories,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcommentBox: question.comments,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatchAnswer: question.settings.matchAnswer,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageID: question.settings.featureImageID,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageSrc: question.settings.featureImageSrc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings: question.settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers\n\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//console.log(\"page\",page);\n\t\t\t\t\t\t\t\tquizTemp.push(\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'qsm/quiz-page',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpageID:page.id,\n\t\t\t\t\t\t\t\t\t\t\tpageKey: page.pagekey,\n\t\t\t\t\t\t\t\t\t\t\thidePrevBtn: page.hide_prevbtn,\n\t\t\t\t\t\t\t\t\t\t\tquizID: page.quizID\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tquestions\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsetQuizTemplate( quizTemp );\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// QSM_QUIZ = [\n\t\t\t\t\t\t// \t[\n\n\t\t\t\t\t\t// \t]\n\t\t\t\t\t\t// ];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log( \"error \"+ res.msg );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\t/**\n\t * vault dash Icon\n\t * @returns vault dash Icon\n\t */\n\tconst feedbackIcon = () => (\n\t\n\t);\n\n\t/**\n\t * \n\t * @returns Placeholder for quiz in case quiz ID is not set\n\t */\n\tconst quizPlaceholder = ( ) => {\n\t\treturn (\n\t\t\t\n\t\t\t\t{\n\t\t\t\t\t<>\n\t\t\t\t\t{ ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& \n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( { quizID } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdisabled={ createQuiz }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t\t{ __( 'OR', 'quiz-master-next' ) }\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t}\n\t\t\t\t\t{ ( qsmIsEmpty( quizList ) || createQuiz ) &&\n\t\t\t\t\t\n\t\t\t\t\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ showAdvanceOption && (<>\n\t\t\t\t\t\t\t{/**Form Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'form_type') }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{/**Grading Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'system') }\n\t\t\t\t\t\t\t\thelp={ quizOptions?.system?.help }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'timer_limit', \n\t\t\t\t\t\t\t\t\t'pagination',\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t\t setQuizAttributes( val, item) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'enable_contact_form', \n\t\t\t\t\t\t\t\t\t'enable_pagination_quiz', \n\t\t\t\t\t\t\t\t\t'show_question_featured_image_in_result',\n\t\t\t\t\t\t\t\t\t'progress_bar',\n\t\t\t\t\t\t\t\t\t'require_log_in',\n\t\t\t\t\t\t\t\t\t'disable_first_page',\n\t\t\t\t\t\t\t\t\t'comment_section'\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t setQuizAttributes( ( ( ! qsmIsEmpty( quizAttr[item] ) && '1' == quizAttr[item] ) ? 0 : 1 ), item ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t }\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t);\n\t};\n\n\t/**\n\t * Set attribute value\n\t * @param { any } value attribute value to set\n\t * @param { string } attr_name attribute name\n\t */\n\tconst setQuizAttributes = ( value , attr_name ) => {\n\t\tlet newAttr = quizAttr;\n\t\tnewAttr[ attr_name ] = value;\n\t\tsetQuizAttr( { ...newAttr } );\n\t}\n\n\tconst createNewQuiz = () => {\n\t\tif ( qsmIsEmpty( quizAttr.quiz_name ) ) {\n\t\t\tconsole.log(\"empty quiz_name\");\n\t\t\treturn;\n\t\t}\n\t\t//save quiz status\n\t\tsetSaveQuiz( true );\n\t\t// let quizData = {\n\t\t// \t\"quiz_name\": quizAttr.quiz_name,\n\t\t// \t\"qsm_new_quiz_nonce\": qsmBlockData.qsm_new_quiz_nonce\n\t\t// };\n\t\tlet quizData = qsmFormData({\n\t\t\t'quiz_name': quizAttr.quiz_name,\n\t\t\t'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce\n\t\t});\n\t\t\n\t\tif ( showAdvanceOption ) {\n\t\t\t['form_type', \n\t\t\t'system', \n\t\t\t'timer_limit', \n\t\t\t'pagination',\n\t\t\t'enable_contact_form', \n\t\t\t'enable_pagination_quiz', \n\t\t\t'show_question_featured_image_in_result',\n\t\t\t'progress_bar',\n\t\t\t'require_log_in',\n\t\t\t'disable_first_page',\n\t\t\t'comment_section'\n\t\t\t].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) );\n\t\t}\n\n\t\t//AJAX call\n\t\tapiFetch( {\n\t\t\tpath: '/quiz-survey-master/v1/quiz/create_quiz',\n\t\t\tmethod: 'POST',\n\t\t\tbody: quizData\n\t\t} ).then( ( res ) => {\n\t\t\tconsole.log( res );\n\t\t\t//save quiz status\n\t\t\tsetSaveQuiz( false );\n\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t//create a question\n\t\t\t\tlet newQuestion = qsmFormData( {\n\t\t\t\t\t\"id\": null,\n\t\t\t\t\t\"quizID\": res.quizID,\n\t\t\t\t\t\"type\": \"0\",\n\t\t\t\t\t\"name\": \"\",\n\t\t\t\t\t\"question_title\": \"\",\n\t\t\t\t\t\"answerInfo\": \"\",\n\t\t\t\t\t\"comments\": \"1\",\n\t\t\t\t\t\"hint\": \"\",\n\t\t\t\t\t\"category\": \"\",\n\t\t\t\t\t\"required\": 1,\n\t\t\t\t\t\"answers\": [],\n\t\t\t\t\t\"page\": 0\n\t\t\t\t} );\n\t\t\t\t//AJAX call\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: newQuestion\n\t\t\t\t} ).then( ( response ) => {\n\t\t\t\t\tconsole.log(\"question response\", response);\n\t\t\t\t\tif ( 'success' == response.status ) {\n\t\t\t\t\t\tlet question_id = response.id;\n\n\t\t\t\t\t\t/**Page attributes required format */\n\t\t\t\t\t\t// pages[0][]: 2512\n\t\t\t\t\t\t// \tqpages[0][id]: 2\n\t\t\t\t\t\t// \tqpages[0][quizID]: 76\n\t\t\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\n\t\t\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\n\t\t\t\t\t\t// \tqpages[0][questions][]: 2512\n\t\t\t\t\t\t// \tpost_id: 111\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet newPage = qsmFormData( {\n\t\t\t\t\t\t\t\"action\": qsmBlockData.save_pages_action,\n\t\t\t\t\t\t\t\"quiz_id\": res.quizID,\n\t\t\t\t\t\t\t\"nonce\": qsmBlockData.saveNonce,\n\t\t\t\t\t\t\t\"post_id\": res.quizPostID,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tnewPage.append( 'pages[0][]', question_id );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][id]', 1 );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][quizID]', res.quizID );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][pagekey]', qsmUniqid() );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][hide_prevbtn]', 0 );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][questions][]', question_id );\n\n\n\t\t\t\t\t\t//create a page\n\t\t\t\t\t\tapiFetch( {\n\t\t\t\t\t\t\turl: qsmBlockData.ajax_url,\n\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\tbody: newPage\n\t\t\t\t\t\t} ).then( ( pageResponse ) => {\n\t\t\t\t\t\t\tconsole.log(\"pageResponse\", pageResponse);\n\t\t\t\t\t\t\tif ( 'success' == pageResponse.status ) {\n\t\t\t\t\t\t\t\t//set new quiz ID\n\t\t\t\t\t\t\t\tsetAttributes( { quizID: res.quizID } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}).catch(\n\t\t\t\t\t( error ) => {\n\t\t\t\t\t\tconsole.log( 'error',error );\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\n\t\t\t\t\t\t\tisDismissible: true,\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t\n\t\t\t} \n\n\t\t\t//create notice\n\t\t\tcreateNotice( res.status, res.msg, {\n\t\t\t\tisDismissible: true,\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} ).catch(\n\t\t\t( error ) => {\n\t\t\t\tconsole.log( 'error',error );\n\t\t\t\tcreateNotice( 'error', error.message, {\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\t \n\t}\n\n\t/**\n\t * Inner Blocks\n\t */\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: quizTemplate,\n\t\tallowedBlocks : [\n\t\t\t'qsm/quiz-page'\n\t\t]\n\t} );\n\t\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t/>\n\t\t\n\t\n\t{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? \n quizPlaceholder() \n\t:\n\t
\n\t}\n\t\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};","import { registerBlockType } from '@wordpress/blocks';\nimport './style.scss';\nimport Edit from './edit';\nimport metadata from './block.json';\nconst save = ( props ) => null;\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n\tsave: save,\n} );\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkqsm\"] = self[\"webpackChunkqsm\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], function() { return __webpack_require__(\"./src/index.js\"); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","useInnerBlocksProps","store","noticesStore","useDispatch","useSelect","PanelBody","Button","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Placeholder","Icon","__experimentalVStack","VStack","qsmIsEmpty","qsmFormData","qsmUniqid","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","createNotice","quizID","quizAttr","setQuizAttr","globalQuizsetting","quizList","setQuizList","QSMQuizList","quizMessage","setQuizMessage","error","msg","createQuiz","setCreateQuiz","saveQuiz","setSaveQuiz","showAdvanceOption","setShowAdvanceOption","quizTemplate","setQuizTemplate","quizOptions","shouldSetQSMAttr","quiz_id","path","method","data","then","res","console","log","status","result","qpages","quizTemp","forEach","page","questions","question_arr","question","answers","length","answer","aIndex","push","optionID","content","points","isCorrect","questionID","question_id","type","question_type_new","answerEditor","settings","title","question_title","description","question_name","required","hint","hints","correctAnswerInfo","question_answer_info","category","multicategories","commentBox","comments","matchAnswer","featureImageID","featureImageSrc","pageID","id","pageKey","pagekey","hidePrevBtn","hide_prevbtn","feedbackIcon","createElement","icon","size","quizPlaceholder","label","instructions","Fragment","value","options","onChange","disabled","__nextHasNoMarginBottom","variant","onClick","spacing","help","quiz_name","val","setQuizAttributes","form_type","system","map","item","key","checked","createNewQuiz","attr_name","newAttr","quizData","qsm_new_quiz_nonce","append","body","newQuestion","response","newPage","save_pages_action","saveNonce","quizPostID","url","ajax_url","pageResponse","catch","message","isDismissible","blockProps","innerBlocksProps","template","allowedBlocks","initialOpen","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","obj","newData","FormData","k","hasOwnProperty","prefix","random","sec","Date","now","Math","toString","padEnd","trunc","registerBlockType","metadata","save","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AACb;AAOX;AAC0B;AACF;AACA;AAa1B;AACR;AAC0D;AAClE,SAAS8B,IAAIA,CAAEC,KAAK,EAAG;EACrC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGN,KAAK;EAC5E,MAAM;IAAEO;EAAa,CAAC,GAAG3B,4DAAW,CAAED,qDAAa,CAAC;EACpD,MAAM;IACL6B;EACD,CAAC,GAAGL,UAAU;;EAEd;EACA,MAAM,CAAEM,QAAQ,EAAEC,WAAW,CAAE,GAAGxC,4DAAQ,CAAE+B,YAAY,CAACU,iBAAkB,CAAC;EAC5E;EACA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BAAkB,qBAAqB;WACvC,oHAAoH,iDAAiD;WACrK;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,8CAA8C;;WAE9C;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,iCAAiC,mCAAmC;WACpE;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA,2FAA2F,+CAA+C;UAC1I","sources":["webpack://qsm/./src/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/./src/index.js","webpack://qsm/./src/editor.scss","webpack://qsm/./src/style.scss","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/chunk loaded","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/webpack/runtime/jsonp chunk loading","webpack://qsm/webpack/before-startup","webpack://qsm/webpack/startup","webpack://qsm/webpack/after-startup"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport {\n\tPanelBody,\n\tButton,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n\tPlaceholder,\n\tIcon,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport './editor.scss';\nimport { qsmIsEmpty, qsmFormData, qsmUniqid, qsmValueOrDefault } from './helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId } = props;\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tquizID \n\t} = attributes;\n\n\t//quiz attribute\n\tconst [ quizAttr, setQuizAttr ] = useState( qsmBlockData.globalQuizsetting );\n\t//quiz list\n\tconst [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList );\n\t//quiz list\n\tconst [ quizMessage, setQuizMessage ] = useState( {\n\t\terror: false,\n\t\tmsg: ''\n\t} );\n\t//weather creating a new quiz\n\tconst [ createQuiz, setCreateQuiz ] = useState( false );\n\t//weather saving quiz\n\tconst [ saveQuiz, setSaveQuiz ] = useState( false );\n\t//weather to show advance option\n\tconst [ showAdvanceOption, setShowAdvanceOption ] = useState( false );\n\t//Quiz template on set Quiz ID\n\tconst [ quizTemplate, setQuizTemplate ] = useState( [] );\n\t//Quiz Options to create attributes label, description and layout\n\tconst quizOptions = qsmBlockData.quizOptions;\n\n\t//check if page is saving\n\tconst isSavingPage = useSelect( ( select ) => {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() || isAutosavingPost();\n\t}, [] );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\t/**\n\t * Prepare quiz data e.g. quiz details, questions, answers etc to save \n\t * @returns quiz data\n\t */\n\tconst getQuizDataToSave = ( ) => {\t\n\t\tlet blocks = getBlock( clientId ); \n\t\tif ( qsmIsEmpty( blocks ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconsole.log( \"blocks\", blocks);\n\t\tblocks = blocks.innerBlocks;\n\t\tlet quizDataToSave = {\n\t\t\tquiz_id: quizAttr.quiz_id,\n\t\t\tpost_id: quizAttr.post_id,\n\t\t\tquiz:{},\n\t\t\tpages:[],\n\t\t\tqpages:[],\n\t\t\tquestions:[]\n\t\t};\n\t\tlet pageSNo = 0;\n\t\t//loop through inner blocks\n\t\tblocks.forEach( (block) => {\n\t\t\tif ( 'qsm/quiz-page' === block.name ) {\n\t\t\t\tlet pageID = block.attributes.pageID;\n\t\t\t\tlet questions = [];\n\t\t\t\tif ( ! qsmIsEmpty( block.innerBlocks ) && 0 < block.innerBlocks.length ) { \n\t\t\t\t\tlet questionBlocks = block.innerBlocks;\n\t\t\t\t\t//Question Blocks\n\t\t\t\t\tquestionBlocks.forEach( ( questionBlock ) => {\n\t\t\t\t\t\tif ( 'qsm/quiz-question' !== questionBlock.name ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet answers = [];\n\t\t\t\t\t\t//Answer option blocks\n\t\t\t\t\t\tif ( ! qsmIsEmpty( questionBlock.innerBlocks ) && 0 < questionBlock.innerBlocks.length ) { \n\t\t\t\t\t\t\tlet answerOptionBlocks = questionBlock.innerBlocks;\n\t\t\t\t\t\t\tanswerOptionBlocks.forEach( ( answerOptionBlock ) => {\n\t\t\t\t\t\t\t\tif ( 'qsm/quiz-answer-option' !== answerOptionBlock.name ) {\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlet answerAttr = answerOptionBlock.attributes;\n\t\t\t\t\t\t\t\tanswers.push([\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.content ),\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.points ),\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.isCorrect ),\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t//questions Data\n\t\t\t\t\t\tlet questionAttr = questionBlock.attributes;\n\t\t\t\t\t\tquestions.push( questionAttr.questionID );\n\t\t\t\t\t\tquizDataToSave.questions.push({\n\t\t\t\t\t\t\t\"id\": questionAttr.questionID,\n\t\t\t\t\t\t\t\"quizID\": quizAttr.quiz_id,\n\t\t\t\t\t\t\t\"postID\": quizAttr.post_id,\n\t\t\t\t\t\t\t\"type\": qsmValueOrDefault( questionAttr?.type , '0' ),\n\t\t\t\t\t\t\t\"name\": qsmValueOrDefault( questionAttr?.description ),\n\t\t\t\t\t\t\t\"question_title\": qsmValueOrDefault( questionAttr?.title ),\n\t\t\t\t\t\t\t\"answerInfo\": qsmValueOrDefault( questionAttr?.correctAnswerInfo ),\n\t\t\t\t\t\t\t\"comments\": qsmValueOrDefault( questionAttr?.commentBox, '1' ),\n\t\t\t\t\t\t\t\"hint\": qsmValueOrDefault( questionAttr?.hint ),\n\t\t\t\t\t\t\t\"category\": qsmValueOrDefault( questionAttr?.category ),\n\t\t\t\t\t\t\t\"required\": qsmValueOrDefault( questionAttr?.required, 1 ),\n\t\t\t\t\t\t\t\"answers\": answers,\n\t\t\t\t\t\t\t\"page\": pageSNo\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// pages[0][]: 2512\n\t\t\t\t// \tqpages[0][id]: 2\n\t\t\t\t// \tqpages[0][quizID]: 76\n\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\n\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\n\t\t\t\t// \tqpages[0][questions][]: 2512\n\t\t\t\t// \tpost_id: 111\n\t\t\t\t//page data\n\t\t\t\tquizDataToSave.pages.push( questions );\n\t\t\t\tquizDataToSave.qpages.push( {\n\t\t\t\t\t'id': pageID,\n\t\t\t\t\t'quizID': quizAttr.quiz_id,\n\t\t\t\t\t'pagekey': block.attributes.pageKey,\n\t\t\t\t\t'hide_prevbtn':block.attributes.hidePrevBtn,\n\t\t\t\t\t'questions': questions\n\t\t\t\t} );\n\t\t\t\tpageSNo++;\n\t\t\t}\n\t\t});\n\n\t\t//Quiz details\n\t\tquizDataToSave.quiz = { \n\t\t\t'quiz_name': quizAttr.quiz_name,\n\t\t\t'quiz_id': quizAttr.quiz_id,\n\t\t\t'post_id': quizAttr.post_id,\n\t\t};\n\t\tif ( showAdvanceOption ) {\n\t\t\t[\n\t\t\t'form_type', \n\t\t\t'system', \n\t\t\t'timer_limit', \n\t\t\t'pagination',\n\t\t\t'enable_contact_form', \n\t\t\t'enable_pagination_quiz', \n\t\t\t'show_question_featured_image_in_result',\n\t\t\t'progress_bar',\n\t\t\t'require_log_in',\n\t\t\t'disable_first_page',\n\t\t\t'comment_section'\n\t\t\t].forEach( ( item ) => { \n\t\t\t\tif ( 'undefined' !== typeof quizAttr[ item ] && null !== quizAttr[ item ] ) {\n\t\t\t\t\tquizDataToSave.quiz[ item ] = quizAttr[ item ];\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn quizDataToSave;\n\t}\n\n\t//saving Quiz on save page\n\tuseEffect( () => {\n\t\tif ( isSavingPage ) {\n\t\t\tlet qsmData = getQuizDataToSave();\n\t\t\tconsole.log(\"qsmData\",qsmData);\n\t\t}\n\t}, [ isSavingPage ] );\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\tif ( ! qsmIsEmpty( quizID ) && 0 < quizID && ( qsmIsEmpty( quizAttr ) || qsmIsEmpty( quizAttr?.quizID ) || quizID != quizAttr.quiz_id ) ) {\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/quiz/structure',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: { quizID: quizID },\n\t\t\t\t} ).then( ( res ) => {\n\t\t\t\t\tconsole.log( res );\n\t\t\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t\t\tlet result = res.result;\n\t\t\t\t\t\tsetQuizAttr( {\n\t\t\t\t\t\t\t...quizAttr,\n\t\t\t\t\t\t\t...result\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( ! qsmIsEmpty( result.qpages ) ) {\n\t\t\t\t\t\t\tlet quizTemp = [];\n\t\t\t\t\t\t\tresult.qpages.forEach( page => {\n\t\t\t\t\t\t\t\tlet questions = [];\n\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( page.question_arr ) ) {\n\t\t\t\t\t\t\t\t\tpage.question_arr.forEach( question => {\n\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question ) ) {\n\t\t\t\t\t\t\t\t\t\t\tlet answers = [];\n\t\t\t\t\t\t\t\t\t\t\t//answers options blocks\n\t\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tquestion.answers.forEach( ( answer, aIndex ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-answer-option',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptionID:aIndex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontent:answer[0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoints:answer[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect:answer[2]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t//question blocks\n\t\t\t\t\t\t\t\t\t\t\tquestions.push(\n\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-question',\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquestionID: question.question_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: question.question_type_new,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswerEditor: question.settings.answerEditor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: question.settings.question_title,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: question.question_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: question.settings.required,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thint:question.hints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswers: question.answers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcorrectAnswerInfo:question.question_answer_info,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcategory:question.category,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmulticategories:question.multicategories,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcommentBox: question.comments,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatchAnswer: question.settings.matchAnswer,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageID: question.settings.featureImageID,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageSrc: question.settings.featureImageSrc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings: question.settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers\n\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//console.log(\"page\",page);\n\t\t\t\t\t\t\t\tquizTemp.push(\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'qsm/quiz-page',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpageID:page.id,\n\t\t\t\t\t\t\t\t\t\t\tpageKey: page.pagekey,\n\t\t\t\t\t\t\t\t\t\t\thidePrevBtn: page.hide_prevbtn,\n\t\t\t\t\t\t\t\t\t\t\tquizID: page.quizID\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tquestions\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsetQuizTemplate( quizTemp );\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// QSM_QUIZ = [\n\t\t\t\t\t\t// \t[\n\n\t\t\t\t\t\t// \t]\n\t\t\t\t\t\t// ];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log( \"error \"+ res.msg );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\t/**\n\t * vault dash Icon\n\t * @returns vault dash Icon\n\t */\n\tconst feedbackIcon = () => (\n\t\n\t);\n\n\t/**\n\t * \n\t * @returns Placeholder for quiz in case quiz ID is not set\n\t */\n\tconst quizPlaceholder = ( ) => {\n\t\treturn (\n\t\t\t\n\t\t\t\t{\n\t\t\t\t\t<>\n\t\t\t\t\t{ ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& \n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( { quizID } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdisabled={ createQuiz }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t\t{ __( 'OR', 'quiz-master-next' ) }\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t}\n\t\t\t\t\t{ ( qsmIsEmpty( quizList ) || createQuiz ) &&\n\t\t\t\t\t\n\t\t\t\t\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ showAdvanceOption && (<>\n\t\t\t\t\t\t\t{/**Form Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'form_type') }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{/**Grading Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'system') }\n\t\t\t\t\t\t\t\thelp={ quizOptions?.system?.help }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'timer_limit', \n\t\t\t\t\t\t\t\t\t'pagination',\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t\t setQuizAttributes( val, item) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'enable_contact_form', \n\t\t\t\t\t\t\t\t\t'enable_pagination_quiz', \n\t\t\t\t\t\t\t\t\t'show_question_featured_image_in_result',\n\t\t\t\t\t\t\t\t\t'progress_bar',\n\t\t\t\t\t\t\t\t\t'require_log_in',\n\t\t\t\t\t\t\t\t\t'disable_first_page',\n\t\t\t\t\t\t\t\t\t'comment_section'\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t setQuizAttributes( ( ( ! qsmIsEmpty( quizAttr[item] ) && '1' == quizAttr[item] ) ? 0 : 1 ), item ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t }\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t);\n\t};\n\n\t/**\n\t * Set attribute value\n\t * @param { any } value attribute value to set\n\t * @param { string } attr_name attribute name\n\t */\n\tconst setQuizAttributes = ( value , attr_name ) => {\n\t\tlet newAttr = quizAttr;\n\t\tnewAttr[ attr_name ] = value;\n\t\tsetQuizAttr( { ...newAttr } );\n\t}\n\n\tconst createNewQuiz = () => {\n\t\tif ( qsmIsEmpty( quizAttr.quiz_name ) ) {\n\t\t\tconsole.log(\"empty quiz_name\");\n\t\t\treturn;\n\t\t}\n\t\t//save quiz status\n\t\tsetSaveQuiz( true );\n\t\t// let quizData = {\n\t\t// \t\"quiz_name\": quizAttr.quiz_name,\n\t\t// \t\"qsm_new_quiz_nonce\": qsmBlockData.qsm_new_quiz_nonce\n\t\t// };\n\t\tlet quizData = qsmFormData({\n\t\t\t'quiz_name': quizAttr.quiz_name,\n\t\t\t'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce\n\t\t});\n\t\t\n\t\tif ( showAdvanceOption ) {\n\t\t\t['form_type', \n\t\t\t'system', \n\t\t\t'timer_limit', \n\t\t\t'pagination',\n\t\t\t'enable_contact_form', \n\t\t\t'enable_pagination_quiz', \n\t\t\t'show_question_featured_image_in_result',\n\t\t\t'progress_bar',\n\t\t\t'require_log_in',\n\t\t\t'disable_first_page',\n\t\t\t'comment_section'\n\t\t\t].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) );\n\t\t}\n\n\t\t//AJAX call\n\t\tapiFetch( {\n\t\t\tpath: '/quiz-survey-master/v1/quiz/create_quiz',\n\t\t\tmethod: 'POST',\n\t\t\tbody: quizData\n\t\t} ).then( ( res ) => {\n\t\t\tconsole.log( res );\n\t\t\t//save quiz status\n\t\t\tsetSaveQuiz( false );\n\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t//create a question\n\t\t\t\tlet newQuestion = qsmFormData( {\n\t\t\t\t\t\"id\": null,\n\t\t\t\t\t\"quizID\": res.quizID,\n\t\t\t\t\t\"type\": \"0\",\n\t\t\t\t\t\"name\": \"\",\n\t\t\t\t\t\"question_title\": \"\",\n\t\t\t\t\t\"answerInfo\": \"\",\n\t\t\t\t\t\"comments\": \"1\",\n\t\t\t\t\t\"hint\": \"\",\n\t\t\t\t\t\"category\": \"\",\n\t\t\t\t\t\"required\": 1,\n\t\t\t\t\t\"answers\": [],\n\t\t\t\t\t\"page\": 0\n\t\t\t\t} );\n\t\t\t\t//AJAX call\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: newQuestion\n\t\t\t\t} ).then( ( response ) => {\n\t\t\t\t\tconsole.log(\"question response\", response);\n\t\t\t\t\tif ( 'success' == response.status ) {\n\t\t\t\t\t\tlet question_id = response.id;\n\n\t\t\t\t\t\t/**Page attributes required format */\n\t\t\t\t\t\t// pages[0][]: 2512\n\t\t\t\t\t\t// \tqpages[0][id]: 2\n\t\t\t\t\t\t// \tqpages[0][quizID]: 76\n\t\t\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\n\t\t\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\n\t\t\t\t\t\t// \tqpages[0][questions][]: 2512\n\t\t\t\t\t\t// \tpost_id: 111\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet newPage = qsmFormData( {\n\t\t\t\t\t\t\t\"action\": qsmBlockData.save_pages_action,\n\t\t\t\t\t\t\t\"quiz_id\": res.quizID,\n\t\t\t\t\t\t\t\"nonce\": qsmBlockData.saveNonce,\n\t\t\t\t\t\t\t\"post_id\": res.quizPostID,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tnewPage.append( 'pages[0][]', question_id );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][id]', 1 );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][quizID]', res.quizID );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][pagekey]', qsmUniqid() );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][hide_prevbtn]', 0 );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][questions][]', question_id );\n\n\n\t\t\t\t\t\t//create a page\n\t\t\t\t\t\tapiFetch( {\n\t\t\t\t\t\t\turl: qsmBlockData.ajax_url,\n\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\tbody: newPage\n\t\t\t\t\t\t} ).then( ( pageResponse ) => {\n\t\t\t\t\t\t\tconsole.log(\"pageResponse\", pageResponse);\n\t\t\t\t\t\t\tif ( 'success' == pageResponse.status ) {\n\t\t\t\t\t\t\t\t//set new quiz ID\n\t\t\t\t\t\t\t\tsetAttributes( { quizID: res.quizID } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}).catch(\n\t\t\t\t\t( error ) => {\n\t\t\t\t\t\tconsole.log( 'error',error );\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\n\t\t\t\t\t\t\tisDismissible: true,\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t\n\t\t\t} \n\n\t\t\t//create notice\n\t\t\tcreateNotice( res.status, res.msg, {\n\t\t\t\tisDismissible: true,\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} ).catch(\n\t\t\t( error ) => {\n\t\t\t\tconsole.log( 'error',error );\n\t\t\t\tcreateNotice( 'error', error.message, {\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\t \n\t}\n\n\t/**\n\t * Inner Blocks\n\t */\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: quizTemplate,\n\t\tallowedBlocks : [\n\t\t\t'qsm/quiz-page'\n\t\t]\n\t} );\n\t\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t/>\n\t\t\n\t\n\t{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? \n quizPlaceholder() \n\t:\n\t
\n\t}\n\t\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\n//generate uiniq id\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};\n\n//return data if not empty otherwise default value\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { registerBlockType } from '@wordpress/blocks';\nimport './style.scss';\nimport Edit from './edit';\nimport metadata from './block.json';\nconst save = ( props ) => null;\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n\tsave: save,\n} );\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkqsm\"] = self[\"webpackChunkqsm\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], function() { return __webpack_require__(\"./src/index.js\"); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","store","blockEditorStore","useInnerBlocksProps","noticesStore","useDispatch","useSelect","editorStore","PanelBody","Button","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Placeholder","Icon","__experimentalVStack","VStack","qsmIsEmpty","qsmFormData","qsmUniqid","qsmValueOrDefault","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","createNotice","quizID","quizAttr","setQuizAttr","globalQuizsetting","quizList","setQuizList","QSMQuizList","quizMessage","setQuizMessage","error","msg","createQuiz","setCreateQuiz","saveQuiz","setSaveQuiz","showAdvanceOption","setShowAdvanceOption","quizTemplate","setQuizTemplate","quizOptions","isSavingPage","select","isAutosavingPost","isSavingPost","getBlock","getQuizDataToSave","blocks","console","log","innerBlocks","quizDataToSave","quiz_id","post_id","quiz","pages","qpages","questions","pageSNo","forEach","block","name","pageID","length","questionBlocks","questionBlock","answers","answerOptionBlocks","answerOptionBlock","answerAttr","push","content","points","isCorrect","questionAttr","questionID","type","description","title","correctAnswerInfo","commentBox","hint","category","required","pageKey","hidePrevBtn","quiz_name","item","qsmData","shouldSetQSMAttr","path","method","data","then","res","status","result","quizTemp","page","question_arr","question","answer","aIndex","optionID","question_id","question_type_new","answerEditor","settings","question_title","question_name","hints","question_answer_info","multicategories","comments","matchAnswer","featureImageID","featureImageSrc","id","pagekey","hide_prevbtn","feedbackIcon","createElement","icon","size","quizPlaceholder","label","instructions","Fragment","value","options","onChange","disabled","__nextHasNoMarginBottom","variant","onClick","spacing","help","val","setQuizAttributes","form_type","system","map","key","checked","createNewQuiz","attr_name","newAttr","quizData","qsm_new_quiz_nonce","append","body","newQuestion","response","newPage","save_pages_action","saveNonce","quizPostID","url","ajax_url","pageResponse","catch","message","isDismissible","blockProps","innerBlocksProps","template","allowedBlocks","initialOpen","qsmSanitizeName","toLowerCase","replace","qsmStripTags","text","obj","newData","FormData","k","hasOwnProperty","prefix","random","sec","Date","now","Math","toString","padEnd","trunc","defaultValue","registerBlockType","metadata","save","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/page/index.asset.php b/blocks/build/page/index.asset.php index 2bbb93bf5..d02e761a2 100644 --- a/blocks/build/page/index.asset.php +++ b/blocks/build/page/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '1539da1fe8c77d325d58'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '8aa5c6f7feef0dd2a483'); diff --git a/blocks/build/page/index.js b/blocks/build/page/index.js index 35a00e2a4..942d49829 100644 --- a/blocks/build/page/index.js +++ b/blocks/build/page/index.js @@ -14,7 +14,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, /* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, /* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; } +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, +/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } /* harmony export */ }); //Check if undefined, null, empty const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; @@ -44,12 +45,17 @@ const qsmFormData = (obj = false) => { } return newData; }; + +//generate uiniq id const qsmUniqid = (prefix = "", random = false) => { const sec = Date.now() * 1000 + Math.random() * 1000; const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; }; +//return data if not empty otherwise default value +const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; + /***/ }), /***/ "./src/page/edit.js": diff --git a/blocks/build/page/index.js.map b/blocks/build/page/index.js.map index adc2063e8..22e20b10d 100644 --- a/blocks/build/page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,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCC,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAE7B,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/page/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/page/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty } from '../helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\t\n\tconst {\n\t\tpageID,\n\t\tpageKey,\n\t\thidePrevBtn,\n\t} = attributes;\n\n\tconst [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting );\n\t\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\t\t\t//console.log(\"attr\",attributes);\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { pageKey } ) }\n\t\t\t/>\n\t\t\t setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\t\n\t\n\t
\n\t\t\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","quizID","pageID","pageKey","hidePrevBtn","qsmPageAttr","setQsmPageAttr","globalQuizsetting","shouldSetQSMAttr","blockProps","createElement","Fragment","title","initialOpen","label","value","onChange","checked","allowedBlocks","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"page/index.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;AAE9F,MAAMC,eAAe,GAAKC,IAAI,IAAM;EAC1C,IAAKH,UAAU,CAAEG,IAAK,CAAC,EAAG;IACzBA,IAAI,GAAG,EAAE;EACV,CAAC,MAAM;IACNA,IAAI,GAAGA,IAAI,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,IAAI,EAAE,GAAI,CAAC;IAC9CF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAC/B;EAEA,OAAOF,IAAI;AACZ,CAAC;;AAED;AACO,MAAMG,YAAY,GAAKC,IAAI,IAAMA,IAAI,CAACF,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;;AAE1E;AACO,MAAMG,WAAW,GAAGA,CAAEC,GAAG,GAAG,KAAK,KAAM;EAC7C,IAAIC,OAAO,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAC5BD,OAAO,CAACE,MAAM,CAAC,oBAAoB,EAAE,GAAG,CAAC;EACzC,IAAK,KAAK,KAAKH,GAAG,EAAG;IACpB,KAAM,IAAII,CAAC,IAAIJ,GAAG,EAAG;MACpB,IAAKA,GAAG,CAACK,cAAc,CAAED,CAAE,CAAC,EAAG;QAC5BH,OAAO,CAACE,MAAM,CAAEC,CAAC,EAAEJ,GAAG,CAACI,CAAC,CAAE,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;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCC,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAE7B,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/page/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/page/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\n//generate uiniq id\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};\n\n//return data if not empty otherwise default value\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty } from '../helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\t\n\tconst {\n\t\tpageID,\n\t\tpageKey,\n\t\thidePrevBtn,\n\t} = attributes;\n\n\tconst [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting );\n\t\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\t\t\t//console.log(\"attr\",attributes);\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { pageKey } ) }\n\t\t\t/>\n\t\t\t setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\t\n\t\n\t
\n\t\t\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","quizID","pageID","pageKey","hidePrevBtn","qsmPageAttr","setQsmPageAttr","globalQuizsetting","shouldSetQSMAttr","blockProps","createElement","Fragment","title","initialOpen","label","value","onChange","checked","allowedBlocks","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php index 455f59020..ef7af930b 100644 --- a/blocks/build/question/index.asset.php +++ b/blocks/build/question/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '06faf5faf439152da8ef'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '36976c975b9d27a90caf'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 6cd6b44b0..8489b36f8 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -14,7 +14,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, /* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, /* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; } +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, +/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } /* harmony export */ }); //Check if undefined, null, empty const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; @@ -44,12 +45,17 @@ const qsmFormData = (obj = false) => { } return newData; }; + +//generate uiniq id const qsmUniqid = (prefix = "", random = false) => { const sec = Date.now() * 1000 + Math.random() * 1000; const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; }; +//return data if not empty otherwise default value +const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; + /***/ }), /***/ "./src/question/edit.js": diff --git a/blocks/build/question/index.js.map b/blocks/build/question/index.js.map index c1cdd3f74..fd19f3581 100644 --- a/blocks/build/question/index.js.map +++ b/blocks/build/question/index.js.map @@ -1 +1 @@ -{"version":3,"file":"question/index.js","mappings":";;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;AAE9F,MAAMC,eAAe,GAAKC,IAAI,IAAM;EAC1C,IAAKH,UAAU,CAAEG,IAAK,CAAC,EAAG;IACzBA,IAAI,GAAG,EAAE;EACV,CAAC,MAAM;IACNA,IAAI,GAAGA,IAAI,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,IAAI,EAAE,GAAI,CAAC;IAC9CF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;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C+E,WAAW,EAAI/E,mDAAE,CAAE,gBAAgB,EAAE,kBAAmB,CAAG;IAC3D4D,KAAK,EAAGlB,IAAM;IACd0B,QAAQ,EAAK1B,IAAI,IAAMjB,aAAa,CAAE;MAAEiB,IAAI,EAAE9D,qDAAY,CAAE8D,IAAK;IAAE,CAAE,CAAG;IACxEsC,cAAc,EAAG,EAAK;IACtBC,4BAA4B;IAC5B1D,SAAS,EAAG;EAAqB,CACjC,CACC,CAEC,CACH,CAAC;AAEJ;;;;;;;;;;ACvNA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpC+D,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAEpE,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/question/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/question/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\n/**\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\n * \n */\n\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\t\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\t\n\tconst {\n\t\tquestionID,\n\t\ttype,\n\t\tdescription,\n\t\ttitle,\n\t\tcorrectAnswerInfo,\n\t\tcommentBox,\n\t\tcategory,\n\t\tmulticategories,\n\t\thint,\n\t\tfeatureImageID,\n\t\tfeatureImageSrc,\n\t\tanswers,\n\t\tanswerEditor,\n\t\tmatchAnswer,\n\t\totherSettings,\n\t\tsettings,\n\t} = attributes;\n\n\tconst [ quesAttr, setQuesAttr ] = useState( settings );\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = ( html ) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\n\tconst QUESTION_TEMPLATE = [\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'0'\n\t\t\t}\n\t\t],\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'1'\n\t\t\t}\n\t\t]\n\n\t];\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\n\t\t{ /** Question Type **/ }\n\t\t\n\t\t\t\tsetAttributes( { type } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t{\n\t\t\t ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \n\t\t\t\t(\n\t\t\t\t\n\t\t\t\t\t{\n\t\t\t\t\t\tqtypes.types.map( qtype => \n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t \t\n\t\t{/**Answer Type */}\n\t\t\n\t\t\t\tsetAttributes( { answerEditor } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t
\n\t\t{/**Comment Box */}\n\t\t\n\t\t\n\t\t\t\tsetAttributes( { commentBox } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t\n\t
\n\t
\n\t\t setAttributes( { title: qsmStripTags( title ) } ) }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-title' }\n\t\t/>\n\t\t{\n\t\t\tisParentOfSelectedBlock && \n\t\t\t<>\n\t\t\t setAttributes({ description }) }\n\t\t\t\tclassName={ 'qsm-question-description' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t\n\t\t\t setAttributes({ correctAnswerInfo }) }\n\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\n\t\t\t\tallowedFormats={ [ ] }\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\tclassName={ 'qsm-question-hint' }\n\t\t\t/>\n\t\t\t\n\t\t}\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","select","hasSelectedInnerBlock","quizID","pageID","questionID","type","description","title","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageID","featureImageSrc","answers","answerEditor","matchAnswer","otherSettings","settings","quesAttr","setQuesAttr","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","QUESTION_TEMPLATE","optionID","Fragment","initialOpen","label","question_type","default","onChange","__nextHasNoMarginBottom","options","map","qtypes","key","types","qtype","slug","heading","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"question/index.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;AAE9F,MAAMC,eAAe,GAAKC,IAAI,IAAM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;;;ACNsD;AAC5B;AACU;AAEpC+D,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAEpE,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/question/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/question/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\n//generate uiniq id\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};\n\n//return data if not empty otherwise default value\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\n/**\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\n * \n */\n\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\t\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\t\n\tconst {\n\t\tquestionID,\n\t\ttype,\n\t\tdescription,\n\t\ttitle,\n\t\tcorrectAnswerInfo,\n\t\tcommentBox,\n\t\tcategory,\n\t\tmulticategories,\n\t\thint,\n\t\tfeatureImageID,\n\t\tfeatureImageSrc,\n\t\tanswers,\n\t\tanswerEditor,\n\t\tmatchAnswer,\n\t\totherSettings,\n\t\tsettings,\n\t} = attributes;\n\n\tconst [ quesAttr, setQuesAttr ] = useState( settings );\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = ( html ) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\n\tconst QUESTION_TEMPLATE = [\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'0'\n\t\t\t}\n\t\t],\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'1'\n\t\t\t}\n\t\t]\n\n\t];\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\n\t\t{ /** Question Type **/ }\n\t\t\n\t\t\t\tsetAttributes( { type } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t{\n\t\t\t ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \n\t\t\t\t(\n\t\t\t\t\n\t\t\t\t\t{\n\t\t\t\t\t\tqtypes.types.map( qtype => \n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t \t\n\t\t{/**Answer Type */}\n\t\t\n\t\t\t\tsetAttributes( { answerEditor } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t
\n\t\t{/**Comment Box */}\n\t\t\n\t\t\n\t\t\t\tsetAttributes( { commentBox } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t\n\t
\n\t
\n\t\t setAttributes( { title: qsmStripTags( title ) } ) }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-title' }\n\t\t/>\n\t\t{\n\t\t\tisParentOfSelectedBlock && \n\t\t\t<>\n\t\t\t setAttributes({ description }) }\n\t\t\t\tclassName={ 'qsm-question-description' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t\n\t\t\t setAttributes({ correctAnswerInfo }) }\n\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\n\t\t\t\tallowedFormats={ [ ] }\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\tclassName={ 'qsm-question-hint' }\n\t\t\t/>\n\t\t\t\n\t\t}\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","select","hasSelectedInnerBlock","quizID","pageID","questionID","type","description","title","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageID","featureImageSrc","answers","answerEditor","matchAnswer","otherSettings","settings","quesAttr","setQuesAttr","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","QUESTION_TEMPLATE","optionID","Fragment","initialOpen","label","question_type","default","onChange","__nextHasNoMarginBottom","options","map","qtypes","key","types","qtype","slug","heading","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/src/edit.js b/blocks/src/edit.js index 0e188df70..c4e0c34d6 100644 --- a/blocks/src/edit.js +++ b/blocks/src/edit.js @@ -5,10 +5,12 @@ import { InspectorControls, InnerBlocks, useBlockProps, + store as blockEditorStore, useInnerBlocksProps, } from '@wordpress/block-editor'; import { store as noticesStore } from '@wordpress/notices'; import { useDispatch, useSelect } from '@wordpress/data'; +import { store as editorStore } from '@wordpress/editor'; import { PanelBody, Button, @@ -23,7 +25,7 @@ import { __experimentalVStack as VStack, } from '@wordpress/components'; import './editor.scss'; -import { qsmIsEmpty, qsmFormData, qsmUniqid } from './helper'; +import { qsmIsEmpty, qsmFormData, qsmUniqid, qsmValueOrDefault } from './helper'; export default function Edit( props ) { //check for QSM initialize data if ( 'undefined' === typeof qsmBlockData ) { @@ -56,6 +58,140 @@ export default function Edit( props ) { //Quiz Options to create attributes label, description and layout const quizOptions = qsmBlockData.quizOptions; + //check if page is saving + const isSavingPage = useSelect( ( select ) => { + const { isAutosavingPost, isSavingPost } = select( editorStore ); + return isSavingPost() || isAutosavingPost(); + }, [] ); + + const { getBlock } = useSelect( blockEditorStore ); + + /** + * Prepare quiz data e.g. quiz details, questions, answers etc to save + * @returns quiz data + */ + const getQuizDataToSave = ( ) => { + let blocks = getBlock( clientId ); + if ( qsmIsEmpty( blocks ) ) { + return false; + } + console.log( "blocks", blocks); + blocks = blocks.innerBlocks; + let quizDataToSave = { + quiz_id: quizAttr.quiz_id, + post_id: quizAttr.post_id, + quiz:{}, + pages:[], + qpages:[], + questions:[] + }; + let pageSNo = 0; + //loop through inner blocks + blocks.forEach( (block) => { + if ( 'qsm/quiz-page' === block.name ) { + let pageID = block.attributes.pageID; + let questions = []; + if ( ! qsmIsEmpty( block.innerBlocks ) && 0 < block.innerBlocks.length ) { + let questionBlocks = block.innerBlocks; + //Question Blocks + questionBlocks.forEach( ( questionBlock ) => { + if ( 'qsm/quiz-question' !== questionBlock.name ) { + return true; + } + let answers = []; + //Answer option blocks + if ( ! qsmIsEmpty( questionBlock.innerBlocks ) && 0 < questionBlock.innerBlocks.length ) { + let answerOptionBlocks = questionBlock.innerBlocks; + answerOptionBlocks.forEach( ( answerOptionBlock ) => { + if ( 'qsm/quiz-answer-option' !== answerOptionBlock.name ) { + return true; + } + let answerAttr = answerOptionBlock.attributes; + answers.push([ + qsmValueOrDefault( answerAttr?.content ), + qsmValueOrDefault( answerAttr?.points ), + qsmValueOrDefault( answerAttr?.isCorrect ), + ]); + }); + } + + //questions Data + let questionAttr = questionBlock.attributes; + questions.push( questionAttr.questionID ); + quizDataToSave.questions.push({ + "id": questionAttr.questionID, + "quizID": quizAttr.quiz_id, + "postID": quizAttr.post_id, + "type": qsmValueOrDefault( questionAttr?.type , '0' ), + "name": qsmValueOrDefault( questionAttr?.description ), + "question_title": qsmValueOrDefault( questionAttr?.title ), + "answerInfo": qsmValueOrDefault( questionAttr?.correctAnswerInfo ), + "comments": qsmValueOrDefault( questionAttr?.commentBox, '1' ), + "hint": qsmValueOrDefault( questionAttr?.hint ), + "category": qsmValueOrDefault( questionAttr?.category ), + "required": qsmValueOrDefault( questionAttr?.required, 1 ), + "answers": answers, + "page": pageSNo + }); + }); + } + + // pages[0][]: 2512 + // qpages[0][id]: 2 + // qpages[0][quizID]: 76 + // qpages[0][pagekey]: Ipj90nNT + // qpages[0][hide_prevbtn]: 0 + // qpages[0][questions][]: 2512 + // post_id: 111 + //page data + quizDataToSave.pages.push( questions ); + quizDataToSave.qpages.push( { + 'id': pageID, + 'quizID': quizAttr.quiz_id, + 'pagekey': block.attributes.pageKey, + 'hide_prevbtn':block.attributes.hidePrevBtn, + 'questions': questions + } ); + pageSNo++; + } + }); + + //Quiz details + quizDataToSave.quiz = { + 'quiz_name': quizAttr.quiz_name, + 'quiz_id': quizAttr.quiz_id, + 'post_id': quizAttr.post_id, + }; + if ( showAdvanceOption ) { + [ + 'form_type', + 'system', + 'timer_limit', + 'pagination', + 'enable_contact_form', + 'enable_pagination_quiz', + 'show_question_featured_image_in_result', + 'progress_bar', + 'require_log_in', + 'disable_first_page', + 'comment_section' + ].forEach( ( item ) => { + if ( 'undefined' !== typeof quizAttr[ item ] && null !== quizAttr[ item ] ) { + quizDataToSave.quiz[ item ] = quizAttr[ item ]; + } + }); + } + return quizDataToSave; + } + + //saving Quiz on save page + useEffect( () => { + if ( isSavingPage ) { + let qsmData = getQuizDataToSave(); + console.log("qsmData",qsmData); + } + }, [ isSavingPage ] ); + /**Initialize block from server */ useEffect( () => { let shouldSetQSMAttr = true; diff --git a/blocks/src/helper.js b/blocks/src/helper.js index 26af818fc..7c04bb359 100644 --- a/blocks/src/helper.js +++ b/blocks/src/helper.js @@ -29,8 +29,12 @@ export const qsmFormData = ( obj = false ) => { return newData; } +//generate uiniq id export const qsmUniqid = (prefix = "", random = false) => { const sec = Date.now() * 1000 + Math.random() * 1000; const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:""}`; -}; \ No newline at end of file +}; + +//return data if not empty otherwise default value +export const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data; \ No newline at end of file From 450978fe7def4d7cf61fc2e55f02c313ccbaadc9 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Fri, 13 Oct 2023 19:27:05 +0530 Subject: [PATCH 04/27] added qsm category and featured image in quiz --- blocks/block.php | 155 +++- blocks/build/answer-option/block.json | 5 +- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 396 +-------- blocks/build/answer-option/index.js.map | 1 - blocks/build/block.json | 11 +- blocks/build/index.asset.php | 2 +- blocks/build/index.css | 52 +- blocks/build/index.css.map | 1 - blocks/build/index.js | 896 +-------------------- blocks/build/index.js.map | 1 - blocks/build/page/block.json | 10 +- blocks/build/page/index.asset.php | 2 +- blocks/build/page/index.js | 309 +------ blocks/build/page/index.js.map | 1 - blocks/build/question/block.json | 15 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 456 +---------- blocks/build/question/index.js.map | 1 - blocks/build/render.php | 8 - blocks/build/style-index.css | 10 - blocks/build/style-index.css.map | 1 - blocks/build/view.asset.php | 1 - blocks/build/view.js | 29 - blocks/build/view.js.map | 1 - blocks/src/answer-option/block.json | 6 +- blocks/src/block.json | 11 +- blocks/src/component/FeaturedImage.js | 206 +++++ blocks/src/component/SelectAddCategory.js | 189 +++++ blocks/src/edit.js | 310 +++---- blocks/src/editor.scss | 8 + blocks/src/helper.js | 29 + blocks/src/page/block.json | 9 +- blocks/src/page/edit.js | 14 - blocks/src/question/block.json | 14 +- blocks/src/question/edit.js | 161 +++- mlw_quizmaster2.php | 1 + php/admin/options-page-questions-tab.php | 3 + 38 files changed, 945 insertions(+), 2384 deletions(-) delete mode 100644 blocks/build/answer-option/index.js.map delete mode 100644 blocks/build/index.css.map delete mode 100644 blocks/build/index.js.map delete mode 100644 blocks/build/page/index.js.map delete mode 100644 blocks/build/question/index.js.map delete mode 100644 blocks/build/render.php delete mode 100644 blocks/build/style-index.css.map delete mode 100644 blocks/build/view.asset.php delete mode 100644 blocks/build/view.js delete mode 100644 blocks/build/view.js.map create mode 100644 blocks/src/component/FeaturedImage.js create mode 100644 blocks/src/component/SelectAddCategory.js diff --git a/blocks/block.php b/blocks/block.php index a4f8bf665..bc3c1d897 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -101,6 +101,31 @@ private function qsm_block_register_legacy() { ) ); } + /** + * Get hierarchical qsm_category + */ + private function hierarchical_qsm_category( $cat = 0 ) { + $category = []; + $next = get_categories( array( + 'taxonomy' => 'qsm_category', + 'hide_empty' => false, + 'hierarchical' => true, + 'orderby' => 'name', + 'order' => 'ASC', + 'parent' => $cat + ) ); + + if( $next ) { + foreach( $next as $cat ) { + $cat->name = $cat->cat_name; + $cat->id = $cat->term_id; + $cat->children = $this->hierarchical_qsm_category( $cat->term_id ); + $category[] = $cat; + } + } + return $category; + } + /** * Register scripts for block */ @@ -135,7 +160,7 @@ public function register_block_scripts() { ); } } - + wp_localize_script( 'qsm-quiz-editor-script', 'qsmBlockData', @@ -171,9 +196,10 @@ public function register_block_scripts() { ), 'categoryList' => get_terms( array( 'taxonomy' => 'qsm_category', - 'hide_empty' => false + 'hide_empty' => false ) ), + 'hierarchicalCategoryList'=> $this->hierarchical_qsm_category(), 'commentBox' => array( 'heading' => __( 'Comment Box', 'quiz-master-next' ), 'label' => __( 'Field Type', 'quiz-master-next' ), @@ -189,6 +215,12 @@ public function register_block_scripts() { ); } + //nonce to save question + private function get_rest_nonce( $quiz_id ) { + $user_id = get_current_user_id(); + return wp_create_nonce( 'wp_rest_nonce_' . $quiz_id . '_' . $user_id ); + } + /** * The block renderer. * @@ -216,6 +248,19 @@ public function register_editor_rest_routes() { return; } + //get quiz structure data + register_rest_route( + 'quiz-survey-master/v1', + '/quiz/hierarchical-category-list', + array( + 'methods' => WP_REST_Server::CREATABLE, + 'callback' => array( $this, 'hierarchical_category_list' ), + 'permission_callback' => function () { + return current_user_can( 'edit_posts' ); + }, + ) + ); + //get quiz structure data register_rest_route( 'quiz-survey-master/v1', @@ -242,10 +287,34 @@ public function register_editor_rest_routes() { ) ); + //save Quiz + register_rest_route( + 'quiz-survey-master/v1', + '/quiz/save_quiz', + array( + 'methods' => WP_REST_Server::CREATABLE, + 'callback' => array( $this, 'save_quiz' ), + 'permission_callback' => function () { + return current_user_can( 'edit_posts' ); + }, + ) + ); + //save pages and question order inside page : qsm_ajax_save_pages() } + /** + * REST API + * get hierarchical qsm category list + */ + public function hierarchical_category_list() { + return array( + 'status' => 'success', + 'result' => $this->hierarchical_qsm_category(), + ); + } + //get post id from quiz id private function get_post_id_from_quiz_id( $quiz_id ) { $post_ids = get_posts( array( @@ -296,6 +365,8 @@ public function qsm_quiz_structure_data( WP_REST_Request $request ) { $quiz_data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_quizzes WHERE deleted = 0 AND quiz_id = %d ORDER BY quiz_id DESC", $quiz_id ), ARRAY_A ); if ( ! empty( $quiz_data ) ) { + //nonce to save question + $quiz_data[0]['rest_nonce'] = $this->get_rest_nonce( $quiz_id ); $quiz_data[0]['post_id'] = $this->get_post_id_from_quiz_id( intval( $quiz_id ) ); // Cycle through each quiz and retrieve all of quiz's questions. foreach ( $quiz_data as $key => $quiz ) { @@ -416,13 +487,89 @@ public function create_new_quiz_from_editor( WP_REST_Request $request ) { ); } + /** + * REST API + * Create quiz using quiz name and other options + * + * + * @return { integer } quizID quiz id of newly created quiz + * + */ + public function save_quiz( WP_REST_Request $request ) { + //verify nonce + if ( ! isset( $_POST['qsm_block_quiz_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash($_POST['qsm_block_quiz_nonce'] ) ), 'qsm_block_quiz' ) || empty( $_POST['quizData'] ) ) { + return array( + 'status' => 'error', + 'msg' => __( 'Invalid or missing input.', 'quiz-master-next' ), + 'post' => $_POST + ); + } + + if ( ! function_exists( 'qsm_rest_save_question' ) || ! function_exists( 'qsm_ajax_save_pages' ) ) { + return array( + 'status' => 'error', + 'msg' => __( 'can\'t save quiz', 'quiz-master-next' ) + ); + } + + //quiz data + $_POST['quizData'] = json_decode( wp_unslash( $_POST['quizData'] ), true ); + $quiz_id = intval( sanitize_key( wp_unslash( $_POST['quizData']['quiz_id'] ) ) ); + $post_id = intval( sanitize_key( wp_unslash( $_POST['quizData']['post_id'] ) ) ); + if ( empty( $quiz_id ) || empty( $post_id ) ) { + return array( + 'status' => 'error', + 'msg' => __( 'Missing quiz_id or post_id', 'quiz-master-next' ) + ); + } + + global $mlwQuizMasterNext; + //Save Questions + if ( ! empty( $_POST['quizData']['questions'] ) ) { + //nonce to save question + $request[ 'rest_nonce' ] = $this->get_rest_nonce( $quiz_id ); + + foreach ( $_POST['quizData']['questions'] as $question ) { + foreach ($question as $qkey => $qvalue) { + $request[ $qkey ] = $qvalue; + } + qsm_rest_save_question( $request ); + } + } + + //save quiz name + if ( ! empty( $_POST['quizData']['quiz'] ) && ! empty( $_POST['quizData']['quiz']['quiz_name'] ) ) { + $quiz_name = sanitize_key( wp_unslash( $_POST['quizData']['quiz']['quiz_name'] ) ); + if ( ! empty( $quiz_id ) && ! empty( $post_id ) && ! empty( $quiz_name ) ) { + $mlwQuizMasterNext->quizCreator->edit_quiz_name( $quiz_id, $quiz_name, $post_id ); + } + } + + //Save Pages + if ( ! empty( $_POST['quizData']['pages'] ) ) { + foreach ( $_POST['quizData'] as $qkey => $qvalue) { + $_POST[ $qkey ] = $qvalue; + } + qsm_ajax_save_pages(); + } + + return array( + 'status' => 'success', + 'msg' => __( 'Quiz saved successfully', 'quiz-master-next' ) + ); + + } + } QSMBlock::get_instance(); } if ( ! function_exists( 'is_qsm_block_api_call' ) ) { - function is_qsm_block_api_call() { - return ! empty( $_POST['qsm_block_api_call'] ); + function is_qsm_block_api_call( $postcheck = false ) { + if ( empty( $postcheck ) ) { + return ! empty( $_POST['qsm_block_api_call'] ); + } + return ( ! empty( $_POST['qsm_block_api_call'] ) && ! empty( $_POST[ $postcheck ] ) ); } } diff --git a/blocks/build/answer-option/block.json b/blocks/build/answer-option/block.json index dbc36a9af..1746753ad 100644 --- a/blocks/build/answer-option/block.json +++ b/blocks/build/answer-option/block.json @@ -31,6 +31,7 @@ "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", + "quiz-master-next/quizAttr", "quiz-master-next/questionID" ], "example": {}, @@ -40,7 +41,5 @@ "textdomain": "main-block", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } \ No newline at end of file diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index 4fe50fac3..858d42ec4 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => 'e5ff0d1c46cfa66822e9'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '616315fba7b8ee52d7b1'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index c1f4b40d4..6b280bef3 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -1,395 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/answer-option/edit.js": -/*!***********************************!*\ - !*** ./src/answer-option/edit.js ***! - \***********************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - - - - - - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId, - context, - mergeBlocks, - onReplace, - onRemove - } = props; - const quizID = context['quiz-master-next/quizID']; - const pageID = context['quiz-master-next/pageID']; - const questionID = context['quiz-master-next/questionID']; - const name = 'qsm/quiz-answer-option'; - const { - optionID, - content, - points, - isCorrect - } = attributes; - - /**Initialize block from server */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) {} - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, [quizID]); - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({ - className: '' - }); - - //Decode htmlspecialchars - const decodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; - }; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - type: "number", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Points', 'quiz-master-next'), - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer points', 'quiz-master-next'), - value: points, - onChange: points => setAttributes({ - points - }) - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct', 'quiz-master-next'), - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(isCorrect) && '1' == isCorrect, - onChange: () => setAttributes({ - isCorrect: !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(isCorrect) && '1' == isCorrect ? 0 : 1 - }) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer options', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question answer', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Your Answer', 'quiz-master-next'), - value: content, - onChange: content => setAttributes({ - content: (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmStripTags)(content) - }), - onSplit: (value, isOriginal) => { - let newAttributes; - if (isOriginal || value) { - newAttributes = { - ...attributes, - content: value - }; - } - const block = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__.createBlock)(name, newAttributes); - if (isOriginal) { - block.clientId = clientId; - } - return block; - }, - onMerge: mergeBlocks, - onReplace: onReplace, - onRemove: onRemove, - allowedFormats: [], - withoutInteractiveFormatting: true, - className: 'qsm-question-answer-option', - identifier: "text" - }))); -} - -/***/ }), - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from button text content. -const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const sec = Date.now() * 1000 + Math.random() * 1000; - const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/core-data": -/*!**********************************!*\ - !*** external ["wp","coreData"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["coreData"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/editor": -/*!********************************!*\ - !*** external ["wp","editor"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["editor"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "./src/answer-option/block.json": -/*!**************************************!*\ - !*** ./src/answer-option/block.json ***! - \**************************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-answer-option","version":"0.1.0","title":"Answer Option","category":"widgets","parent":["qsm/quiz-question"],"icon":"remove","description":"QSM Quiz answer option","attributes":{"optionID":{"type":"string","default":"0"},"content":{"type":"string","default":""},"points":{"type":"string","default":"0"},"isCorrect":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/questionID"],"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!************************************!*\ - !*** ./src/answer-option/index.js ***! - \************************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/answer-option/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/answer-option/block.json"); - - - -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { - merge(attributes, attributesToMerge) { - return { - content: (attributes.content || '') + (attributesToMerge.content || '') - }; - }, - edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] -}); -}(); -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,o=(window.wp.apiFetch,window.wp.blockEditor),r=(window.wp.editor,window.wp.coreData,window.wp.data,window.wp.components);const i=e=>null==e||""===e;var a=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(a.u2,{merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(a){if("undefined"==typeof qsmBlockData)return null;const{className:s,attributes:l,setAttributes:c,isSelected:u,clientId:w,context:m,mergeBlocks:p,onReplace:d,onRemove:q}=a,g=m["quiz-master-next/quizID"],{optionID:x,content:_,points:z,isCorrect:h}=(m["quiz-master-next/pageID"],m["quiz-master-next/questionID"],l);(0,t.useEffect)((()=>{let e=!0;return()=>{e=!1}}),[g]);const v=(0,o.useBlockProps)({className:""});return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(o.InspectorControls,null,(0,t.createElement)(r.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(r.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:z,onChange:e=>c({points:e})}),(0,t.createElement)(r.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!i(h)&&"1"==h,onChange:()=>c({isCorrect:i(h)||"1"!=h?1:0})}))),(0,t.createElement)("div",{...v},(0,t.createElement)(o.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:_,onChange:e=>{return c({content:(t=e,t.replace(/<\/?a[^>]*>/g,""))});var t},onSplit:(t,n)=>{let o;(n||t)&&(o={...l,content:t});const r=(0,e.createBlock)("qsm/quiz-answer-option",o);return n&&(r.clientId=w),r},onMerge:p,onReplace:d,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"})))}})}(); \ No newline at end of file diff --git a/blocks/build/answer-option/index.js.map b/blocks/build/answer-option/index.js.map deleted file mode 100644 index 6f8f4ff02..000000000 --- a/blocks/build/answer-option/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"answer-option/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCyB,oEAAiB,CAAEC,6CAAa,EAAE;EACjCC,KAAKA,CAAEtE,UAAU,EAAEuE,iBAAiB,EAAG;IACtC,OAAO;MACN1D,OAAO,EACN,CAAEb,UAAU,CAACa,OAAO,IAAI,EAAE,KACxB0D,iBAAiB,CAAC1D,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACD2D,IAAI,EAAE5E,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/answer-option/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/answer-option/index.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\nexport default function Edit( props ) {\n\t\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace,\nonRemove } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\tconst questionID = context['quiz-master-next/questionID'];\n\tconst name = 'qsm/quiz-answer-option';\n\tconst {\n\t\toptionID,\n\t\tcontent,\n\t\tpoints,\n\t\tisCorrect\n\t} = attributes;\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: '',\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = (html) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\t\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { points } ) }\n\t\t\t/>\n\t\t\t setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\n\t
\n\t\t setAttributes( { content: qsmStripTags( content ) } ) }\n\t\t\tonSplit={ ( value, isOriginal ) => {\n\t\t\t\tlet newAttributes;\n\n\t\t\t\tif ( isOriginal || value ) {\n\t\t\t\t\tnewAttributes = {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst block = createBlock( name, newAttributes );\n\n\t\t\t\tif ( isOriginal ) {\n\t\t\t\t\tblock.clientId = clientId;\n\t\t\t\t}\n\n\t\t\t\treturn block;\n\t\t\t} }\n\t\t\tonMerge={ mergeBlocks }\n\t\t\tonReplace={ onReplace }\n\t\t\tonRemove={ onRemove }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-answer-option' }\n\t\t\tidentifier='text'\n\t\t/>\n\t
\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\n//generate uiniq id\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};\n\n//return data if not empty otherwise default value\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit: Edit,\n} );\n"],"names":["__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","createBlock","qsmIsEmpty","qsmStripTags","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","mergeBlocks","onReplace","onRemove","quizID","pageID","questionID","name","optionID","content","points","isCorrect","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","Fragment","title","initialOpen","type","label","help","onChange","checked","tagName","placeholder","onSplit","isOriginal","newAttributes","block","onMerge","allowedFormats","withoutInteractiveFormatting","identifier","data","qsmSanitizeName","toLowerCase","replace","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","registerBlockType","metadata","merge","attributesToMerge","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/block.json b/blocks/build/block.json index e330bf261..b5f90f8bc 100644 --- a/blocks/build/block.json +++ b/blocks/build/block.json @@ -11,10 +11,15 @@ "quizID": { "type": "string", "default": "0" + }, + "quizAttr": { + "type": "object", + "default": {} } }, "providesContext": { - "quiz-master-next/quizID": "quizID" + "quiz-master-next/quizID": "quizID", + "quiz-master-next/quizAttr": "quizAttr" }, "example": {}, "supports": { @@ -23,7 +28,5 @@ "textdomain": "main-block", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } \ No newline at end of file diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 5e9bb92ab..831ae1fa5 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '8dbcc3b3def5a4bdad4a'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '10d7a08f262e9513bd32'); diff --git a/blocks/build/index.css b/blocks/build/index.css index 0a24e2a27..a14e1e98f 100644 --- a/blocks/build/index.css +++ b/blocks/build/index.css @@ -1,51 +1 @@ -/*!****************************************************************************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! - \****************************************************************************************************************************************************************************************************************************************/ -/** - * The following styles get applied inside the editor only. - * - * Replace them with your own styles or remove the file completely. - */ -.qsm-placeholder-select-create-quiz { - display: flex; - gap: 1rem; - align-items: center; - margin-bottom: 1rem; -} -.qsm-placeholder-select-create-quiz .components-base-control { - max-width: 50%; -} - -.qsm-placeholder-quiz-create-form { - width: 50%; -} -.qsm-placeholder-quiz-create-form .components-button { - width: -moz-fit-content; - width: fit-content; -} - -.wp-block-qsm-quiz-question { - /*Question Title*/ - /*Question description*/ - /*Question options*/ - /*Question block in editing mode*/ -} -.wp-block-qsm-quiz-question .qsm-question-title { - color: #1f8cbe; - font-size: 1.38rem; -} -.wp-block-qsm-quiz-question .qsm-question-description, -.wp-block-qsm-quiz-question .qsm-question-correct-answer-info, -.wp-block-qsm-quiz-question .qsm-question-hint { - font-size: 1rem; -} -.wp-block-qsm-quiz-question .qsm-question-answer-option { - color: #666666; - font-size: 0.9rem; - margin-left: 1rem; -} -.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title { - color: #666666; -} - -/*# sourceMappingURL=index.css.map*/ \ No newline at end of file +.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}p.qsm-error-text{color:#fd3e3e}.qsm-placeholder-quiz-create-form{width:50%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{font-size:1rem}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666} diff --git a/blocks/build/index.css.map b/blocks/build/index.css.map deleted file mode 100644 index 3236fc2e0..000000000 --- a/blocks/build/index.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AASA;EACI;EACA;EACA;EACA;AAHJ;AAII;EACI;AAFR;;AAMA;EACI;AAHJ;AAII;EACI;EAAA;AAFR;;AAMA;EACI;EAMA;EAOA;EAOA;AApBJ;AACI;EACI,cAtBiB;EAuBjB;AACR;AAGI;;;EAGI;AADR;AAKI;EACI,cApCa;EAqCb;EACA;AAHR;AAQQ;EACI,cA5CS;AAsCrB,C","sources":["webpack://qsm/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n $qsm_primary_color: #666666;\n $qsm_wp_primary_color : #1f8cbe;\n\n.qsm-placeholder-select-create-quiz{\n display: flex;\n gap: 1rem;\n align-items: center;\n margin-bottom: 1rem;\n .components-base-control{\n max-width: 50%;\n }\n}\n\n.qsm-placeholder-quiz-create-form{\n width: 50%;\n .components-button{\n width: fit-content;\n }\n}\n\n.wp-block-qsm-quiz-question {\n /*Question Title*/\n .qsm-question-title {\n color: $qsm_wp_primary_color;\n font-size: 1.38rem;\n }\n\n /*Question description*/\n .qsm-question-description, \n .qsm-question-correct-answer-info,\n .qsm-question-hint {\n font-size: 1rem;\n }\n\n /*Question options*/\n .qsm-question-answer-option{\n color: $qsm_primary_color;\n font-size: 0.9rem;\n margin-left: 1rem;\n }\n\n /*Question block in editing mode*/\n &.in-editing-mode{\n .qsm-question-title{\n color: $qsm_primary_color;\n }\n }\n \n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/index.js b/blocks/build/index.js index 8dafc9b24..f9d96a9a2 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1,895 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/edit.js": -/*!*********************!*\ - !*** ./src/edit.js ***! - \*********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./helper */ "./src/helper.js"); - - - - - - - - - - - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId - } = props; - const { - createNotice - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__.store); - const { - quizID - } = attributes; - - //quiz attribute - const [quizAttr, setQuizAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.globalQuizsetting); - //quiz list - const [quizList, setQuizList] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.QSMQuizList); - //quiz list - const [quizMessage, setQuizMessage] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)({ - error: false, - msg: '' - }); - //weather creating a new quiz - const [createQuiz, setCreateQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //weather saving quiz - const [saveQuiz, setSaveQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //weather to show advance option - const [showAdvanceOption, setShowAdvanceOption] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //Quiz template on set Quiz ID - const [quizTemplate, setQuizTemplate] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)([]); - //Quiz Options to create attributes label, description and layout - const quizOptions = qsmBlockData.quizOptions; - - //check if page is saving - const isSavingPage = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { - const { - isAutosavingPost, - isSavingPost - } = select(_wordpress_editor__WEBPACK_IMPORTED_MODULE_6__.store); - return isSavingPost() || isAutosavingPost(); - }, []); - const { - getBlock - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.store); - - /** - * Prepare quiz data e.g. quiz details, questions, answers etc to save - * @returns quiz data - */ - const getQuizDataToSave = () => { - let blocks = getBlock(clientId); - if ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(blocks)) { - return false; - } - console.log("blocks", blocks); - blocks = blocks.innerBlocks; - let quizDataToSave = { - quiz_id: quizAttr.quiz_id, - post_id: quizAttr.post_id, - quiz: {}, - pages: [], - qpages: [], - questions: [] - }; - let pageSNo = 0; - //loop through inner blocks - blocks.forEach(block => { - if ('qsm/quiz-page' === block.name) { - let pageID = block.attributes.pageID; - let questions = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(block.innerBlocks) && 0 < block.innerBlocks.length) { - let questionBlocks = block.innerBlocks; - //Question Blocks - questionBlocks.forEach(questionBlock => { - if ('qsm/quiz-question' !== questionBlock.name) { - return true; - } - let answers = []; - //Answer option blocks - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(questionBlock.innerBlocks) && 0 < questionBlock.innerBlocks.length) { - let answerOptionBlocks = questionBlock.innerBlocks; - answerOptionBlocks.forEach(answerOptionBlock => { - if ('qsm/quiz-answer-option' !== answerOptionBlock.name) { - return true; - } - let answerAttr = answerOptionBlock.attributes; - answers.push([(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(answerAttr?.content), (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(answerAttr?.points), (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(answerAttr?.isCorrect)]); - }); - } - - //questions Data - let questionAttr = questionBlock.attributes; - questions.push(questionAttr.questionID); - quizDataToSave.questions.push({ - "id": questionAttr.questionID, - "quizID": quizAttr.quiz_id, - "postID": quizAttr.post_id, - "type": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.type, '0'), - "name": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.description), - "question_title": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.title), - "answerInfo": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.correctAnswerInfo), - "comments": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.commentBox, '1'), - "hint": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.hint), - "category": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.category), - "required": (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmValueOrDefault)(questionAttr?.required, 1), - "answers": answers, - "page": pageSNo - }); - }); - } - - // pages[0][]: 2512 - // qpages[0][id]: 2 - // qpages[0][quizID]: 76 - // qpages[0][pagekey]: Ipj90nNT - // qpages[0][hide_prevbtn]: 0 - // qpages[0][questions][]: 2512 - // post_id: 111 - //page data - quizDataToSave.pages.push(questions); - quizDataToSave.qpages.push({ - 'id': pageID, - 'quizID': quizAttr.quiz_id, - 'pagekey': block.attributes.pageKey, - 'hide_prevbtn': block.attributes.hidePrevBtn, - 'questions': questions - }); - pageSNo++; - } - }); - - //Quiz details - quizDataToSave.quiz = { - 'quiz_name': quizAttr.quiz_name, - 'quiz_id': quizAttr.quiz_id, - 'post_id': quizAttr.post_id - }; - if (showAdvanceOption) { - ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => { - if ('undefined' !== typeof quizAttr[item] && null !== quizAttr[item]) { - quizDataToSave.quiz[item] = quizAttr[item]; - } - }); - } - return quizDataToSave; - }; - - //saving Quiz on save page - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (isSavingPage) { - let qsmData = getQuizDataToSave(); - console.log("qsmData", qsmData); - } - }, [isSavingPage]); - - /**Initialize block from server */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizID) && 0 < quizID && ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr) || (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr?.quizID) || quizID != quizAttr.quiz_id)) { - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/structure', - method: 'POST', - data: { - quizID: quizID - } - }).then(res => { - console.log(res); - if ('success' == res.status) { - let result = res.result; - setQuizAttr({ - ...quizAttr, - ...result - }); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(result.qpages)) { - let quizTemp = []; - result.qpages.forEach(page => { - let questions = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(page.question_arr)) { - page.question_arr.forEach(question => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(question)) { - let answers = []; - //answers options blocks - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(question.answers) && 0 < question.answers.length) { - question.answers.forEach((answer, aIndex) => { - answers.push(['qsm/quiz-answer-option', { - optionID: aIndex, - content: answer[0], - points: answer[1], - isCorrect: answer[2] - }]); - }); - } - //question blocks - questions.push(['qsm/quiz-question', { - questionID: question.question_id, - type: question.question_type_new, - answerEditor: question.settings.answerEditor, - title: question.settings.question_title, - description: question.question_name, - required: question.settings.required, - hint: question.hints, - answers: question.answers, - correctAnswerInfo: question.question_answer_info, - category: question.category, - multicategories: question.multicategories, - commentBox: question.comments, - matchAnswer: question.settings.matchAnswer, - featureImageID: question.settings.featureImageID, - featureImageSrc: question.settings.featureImageSrc, - settings: question.settings - }, answers]); - } - }); - } - //console.log("page",page); - quizTemp.push(['qsm/quiz-page', { - pageID: page.id, - pageKey: page.pagekey, - hidePrevBtn: page.hide_prevbtn, - quizID: page.quizID - }, questions]); - }); - setQuizTemplate(quizTemp); - } - // QSM_QUIZ = [ - // [ - - // ] - // ]; - } else { - console.log("error " + res.msg); - } - }); - } - } - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, [quizID]); - - /** - * vault dash Icon - * @returns vault dash Icon - */ - const feedbackIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Icon, { - icon: "vault", - size: "36" - }); - - /** - * - * @returns Placeholder for quiz in case quiz ID is not set - */ - const quizPlaceholder = () => { - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Placeholder, { - icon: feedbackIcon, - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz And Survey Master', 'quiz-master-next'), - instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Easily and quickly add quizzes and surveys inside the block editor.', 'quiz-master-next') - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizList) && 0 < quizList.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "qsm-placeholder-select-create-quiz" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('', 'quiz-master-next'), - value: quizID, - options: quizList, - onChange: quizID => setAttributes({ - quizID - }), - disabled: createQuiz, - __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('OR', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { - variant: "link", - onClick: () => setCreateQuiz(!createQuiz) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New', 'quiz-master-next'))), ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizList) || createQuiz) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.__experimentalVStack, { - spacing: "3", - className: "qsm-placeholder-quiz-create-form" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), - value: quizAttr?.quiz_name || '', - onChange: val => setQuizAttributes(val, 'quiz_name') - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { - variant: "link", - onClick: () => setShowAdvanceOption(!showAdvanceOption) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance options', 'quiz-master-next')), showAdvanceOption && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: quizOptions?.form_type?.label, - value: quizAttr?.form_type, - options: quizOptions?.form_type?.options, - onChange: val => setQuizAttributes(val, 'form_type'), - __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: quizOptions?.system?.label, - value: quizAttr?.system, - options: quizOptions?.system?.options, - onChange: val => setQuizAttributes(val, 'system'), - help: quizOptions?.system?.help, - __nextHasNoMarginBottom: true - }), ['timer_limit', 'pagination'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - key: 'quiz-create-text-' + item, - type: "number", - label: quizOptions?.[item]?.label, - help: quizOptions?.[item]?.help, - value: (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) ? 0 : quizAttr[item], - onChange: val => setQuizAttributes(val, item) - })), ['enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { - key: 'quiz-create-toggle-' + item, - label: quizOptions?.[item]?.label, - help: quizOptions?.[item]?.help, - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item], - onChange: () => setQuizAttributes(!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item] ? 0 : 1, item) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { - variant: "primary", - disabled: saveQuiz || (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr.quiz_name), - onClick: () => createNewQuiz() - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Create Quiz', 'quiz-master-next'))))); - }; - - /** - * Set attribute value - * @param { any } value attribute value to set - * @param { string } attr_name attribute name - */ - const setQuizAttributes = (value, attr_name) => { - let newAttr = quizAttr; - newAttr[attr_name] = value; - setQuizAttr({ - ...newAttr - }); - }; - const createNewQuiz = () => { - if ((0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizAttr.quiz_name)) { - console.log("empty quiz_name"); - return; - } - //save quiz status - setSaveQuiz(true); - // let quizData = { - // "quiz_name": quizAttr.quiz_name, - // "qsm_new_quiz_nonce": qsmBlockData.qsm_new_quiz_nonce - // }; - let quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmFormData)({ - 'quiz_name': quizAttr.quiz_name, - 'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce - }); - if (showAdvanceOption) { - ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => 'undefined' === typeof quizAttr[item] || null === quizAttr[item] ? '' : quizData.append(item, quizAttr[item])); - } - - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/create_quiz', - method: 'POST', - body: quizData - }).then(res => { - console.log(res); - //save quiz status - setSaveQuiz(false); - if ('success' == res.status) { - //create a question - let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmFormData)({ - "id": null, - "quizID": res.quizID, - "type": "0", - "name": "", - "question_title": "", - "answerInfo": "", - "comments": "1", - "hint": "", - "category": "", - "required": 1, - "answers": [], - "page": 0 - }); - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/questions', - method: 'POST', - body: newQuestion - }).then(response => { - console.log("question response", response); - if ('success' == response.status) { - let question_id = response.id; - - /**Page attributes required format */ - // pages[0][]: 2512 - // qpages[0][id]: 2 - // qpages[0][quizID]: 76 - // qpages[0][pagekey]: Ipj90nNT - // qpages[0][hide_prevbtn]: 0 - // qpages[0][questions][]: 2512 - // post_id: 111 - - let newPage = (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmFormData)({ - "action": qsmBlockData.save_pages_action, - "quiz_id": res.quizID, - "nonce": qsmBlockData.saveNonce, - "post_id": res.quizPostID - }); - newPage.append('pages[0][]', question_id); - newPage.append('qpages[0][id]', 1); - newPage.append('qpages[0][quizID]', res.quizID); - newPage.append('qpages[0][pagekey]', (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmUniqid)()); - newPage.append('qpages[0][hide_prevbtn]', 0); - newPage.append('qpages[0][questions][]', question_id); - - //create a page - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - url: qsmBlockData.ajax_url, - method: 'POST', - body: newPage - }).then(pageResponse => { - console.log("pageResponse", pageResponse); - if ('success' == pageResponse.status) { - //set new quiz ID - setAttributes({ - quizID: res.quizID - }); - } - }); - } - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - } - - //create notice - createNotice(res.status, res.msg, { - isDismissible: true, - type: 'snackbar' - }); - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - }; - - /** - * Inner Blocks - */ - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); - const innerBlocksProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useInnerBlocksProps)(blockProps, { - template: quizTemplate, - allowedBlocks: ['qsm/quiz-page'] - }); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), - value: quizAttr?.quiz_name || '', - onChange: val => setQuizAttributes(val, 'quiz_name') - }))), (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(quizID) || '0' == quizID ? quizPlaceholder() : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...innerBlocksProps - })); -} - -/***/ }), - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from button text content. -const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const sec = Date.now() * 1000 + Math.random() * 1000; - const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "./src/index.js": -/*!**********************!*\ - !*** ./src/index.js ***! - \**********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss"); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/block.json"); - - - - -const save = props => null; -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, { - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"], - save: save -}); - -/***/ }), - -/***/ "./src/editor.scss": -/*!*************************!*\ - !*** ./src/editor.scss ***! - \*************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "./src/style.scss": -/*!************************!*\ - !*** ./src/style.scss ***! - \************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/editor": -/*!********************************!*\ - !*** external ["wp","editor"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["editor"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "@wordpress/notices": -/*!*********************************!*\ - !*** external ["wp","notices"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["notices"]; - -/***/ }), - -/***/ "./src/block.json": -/*!************************!*\ - !*** ./src/block.json ***! - \************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz","version":"0.1.0","title":"QSM Quiz","category":"widgets","icon":"vault","description":"Easily and quickly add quizzes and surveys inside the block editor.","attributes":{"quizID":{"type":"string","default":"0"}},"providesContext":{"quiz-master-next/quizID":"quizID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = __webpack_modules__; -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/chunk loaded */ -/******/ !function() { -/******/ var deferred = []; -/******/ __webpack_require__.O = function(result, chunkIds, fn, priority) { -/******/ if(chunkIds) { -/******/ priority = priority || 0; -/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; -/******/ deferred[i] = [chunkIds, fn, priority]; -/******/ return; -/******/ } -/******/ var notFulfilled = Infinity; -/******/ for (var i = 0; i < deferred.length; i++) { -/******/ var chunkIds = deferred[i][0]; -/******/ var fn = deferred[i][1]; -/******/ var priority = deferred[i][2]; -/******/ var fulfilled = true; -/******/ for (var j = 0; j < chunkIds.length; j++) { -/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) { -/******/ chunkIds.splice(j--, 1); -/******/ } else { -/******/ fulfilled = false; -/******/ if(priority < notFulfilled) notFulfilled = priority; -/******/ } -/******/ } -/******/ if(fulfilled) { -/******/ deferred.splice(i--, 1) -/******/ var r = fn(); -/******/ if (r !== undefined) result = r; -/******/ } -/******/ } -/******/ return result; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/jsonp chunk loading */ -/******/ !function() { -/******/ // no baseURI -/******/ -/******/ // object to store loaded and loading chunks -/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded -/******/ var installedChunks = { -/******/ "index": 0, -/******/ "./style-index": 0 -/******/ }; -/******/ -/******/ // no chunk on demand loading -/******/ -/******/ // no prefetching -/******/ -/******/ // no preloaded -/******/ -/******/ // no HMR -/******/ -/******/ // no HMR manifest -/******/ -/******/ __webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; }; -/******/ -/******/ // install a JSONP callback for chunk loading -/******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) { -/******/ var chunkIds = data[0]; -/******/ var moreModules = data[1]; -/******/ var runtime = data[2]; -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0; -/******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) { -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) var result = runtime(__webpack_require__); -/******/ } -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ installedChunks[chunkId][0](); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ return __webpack_require__.O(result); -/******/ } -/******/ -/******/ var chunkLoadingGlobal = self["webpackChunkqsm"] = self["webpackChunkqsm"] || []; -/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); -/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ }(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module depends on other loaded chunks and execution need to be delayed -/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], function() { return __webpack_require__("./src/index.js"); }) -/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); -/******/ -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e,t={758:function(e,t,n){var i=window.wp.blocks,s=window.wp.element,a=window.wp.i18n,o=window.wp.apiFetch,r=n.n(o),u=window.wp.blockEditor,l=window.wp.notices,c=window.wp.data,m=window.wp.editor,p=window.wp.components;const q=e=>null==e||""===e,_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},d=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},g=(e,t="")=>q(e)?t:e;(0,i.registerBlockType)("qsm/quiz",{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:o,clientId:z}=e,{createNotice:h}=(0,c.useDispatch)(l.store),{quizID:f,quizAttr:b}=n,[w,v]=(qsmBlockData.globalQuizsetting,(0,s.useState)(qsmBlockData.QSMQuizList)),[y,k]=(0,s.useState)({error:!1,msg:""}),[D,E]=(0,s.useState)(!1),[I,B]=(0,s.useState)(!1),[x,S]=(0,s.useState)(!1),[C,O]=(0,s.useState)([]),P=qsmBlockData.quizOptions,N=(0,c.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(m.store);return n()&&!t()}),[]),{getBlock:A}=(0,c.useSelect)(u.store);(0,s.useEffect)((()=>{let e=!0;return e&&!q(f)&&0{if(console.log("quiz render data",e),"success"==e.status){let t=e.result;if(i({quizAttr:{...t}}),!q(t.qpages)){let e=[];t.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2]}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),O(e)}}else console.log("error "+e.msg)})),()=>{e=!1}}),[f]);const T=(e,t)=>{let n=b;n[t]=e,i({quizAttr:{...n}})};(0,s.useEffect)((()=>{if(N){let e=(()=>{let e=A(z);if(q(e))return!1;console.log("blocks",e),e=e.innerBlocks;let t={quiz_id:b.quiz_id,post_id:b.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,s=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes;i.push([g(t?.content),g(t?.points),g(t?.isCorrect)])}));let a=e.attributes;s.push(a.questionID),t.questions.push({id:a.questionID,quizID:b.quiz_id,postID:b.post_id,answerEditor:g(a?.answerEditor,"text"),type:g(a?.type,"0"),name:_(g(a?.description)),question_title:g(a?.title),answerInfo:_(g(a?.correctAnswerInfo)),comments:g(a?.commentBox,"1"),hint:g(a?.hint),category:g(a?.category),multicategories:[],required:g(a?.required,1),answers:i,page:n})})),t.pages.push(s),t.qpages.push({id:i,quizID:b.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:b.quiz_name,quiz_id:b.quiz_id,post_id:b.post_id},x&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==b[e]&&null!==b[e]&&(t.quiz[e]=b[e])})),t})();console.log("quizData",e),B(!0),e=d({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),r()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{console.log(e)})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[N]);const M=(0,u.useBlockProps)(),Q=(0,u.useInnerBlocksProps)(M,{template:C,allowedBlocks:["qsm/quiz-page"]});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.InspectorControls,null,(0,s.createElement)(p.PanelBody,{title:(0,a.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,s.createElement)(p.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:b?.quiz_name||"",onChange:e=>T(e,"quiz_name")}))),q(f)||"0"==f?(0,s.createElement)(p.Placeholder,{icon:()=>(0,s.createElement)(p.Icon,{icon:"vault",size:"36"}),label:(0,a.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,a.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,s.createElement)(s.Fragment,null,!q(w)&&0i({quizID:e}),disabled:D,__nextHasNoMarginBottom:!0}),(0,s.createElement)("span",null,(0,a.__)("OR","quiz-master-next")),(0,s.createElement)(p.Button,{variant:"link",onClick:()=>E(!D)},(0,a.__)("Add New","quiz-master-next"))),(q(w)||D)&&(0,s.createElement)(p.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,s.createElement)(p.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:b?.quiz_name||"",onChange:e=>T(e,"quiz_name")}),(0,s.createElement)(p.Button,{variant:"link",onClick:()=>S(!x)},(0,a.__)("Advance options","quiz-master-next")),x&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.SelectControl,{label:P?.form_type?.label,value:b?.form_type,options:P?.form_type?.options,onChange:e=>T(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,s.createElement)(p.SelectControl,{label:P?.system?.label,value:b?.system,options:P?.system?.options,onChange:e=>T(e,"system"),help:P?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,s.createElement)(p.TextControl,{key:"quiz-create-text-"+e,type:"number",label:P?.[e]?.label,help:P?.[e]?.help,value:q(b[e])?0:b[e],onChange:t=>T(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,s.createElement)(p.ToggleControl,{key:"quiz-create-toggle-"+e,label:P?.[e]?.label,help:P?.[e]?.help,checked:!q(b[e])&&"1"==b[e],onChange:()=>T(q(b[e])||"1"!=b[e]?1:0,e)})))),(0,s.createElement)(p.Button,{variant:"primary",disabled:I||q(b.quiz_name),onClick:()=>(()=>{if(q(b.quiz_name))return void console.log("empty quiz_name");B(!0);let e=d({quiz_name:b.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});x&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===b[t]||null===b[t]?"":e.append(t,b[t]))),r()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(console.log(e),B(!1),"success"==e.status){let t=d({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});r()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if(console.log("question response",t),"success"==t.status){let n=t.id,s=d({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});s.append("pages[0][]",n),s.append("qpages[0][id]",1),s.append("qpages[0][quizID]",e.quizID),s.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+1e3*Math.random()).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.trunc(1e8*Math.random())}`:""}`)()),s.append("qpages[0][hide_prevbtn]",0),s.append("qpages[0][questions][]",n),r()({url:qsmBlockData.ajax_url,method:"POST",body:s}).then((t=>{console.log("pageResponse",t),"success"==t.status&&i({quizID:e.quizID})}))}})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))}h(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,a.__)("Create Quiz","quiz-master-next"))))):(0,s.createElement)("div",{...Q}))},save:e=>null})}},n={};function i(e){var s=n[e];if(void 0!==s)return s.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.m=t,e=[],i.O=function(t,n,s,a){if(!n){var o=1/0;for(c=0;c=a)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(r=!1,a0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,s,a]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,a,o=n[0],r=n[1],u=n[2],l=0;if(o.some((function(t){return 0!==e[t]}))){for(s in r)i.o(r,s)&&(i.m[s]=r[s]);if(u)var c=u(i)}for(t&&t(n);l {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() || isAutosavingPost();\n\t}, [] );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\t/**\n\t * Prepare quiz data e.g. quiz details, questions, answers etc to save \n\t * @returns quiz data\n\t */\n\tconst getQuizDataToSave = ( ) => {\t\n\t\tlet blocks = getBlock( clientId ); \n\t\tif ( qsmIsEmpty( blocks ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconsole.log( \"blocks\", blocks);\n\t\tblocks = blocks.innerBlocks;\n\t\tlet quizDataToSave = {\n\t\t\tquiz_id: quizAttr.quiz_id,\n\t\t\tpost_id: quizAttr.post_id,\n\t\t\tquiz:{},\n\t\t\tpages:[],\n\t\t\tqpages:[],\n\t\t\tquestions:[]\n\t\t};\n\t\tlet pageSNo = 0;\n\t\t//loop through inner blocks\n\t\tblocks.forEach( (block) => {\n\t\t\tif ( 'qsm/quiz-page' === block.name ) {\n\t\t\t\tlet pageID = block.attributes.pageID;\n\t\t\t\tlet questions = [];\n\t\t\t\tif ( ! qsmIsEmpty( block.innerBlocks ) && 0 < block.innerBlocks.length ) { \n\t\t\t\t\tlet questionBlocks = block.innerBlocks;\n\t\t\t\t\t//Question Blocks\n\t\t\t\t\tquestionBlocks.forEach( ( questionBlock ) => {\n\t\t\t\t\t\tif ( 'qsm/quiz-question' !== questionBlock.name ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet answers = [];\n\t\t\t\t\t\t//Answer option blocks\n\t\t\t\t\t\tif ( ! qsmIsEmpty( questionBlock.innerBlocks ) && 0 < questionBlock.innerBlocks.length ) { \n\t\t\t\t\t\t\tlet answerOptionBlocks = questionBlock.innerBlocks;\n\t\t\t\t\t\t\tanswerOptionBlocks.forEach( ( answerOptionBlock ) => {\n\t\t\t\t\t\t\t\tif ( 'qsm/quiz-answer-option' !== answerOptionBlock.name ) {\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlet answerAttr = answerOptionBlock.attributes;\n\t\t\t\t\t\t\t\tanswers.push([\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.content ),\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.points ),\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.isCorrect ),\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t//questions Data\n\t\t\t\t\t\tlet questionAttr = questionBlock.attributes;\n\t\t\t\t\t\tquestions.push( questionAttr.questionID );\n\t\t\t\t\t\tquizDataToSave.questions.push({\n\t\t\t\t\t\t\t\"id\": questionAttr.questionID,\n\t\t\t\t\t\t\t\"quizID\": quizAttr.quiz_id,\n\t\t\t\t\t\t\t\"postID\": quizAttr.post_id,\n\t\t\t\t\t\t\t\"type\": qsmValueOrDefault( questionAttr?.type , '0' ),\n\t\t\t\t\t\t\t\"name\": qsmValueOrDefault( questionAttr?.description ),\n\t\t\t\t\t\t\t\"question_title\": qsmValueOrDefault( questionAttr?.title ),\n\t\t\t\t\t\t\t\"answerInfo\": qsmValueOrDefault( questionAttr?.correctAnswerInfo ),\n\t\t\t\t\t\t\t\"comments\": qsmValueOrDefault( questionAttr?.commentBox, '1' ),\n\t\t\t\t\t\t\t\"hint\": qsmValueOrDefault( questionAttr?.hint ),\n\t\t\t\t\t\t\t\"category\": qsmValueOrDefault( questionAttr?.category ),\n\t\t\t\t\t\t\t\"required\": qsmValueOrDefault( questionAttr?.required, 1 ),\n\t\t\t\t\t\t\t\"answers\": answers,\n\t\t\t\t\t\t\t\"page\": pageSNo\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// pages[0][]: 2512\n\t\t\t\t// \tqpages[0][id]: 2\n\t\t\t\t// \tqpages[0][quizID]: 76\n\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\n\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\n\t\t\t\t// \tqpages[0][questions][]: 2512\n\t\t\t\t// \tpost_id: 111\n\t\t\t\t//page data\n\t\t\t\tquizDataToSave.pages.push( questions );\n\t\t\t\tquizDataToSave.qpages.push( {\n\t\t\t\t\t'id': pageID,\n\t\t\t\t\t'quizID': quizAttr.quiz_id,\n\t\t\t\t\t'pagekey': block.attributes.pageKey,\n\t\t\t\t\t'hide_prevbtn':block.attributes.hidePrevBtn,\n\t\t\t\t\t'questions': questions\n\t\t\t\t} );\n\t\t\t\tpageSNo++;\n\t\t\t}\n\t\t});\n\n\t\t//Quiz details\n\t\tquizDataToSave.quiz = { \n\t\t\t'quiz_name': quizAttr.quiz_name,\n\t\t\t'quiz_id': quizAttr.quiz_id,\n\t\t\t'post_id': quizAttr.post_id,\n\t\t};\n\t\tif ( showAdvanceOption ) {\n\t\t\t[\n\t\t\t'form_type', \n\t\t\t'system', \n\t\t\t'timer_limit', \n\t\t\t'pagination',\n\t\t\t'enable_contact_form', \n\t\t\t'enable_pagination_quiz', \n\t\t\t'show_question_featured_image_in_result',\n\t\t\t'progress_bar',\n\t\t\t'require_log_in',\n\t\t\t'disable_first_page',\n\t\t\t'comment_section'\n\t\t\t].forEach( ( item ) => { \n\t\t\t\tif ( 'undefined' !== typeof quizAttr[ item ] && null !== quizAttr[ item ] ) {\n\t\t\t\t\tquizDataToSave.quiz[ item ] = quizAttr[ item ];\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn quizDataToSave;\n\t}\n\n\t//saving Quiz on save page\n\tuseEffect( () => {\n\t\tif ( isSavingPage ) {\n\t\t\tlet qsmData = getQuizDataToSave();\n\t\t\tconsole.log(\"qsmData\",qsmData);\n\t\t}\n\t}, [ isSavingPage ] );\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\tif ( ! qsmIsEmpty( quizID ) && 0 < quizID && ( qsmIsEmpty( quizAttr ) || qsmIsEmpty( quizAttr?.quizID ) || quizID != quizAttr.quiz_id ) ) {\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/quiz/structure',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: { quizID: quizID },\n\t\t\t\t} ).then( ( res ) => {\n\t\t\t\t\tconsole.log( res );\n\t\t\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t\t\tlet result = res.result;\n\t\t\t\t\t\tsetQuizAttr( {\n\t\t\t\t\t\t\t...quizAttr,\n\t\t\t\t\t\t\t...result\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( ! qsmIsEmpty( result.qpages ) ) {\n\t\t\t\t\t\t\tlet quizTemp = [];\n\t\t\t\t\t\t\tresult.qpages.forEach( page => {\n\t\t\t\t\t\t\t\tlet questions = [];\n\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( page.question_arr ) ) {\n\t\t\t\t\t\t\t\t\tpage.question_arr.forEach( question => {\n\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question ) ) {\n\t\t\t\t\t\t\t\t\t\t\tlet answers = [];\n\t\t\t\t\t\t\t\t\t\t\t//answers options blocks\n\t\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tquestion.answers.forEach( ( answer, aIndex ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-answer-option',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptionID:aIndex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontent:answer[0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoints:answer[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect:answer[2]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t//question blocks\n\t\t\t\t\t\t\t\t\t\t\tquestions.push(\n\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-question',\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquestionID: question.question_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: question.question_type_new,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswerEditor: question.settings.answerEditor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: question.settings.question_title,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: question.question_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: question.settings.required,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thint:question.hints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tanswers: question.answers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcorrectAnswerInfo:question.question_answer_info,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcategory:question.category,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmulticategories:question.multicategories,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcommentBox: question.comments,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatchAnswer: question.settings.matchAnswer,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageID: question.settings.featureImageID,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageSrc: question.settings.featureImageSrc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings: question.settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers\n\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//console.log(\"page\",page);\n\t\t\t\t\t\t\t\tquizTemp.push(\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'qsm/quiz-page',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpageID:page.id,\n\t\t\t\t\t\t\t\t\t\t\tpageKey: page.pagekey,\n\t\t\t\t\t\t\t\t\t\t\thidePrevBtn: page.hide_prevbtn,\n\t\t\t\t\t\t\t\t\t\t\tquizID: page.quizID\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tquestions\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsetQuizTemplate( quizTemp );\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// QSM_QUIZ = [\n\t\t\t\t\t\t// \t[\n\n\t\t\t\t\t\t// \t]\n\t\t\t\t\t\t// ];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log( \"error \"+ res.msg );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\t/**\n\t * vault dash Icon\n\t * @returns vault dash Icon\n\t */\n\tconst feedbackIcon = () => (\n\t\n\t);\n\n\t/**\n\t * \n\t * @returns Placeholder for quiz in case quiz ID is not set\n\t */\n\tconst quizPlaceholder = ( ) => {\n\t\treturn (\n\t\t\t\n\t\t\t\t{\n\t\t\t\t\t<>\n\t\t\t\t\t{ ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& \n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( { quizID } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdisabled={ createQuiz }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t\t{ __( 'OR', 'quiz-master-next' ) }\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t}\n\t\t\t\t\t{ ( qsmIsEmpty( quizList ) || createQuiz ) &&\n\t\t\t\t\t\n\t\t\t\t\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ showAdvanceOption && (<>\n\t\t\t\t\t\t\t{/**Form Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'form_type') }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{/**Grading Type */}\n\t\t\t\t\t\t\t setQuizAttributes( val, 'system') }\n\t\t\t\t\t\t\t\thelp={ quizOptions?.system?.help }\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'timer_limit', \n\t\t\t\t\t\t\t\t\t'pagination',\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t\t setQuizAttributes( val, item) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ \n\t\t\t\t\t\t\t\t\t'enable_contact_form', \n\t\t\t\t\t\t\t\t\t'enable_pagination_quiz', \n\t\t\t\t\t\t\t\t\t'show_question_featured_image_in_result',\n\t\t\t\t\t\t\t\t\t'progress_bar',\n\t\t\t\t\t\t\t\t\t'require_log_in',\n\t\t\t\t\t\t\t\t\t'disable_first_page',\n\t\t\t\t\t\t\t\t\t'comment_section'\n\t\t\t\t\t\t\t\t].map( ( item ) => (\n\t\t\t\t\t\t\t\t setQuizAttributes( ( ( ! qsmIsEmpty( quizAttr[item] ) && '1' == quizAttr[item] ) ? 0 : 1 ), item ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) )\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t }\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t);\n\t};\n\n\t/**\n\t * Set attribute value\n\t * @param { any } value attribute value to set\n\t * @param { string } attr_name attribute name\n\t */\n\tconst setQuizAttributes = ( value , attr_name ) => {\n\t\tlet newAttr = quizAttr;\n\t\tnewAttr[ attr_name ] = value;\n\t\tsetQuizAttr( { ...newAttr } );\n\t}\n\n\tconst createNewQuiz = () => {\n\t\tif ( qsmIsEmpty( quizAttr.quiz_name ) ) {\n\t\t\tconsole.log(\"empty quiz_name\");\n\t\t\treturn;\n\t\t}\n\t\t//save quiz status\n\t\tsetSaveQuiz( true );\n\t\t// let quizData = {\n\t\t// \t\"quiz_name\": quizAttr.quiz_name,\n\t\t// \t\"qsm_new_quiz_nonce\": qsmBlockData.qsm_new_quiz_nonce\n\t\t// };\n\t\tlet quizData = qsmFormData({\n\t\t\t'quiz_name': quizAttr.quiz_name,\n\t\t\t'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce\n\t\t});\n\t\t\n\t\tif ( showAdvanceOption ) {\n\t\t\t['form_type', \n\t\t\t'system', \n\t\t\t'timer_limit', \n\t\t\t'pagination',\n\t\t\t'enable_contact_form', \n\t\t\t'enable_pagination_quiz', \n\t\t\t'show_question_featured_image_in_result',\n\t\t\t'progress_bar',\n\t\t\t'require_log_in',\n\t\t\t'disable_first_page',\n\t\t\t'comment_section'\n\t\t\t].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) );\n\t\t}\n\n\t\t//AJAX call\n\t\tapiFetch( {\n\t\t\tpath: '/quiz-survey-master/v1/quiz/create_quiz',\n\t\t\tmethod: 'POST',\n\t\t\tbody: quizData\n\t\t} ).then( ( res ) => {\n\t\t\tconsole.log( res );\n\t\t\t//save quiz status\n\t\t\tsetSaveQuiz( false );\n\t\t\tif ( 'success' == res.status ) {\n\t\t\t\t//create a question\n\t\t\t\tlet newQuestion = qsmFormData( {\n\t\t\t\t\t\"id\": null,\n\t\t\t\t\t\"quizID\": res.quizID,\n\t\t\t\t\t\"type\": \"0\",\n\t\t\t\t\t\"name\": \"\",\n\t\t\t\t\t\"question_title\": \"\",\n\t\t\t\t\t\"answerInfo\": \"\",\n\t\t\t\t\t\"comments\": \"1\",\n\t\t\t\t\t\"hint\": \"\",\n\t\t\t\t\t\"category\": \"\",\n\t\t\t\t\t\"required\": 1,\n\t\t\t\t\t\"answers\": [],\n\t\t\t\t\t\"page\": 0\n\t\t\t\t} );\n\t\t\t\t//AJAX call\n\t\t\t\tapiFetch( {\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: newQuestion\n\t\t\t\t} ).then( ( response ) => {\n\t\t\t\t\tconsole.log(\"question response\", response);\n\t\t\t\t\tif ( 'success' == response.status ) {\n\t\t\t\t\t\tlet question_id = response.id;\n\n\t\t\t\t\t\t/**Page attributes required format */\n\t\t\t\t\t\t// pages[0][]: 2512\n\t\t\t\t\t\t// \tqpages[0][id]: 2\n\t\t\t\t\t\t// \tqpages[0][quizID]: 76\n\t\t\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\n\t\t\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\n\t\t\t\t\t\t// \tqpages[0][questions][]: 2512\n\t\t\t\t\t\t// \tpost_id: 111\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet newPage = qsmFormData( {\n\t\t\t\t\t\t\t\"action\": qsmBlockData.save_pages_action,\n\t\t\t\t\t\t\t\"quiz_id\": res.quizID,\n\t\t\t\t\t\t\t\"nonce\": qsmBlockData.saveNonce,\n\t\t\t\t\t\t\t\"post_id\": res.quizPostID,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tnewPage.append( 'pages[0][]', question_id );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][id]', 1 );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][quizID]', res.quizID );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][pagekey]', qsmUniqid() );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][hide_prevbtn]', 0 );\n\t\t\t\t\t\tnewPage.append( 'qpages[0][questions][]', question_id );\n\n\n\t\t\t\t\t\t//create a page\n\t\t\t\t\t\tapiFetch( {\n\t\t\t\t\t\t\turl: qsmBlockData.ajax_url,\n\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\tbody: newPage\n\t\t\t\t\t\t} ).then( ( pageResponse ) => {\n\t\t\t\t\t\t\tconsole.log(\"pageResponse\", pageResponse);\n\t\t\t\t\t\t\tif ( 'success' == pageResponse.status ) {\n\t\t\t\t\t\t\t\t//set new quiz ID\n\t\t\t\t\t\t\t\tsetAttributes( { quizID: res.quizID } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}).catch(\n\t\t\t\t\t( error ) => {\n\t\t\t\t\t\tconsole.log( 'error',error );\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\n\t\t\t\t\t\t\tisDismissible: true,\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t\n\t\t\t} \n\n\t\t\t//create notice\n\t\t\tcreateNotice( res.status, res.msg, {\n\t\t\t\tisDismissible: true,\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} ).catch(\n\t\t\t( error ) => {\n\t\t\t\tconsole.log( 'error',error );\n\t\t\t\tcreateNotice( 'error', error.message, {\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\t \n\t}\n\n\t/**\n\t * Inner Blocks\n\t */\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: quizTemplate,\n\t\tallowedBlocks : [\n\t\t\t'qsm/quiz-page'\n\t\t]\n\t} );\n\t\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t setQuizAttributes( val, 'quiz_name') }\n\t\t/>\n\t\t\n\t\n\t{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? \n quizPlaceholder() \n\t:\n\t
\n\t}\n\t\n\t\n\t);\n}\n","//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\n//generate uiniq id\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};\n\n//return data if not empty otherwise default value\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { registerBlockType } from '@wordpress/blocks';\nimport './style.scss';\nimport Edit from './edit';\nimport metadata from './block.json';\nconst save = ( props ) => null;\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n\tsave: save,\n} );\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkqsm\"] = self[\"webpackChunkqsm\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], function() { return __webpack_require__(\"./src/index.js\"); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","store","blockEditorStore","useInnerBlocksProps","noticesStore","useDispatch","useSelect","editorStore","PanelBody","Button","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Placeholder","Icon","__experimentalVStack","VStack","qsmIsEmpty","qsmFormData","qsmUniqid","qsmValueOrDefault","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","createNotice","quizID","quizAttr","setQuizAttr","globalQuizsetting","quizList","setQuizList","QSMQuizList","quizMessage","setQuizMessage","error","msg","createQuiz","setCreateQuiz","saveQuiz","setSaveQuiz","showAdvanceOption","setShowAdvanceOption","quizTemplate","setQuizTemplate","quizOptions","isSavingPage","select","isAutosavingPost","isSavingPost","getBlock","getQuizDataToSave","blocks","console","log","innerBlocks","quizDataToSave","quiz_id","post_id","quiz","pages","qpages","questions","pageSNo","forEach","block","name","pageID","length","questionBlocks","questionBlock","answers","answerOptionBlocks","answerOptionBlock","answerAttr","push","content","points","isCorrect","questionAttr","questionID","type","description","title","correctAnswerInfo","commentBox","hint","category","required","pageKey","hidePrevBtn","quiz_name","item","qsmData","shouldSetQSMAttr","path","method","data","then","res","status","result","quizTemp","page","question_arr","question","answer","aIndex","optionID","question_id","question_type_new","answerEditor","settings","question_title","question_name","hints","question_answer_info","multicategories","comments","matchAnswer","featureImageID","featureImageSrc","id","pagekey","hide_prevbtn","feedbackIcon","createElement","icon","size","quizPlaceholder","label","instructions","Fragment","value","options","onChange","disabled","__nextHasNoMarginBottom","variant","onClick","spacing","help","val","setQuizAttributes","form_type","system","map","key","checked","createNewQuiz","attr_name","newAttr","quizData","qsm_new_quiz_nonce","append","body","newQuestion","response","newPage","save_pages_action","saveNonce","quizPostID","url","ajax_url","pageResponse","catch","message","isDismissible","blockProps","innerBlocksProps","template","allowedBlocks","initialOpen","qsmSanitizeName","toLowerCase","replace","qsmStripTags","text","obj","newData","FormData","k","hasOwnProperty","prefix","random","sec","Date","now","Math","toString","padEnd","trunc","defaultValue","registerBlockType","metadata","save","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/page/block.json b/blocks/build/page/block.json index a839d2a2b..c634ac921 100644 --- a/blocks/build/page/block.json +++ b/blocks/build/page/block.json @@ -25,19 +25,19 @@ } }, "usesContext": [ - "quiz-master-next/quizID" + "quiz-master-next/quizID", + "quiz-master-next/quizAttr" ], "providesContext": { "quiz-master-next/pageID": "pageID" }, "example": {}, "supports": { - "html": false + "html": false, + "multiple": false }, "textdomain": "main-block", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } \ No newline at end of file diff --git a/blocks/build/page/index.asset.php b/blocks/build/page/index.asset.php index d02e761a2..5a2b29b90 100644 --- a/blocks/build/page/index.asset.php +++ b/blocks/build/page/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '8aa5c6f7feef0dd2a483'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'a6a7c8c48015f8b1bc61'); diff --git a/blocks/build/page/index.js b/blocks/build/page/index.js index 942d49829..035c9ecdf 100644 --- a/blocks/build/page/index.js +++ b/blocks/build/page/index.js @@ -1,308 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from button text content. -const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const sec = Date.now() * 1000 + Math.random() * 1000; - const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "./src/page/edit.js": -/*!**************************!*\ - !*** ./src/page/edit.js ***! - \**************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId, - context - } = props; - const quizID = context['quiz-master-next/quizID']; - const { - pageID, - pageKey, - hidePrevBtn - } = attributes; - const [qsmPageAttr, setQsmPageAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.globalQuizsetting); - - /**Initialize block from server */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) { - //console.log("attr",attributes); - } - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, [quizID]); - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page Name', 'quiz-master-next'), - value: pageKey, - onChange: pageKey => setAttributes({ - pageKey - }) - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hide Previous Button?', 'quiz-master-next'), - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn, - onChange: () => setAttributes({ - hidePrevBtn: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn ? 0 : 1 - }) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { - allowedBlocks: ['qsm/quiz-question'] - }))); -} - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "./src/page/block.json": -/*!*****************************!*\ - !*** ./src/page/block.json ***! - \*****************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-page","version":"0.1.0","title":"Page","category":"widgets","parent":["qsm/quiz"],"icon":"text-page","description":"QSM Quiz Page","attributes":{"pageID":{"type":"string","default":"0"},"pageKey":{"type":"string","default":""},"hidePrevBtn":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID"],"providesContext":{"quiz-master-next/pageID":"pageID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!***************************!*\ - !*** ./src/page/index.js ***! - \***************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/page/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/page/block.json"); - - - -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] -}); -}(); -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,l=(window.wp.apiFetch,window.wp.blockEditor),a=window.wp.components;const i=e=>null==e||""===e;var o=JSON.parse('{"u2":"qsm/quiz-page"}');(0,e.registerBlockType)(o.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:o,attributes:r,setAttributes:s,isSelected:c,clientId:u,context:m}=e,{pageID:d,pageKey:w,hidePrevBtn:p}=(m["quiz-master-next/quizID"],r),[g,q]=(0,t.useState)(qsmBlockData.globalQuizsetting),B=(0,l.useBlockProps)();return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(l.InspectorControls,null,(0,t.createElement)(a.PanelBody,{title:(0,n.__)("Page settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(a.TextControl,{label:(0,n.__)("Page Name","quiz-master-next"),value:w,onChange:e=>s({pageKey:e})}),(0,t.createElement)(a.ToggleControl,{label:(0,n.__)("Hide Previous Button?","quiz-master-next"),checked:!i(p)&&"1"==p,onChange:()=>s({hidePrevBtn:i(p)||"1"!=p?1:0})}))),(0,t.createElement)("div",{...B},(0,t.createElement)(l.InnerBlocks,{allowedBlocks:["qsm/quiz-question"]})))}})}(); \ No newline at end of file diff --git a/blocks/build/page/index.js.map b/blocks/build/page/index.js.map deleted file mode 100644 index 22e20b10d..000000000 --- a/blocks/build/page/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"page/index.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;AAE9F,MAAMC,eAAe,GAAKC,IAAI,IAAM;EAC1C,IAAKH,UAAU,CAAEG,IAAK,CAAC,EAAG;IACzBA,IAAI,GAAG,EAAE;EACV,CAAC,MAAM;IACNA,IAAI,GAAGA,IAAI,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,IAAI,EAAE,GAAI,CAAC;IAC9CF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAC/B;EAEA,OAAOF,IAAI;AACZ,CAAC;;AAED;AACO,MAAMG,YAAY,GAAKC,IAAI,IAAMA,IAAI,CAACF,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;;AAE1E;AACO,MAAMG,WAAW,GAAGA,CAAEC,GAAG,GAAG,KAAK,KAAM;EAC7C,IAAIC,OAAO,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAC5BD,OAAO,CAACE,MAAM,CAAC,oBAAoB,EAAE,GAAG,CAAC;EACzC,IAAK,KAAK,KAAKH,GAAG,EAAG;IACpB,KAAM,IAAII,CAAC,IAAIJ,GAAG,EAAG;MACpB,IAAKA,GAAG,CAACK,cAAc,CAAED,CAAE,CAAC,EAAG;QAC5BH,OAAO,CAACE,MAAM,CAAEC,CAAC,EAAEJ,GAAG,CAACI,CAAC,CAAE,CAAC;MAC9B;IACD;EACD;EACA,OAAOH,OAAO;AACf,CAAC;;AAED;AACO,MAAMK,SAAS,GAAGA,CAACC,MAAM,GAAG,EAAE,EAAEC,MAAM,GAAG,KAAK,KAAK;EACtD,MAAMC,GAAG,GAAGC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AAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCC,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAE7B,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/page/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/page/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\n//generate uiniq id\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};\n\n//return data if not empty otherwise default value\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty } from '../helper';\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\t\n\tconst {\n\t\tpageID,\n\t\tpageKey,\n\t\thidePrevBtn,\n\t} = attributes;\n\n\tconst [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting );\n\t\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\t\t\t//console.log(\"attr\",attributes);\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t\t setAttributes( { pageKey } ) }\n\t\t\t/>\n\t\t\t setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) }\n\t\t\t/>\n\t\t\n\t\t\n\t\n\t
\n\t\t\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","quizID","pageID","pageKey","hidePrevBtn","qsmPageAttr","setQsmPageAttr","globalQuizsetting","shouldSetQSMAttr","blockProps","createElement","Fragment","title","initialOpen","label","value","onChange","checked","allowedBlocks","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/question/block.json b/blocks/build/question/block.json index 456d7d8ca..f30637e9f 100644 --- a/blocks/build/question/block.json +++ b/blocks/build/question/block.json @@ -69,18 +69,17 @@ "type": "string", "default": "0" }, - "otherSettings": { - "type": "object", - "default": {} + "media": { + "type": "object" }, "settings": { - "type": "object", - "default": {} + "type": "object" } }, "usesContext": [ "quiz-master-next/quizID", - "quiz-master-next/pageID" + "quiz-master-next/pageID", + "quiz-master-next/quizAttr" ], "providesContext": { "quiz-master-next/questionID": "questionID" @@ -92,7 +91,5 @@ "textdomain": "main-block", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } \ No newline at end of file diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php index ef7af930b..84b65eb50 100644 --- a/blocks/build/question/index.asset.php +++ b/blocks/build/question/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '36976c975b9d27a90caf'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'a24cbeda6e49d7c65688'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 8489b36f8..8b472805e 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -1,451 +1,5 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from button text content. -const qsmStripTags = text => text.replace(/<\/?a[^>]*>/g, ''); - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const sec = Date.now() * 1000 + Math.random() * 1000; - const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "./src/question/edit.js": -/*!******************************!*\ - !*** ./src/question/edit.js ***! - \******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - - - - - -/** - * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array - * - */ - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId, - context - } = props; - - /** https://github.com/WordPress/gutenberg/issues/22282 */ - const isParentOfSelectedBlock = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(select => isSelected || select('core/block-editor').hasSelectedInnerBlock(clientId, true)); - const quizID = context['quiz-master-next/quizID']; - const pageID = context['quiz-master-next/pageID']; - const { - questionID, - type, - description, - title, - correctAnswerInfo, - commentBox, - category, - multicategories, - hint, - featureImageID, - featureImageSrc, - answers, - answerEditor, - matchAnswer, - otherSettings, - settings - } = attributes; - const [quesAttr, setQuesAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(settings); - - /**Initialize block from server */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) {} - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, [quizID]); - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({ - className: isParentOfSelectedBlock ? ' in-editing-mode' : '' - }); - - //Decode htmlspecialchars - const decodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; - }; - const QUESTION_TEMPLATE = [['qsm/quiz-answer-option', { - optionID: '0' - }], ['qsm/quiz-answer-option', { - optionID: '1' - }]]; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", { - className: "block-editor-block-card__title" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('ID', 'quiz-master-next') + ': ' + questionID), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: qsmBlockData.question_type.label, - value: type || qsmBlockData.question_type.default, - onChange: type => setAttributes({ - type - }), - __nextHasNoMarginBottom: true - }, !(0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(qsmBlockData.question_type.options) && qsmBlockData.question_type.options.map(qtypes => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("optgroup", { - label: qtypes.category, - key: "qtypes" + qtypes.category - }, qtypes.types.map(qtype => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("option", { - value: qtype.slug, - key: "qtype" + qtype.slug - }, qtype.name))))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: qsmBlockData.answerEditor.label, - value: answerEditor || qsmBlockData.answerEditor.default, - options: qsmBlockData.answerEditor.options, - onChange: answerEditor => setAttributes({ - answerEditor - }), - __nextHasNoMarginBottom: true - })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: qsmBlockData.commentBox.heading - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: qsmBlockData.commentBox.label, - value: commentBox || qsmBlockData.commentBox.default, - options: qsmBlockData.commentBox.options, - onChange: commentBox => setAttributes({ - commentBox - }), - __nextHasNoMarginBottom: true - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "h4", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Type your question here', 'quiz-master-next'), - value: title, - onChange: title => setAttributes({ - title: (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmStripTags)(title) - }), - allowedFormats: [], - withoutInteractiveFormatting: true, - className: 'qsm-question-title' - }), isParentOfSelectedBlock && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Description goes here', 'quiz-master-next'), - value: decodeHtml(description), - onChange: description => setAttributes({ - description - }), - className: 'qsm-question-description', - __unstableEmbedURLOnPaste: true, - __unstableAllowPrefixTransformations: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { - allowedBlocks: ['qsm/quiz-answer-option'], - template: QUESTION_TEMPLATE - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct answer info goes here', 'quiz-master-next'), - value: decodeHtml(correctAnswerInfo), - onChange: correctAnswerInfo => setAttributes({ - correctAnswerInfo - }), - className: 'qsm-question-correct-answer-info', - __unstableEmbedURLOnPaste: true, - __unstableAllowPrefixTransformations: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hint', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hint', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('hint goes here', 'quiz-master-next'), - value: hint, - onChange: hint => setAttributes({ - hint: (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmStripTags)(hint) - }), - allowedFormats: [], - withoutInteractiveFormatting: true, - className: 'qsm-question-hint' - })))); -} - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/core-data": -/*!**********************************!*\ - !*** external ["wp","coreData"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["coreData"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/editor": -/*!********************************!*\ - !*** external ["wp","editor"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["editor"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "./src/question/block.json": -/*!*********************************!*\ - !*** ./src/question/block.json ***! - \*********************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-question","version":"0.1.0","title":"Question","category":"widgets","parent":["qsm/quiz-page"],"icon":"move","description":"QSM Quiz Question","attributes":{"questionID":{"type":"string","default":"0"},"type":{"type":"string","default":"0"},"description":{"type":"string","source":"html","selector":"p","default":""},"title":{"type":"string","default":""},"correctAnswerInfo":{"type":"string","source":"html","selector":"p","default":""},"commentBox":{"type":"string","default":"0"},"category":{"type":"number"},"multicategories":{"type":"array"},"hint":{"type":"string"},"featureImageID":{"type":"number"},"featureImageSrc":{"type":"string"},"answers":{"type":"array"},"answerEditor":{"type":"string","default":"text"},"matchAnswer":{"type":"string","default":"random"},"required":{"type":"string","default":"0"},"otherSettings":{"type":"object","default":{}},"settings":{"type":"object","default":{}}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID"],"providesContext":{"quiz-master-next/questionID":"questionID"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./view.js"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!*******************************!*\ - !*** ./src/question/index.js ***! - \*******************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/question/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/question/block.json"); - - - -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] -}); -}(); -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,r=window.wp.i18n,n=window.wp.apiFetch,o=e.n(n),i=window.wp.blockEditor,l=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},p=e=>e.replace(/<\/?a[^>]*>/g,""),g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},h=(e,t="")=>d(e)?t:e,q=["image"],f=(0,r.__)("Featured image"),w=(0,r.__)("Set featured image"),x=(0,a.createElement)("p",null,(0,r.__)("To edit the featured image, you need permission to upload media."));var E=({featureImageID:e,onUpdateImage:t,onRemoveImage:n})=>{const{createNotice:o}=(0,s.useDispatch)(l.store),_=(0,a.useRef)(),[p,g]=(0,a.useState)(!1),[h,E]=(0,a.useState)(void 0),{mediaFeature:b,mediaUpload:y}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function I(e){y({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){o("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(b)||"object"!=typeof b||E({id:e,width:b.media_details.width,height:b.media_details.height,url:b.source_url,alt_text:b.alt_text,slug:b.slug})),()=>{t=!1}}),[b]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,r.sprintf)( +// Translators: %s: The selected image alt text. +(0,r.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,r.sprintf)( +// Translators: %s: The selected image filename. +(0,r.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:f,onSelect:e=>{E(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:q,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,r.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&w),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,r.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{n(),_.current.focus()}},(0,r.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:I})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[n,i]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[h,q]=(0,a.useState)(!1),[f,w]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=(0,r.__)("Add New Category ","quiz-master-next"),E=`— ${(0,r.__)("Parent Category ","quiz-master-next")} —`,b=(e,t)=>{let a=!1;t.forEach((t=>{if(t.name==e)return a=!0,!1;0r.map((r=>(0,a.createElement)("div",{key:r.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:r.name,checked:e(r.id),onChange:()=>t(r.id)}),!!r.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},y(r.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,r.__)("Categories","quiz-master-next")},y(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!n)},x)),n&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),h||d(l)||_||(p(!0),o()({url:qsmBlockData.ajax_url,method:"POST",body:g({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;o()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(w(e.result),s(""),u(0),t(a),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,r.__)("Category Name","quiz-master-next"),value:l,onChange:e=>b(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:h||_},x)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},h&&(0,r.__)("Category ","quiz-master-next")+l+(0,r.__)(" already exists.","quiz-master-next"))))))},y=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(y.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:m,isSelected:u,clientId:q,context:f}=e,w=(0,s.useSelect)((e=>u||e("core/block-editor").hasSelectedInnerBlock(q,!0))),x=f["quiz-master-next/quizID"],{quiz_name:y,post_id:I,rest_nonce:k}=f["quiz-master-next/quizAttr"],{createNotice:v}=(f["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{questionID:C,type:B,description:D,title:z,correctAnswerInfo:N,commentBox:S,category:T,multicategories:F,hint:P,featureImageID:O,featureImageSrc:R,answers:A,answerEditor:U,matchAnswer:H,required:M,settings:L}=n,[Q,j]=(0,a.useState)(L);(0,a.useEffect)((()=>{let e=!0;if(e&&(d(C)||"0"==C||!d(C)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:r}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&r===e}))})(C,q))){let e=g({id:null,rest_nonce:k,quizID:x,quiz_name:y,postID:I,answerEditor:h(U,"text"),type:h(B,"0"),name:_(h(D)),question_title:h(z),answerInfo:_(h(N)),comments:h(S,"1"),hint:h(P),category:h(T),multicategories:[],required:h(M,1),answers:A,page:0,featureImageID:O,featureImageSrc:R,matchAnswer:null});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if(console.log("question created",e),"success"==e.status){let t=e.id;m({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]);const W=(0,i.useBlockProps)({className:w?" in-editing-mode":""});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,r.__)("ID","quiz-master-next")+": "+C),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:B||qsmBlockData.question_type.default,onChange:e=>m({type:e}),__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:U||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>m({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,r.__)("Required","quiz-master-next"),checked:!d(M)&&"1"==M,onChange:()=>m({required:d(M)||"1"!=M?1:0})})),(0,a.createElement)(b,{isCategorySelected:e=>T==e||F.includes(e),setUnsetCatgory:e=>{if(d(T)&&(d(F)||0===F.length))m({category:e});else if(e==T)m({category:""});else{let t=d(F)||0===F.length?[]:F;t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),m({category:"",multicategories:[...t]})}}}),(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(E,{featureImageID:O,onUpdateImage:e=>{m({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{m({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:S||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>m({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...W},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,r.__)("Question title","quiz-master-next"),"aria-label":(0,r.__)("Question title","quiz-master-next"),placeholder:(0,r.__)("Type your question here","quiz-master-next"),value:z,onChange:e=>m({title:p(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),w&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Question description","quiz-master-next"),"aria-label":(0,r.__)("Question description","quiz-master-next"),placeholder:(0,r.__)("Description goes here","quiz-master-next"),value:_(D),onChange:e=>m({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,r.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,r.__)("Correct answer info goes here","quiz-master-next"),value:_(N),onChange:e=>m({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Hint","quiz-master-next"),"aria-label":(0,r.__)("Hint","quiz-master-next"),placeholder:(0,r.__)("hint goes here","quiz-master-next"),value:P,onChange:e=>m({hint:p(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"}))))}})}(); \ No newline at end of file diff --git a/blocks/build/question/index.js.map b/blocks/build/question/index.js.map deleted file mode 100644 index fd19f3581..000000000 --- a/blocks/build/question/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"question/index.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;AAE9F,MAAMC,eAAe,GAAKC,IAAI,IAAM;EAC1C,IAAKH,UAAU,CAAEG,IAAK,CAAC,EAAG;IACzBA,IAAI,GAAG,EAAE;EACV,CAAC,MAAM;IACNA,IAAI,GAAGA,IAAI,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,IAAI,EAAE,GAAI,CAAC;IAC9CF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAC/B;EAEA,OAAOF,IAAI;AACZ,CAAC;;AAED;AACO,MAAMG,YAAY,GAAKC,IAAI,IAAMA,IAAI,CAACF,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;;AAE1E;AACO,MAAMG,WAAW,GAAGA,CAAEC,GAAG,GAAG,KAAK,KAAM;EAC7C,IAAIC,OAAO,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAC5BD,OAAO,CAACE,MAAM,CAAC,oBAAoB,EAAE,GAAG,CAAC;EACzC,IAAK,KAAK,KAAKH,GAAG,EAAG;IACpB,KAAM,IAAII,CAAC,IAAIJ,GAAG,EAAG;MACpB,IAAKA,GAAG,CAACK,cAAc,CAAED,CAAE,CAAC,EAAG;QAC5BH,OAAO,CAACE,MAAM,CAAEC,CAAC,EAAEJ,GAAG,CAACI,CAAC,CAAE,CAAC;MAC9B;IACD;EACD;EACA,OAAOH,OAAO;AACf,CAAC;;AAED;AACO,MAAMK,SAAS,GAAGA,CAACC,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;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpC+D,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAEpE,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/question/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/question/index.js"],"sourcesContent":["//Check if undefined, null, empty\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\n\nexport const qsmSanitizeName = ( name ) => {\n\tif ( qsmIsEmpty( name ) ) {\n\t\tname = '';\n\t} else {\n\t\tname = name.toLowerCase().replace( / /g, '_' );\n\t\tname = name.replace(/\\W/g, '');\n\t}\n\t\n\treturn name;\n}\n\n// Remove anchor tags from button text content.\nexport const qsmStripTags = ( text ) => text.replace( /<\\/?a[^>]*>/g, '' );\n\n//prepare form data\nexport const qsmFormData = ( obj = false ) => {\n\tlet newData = new FormData();\n\tnewData.append('qsm_block_api_call', '1');\n\tif ( false !== obj ) {\n\t\tfor ( let k in obj ) {\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\n\t\t\t newData.append( k, obj[k] );\n\t\t\t}\n\t\t}\n\t}\n\treturn newData;\n}\n\n//generate uiniq id\nexport const qsmUniqid = (prefix = \"\", random = false) => {\n const sec = Date.now() * 1000 + Math.random() * 1000;\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\n};\n\n//return data if not empty otherwise default value\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tInspectorControls,\n\tRichText,\n\tInnerBlocks,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToggleControl,\n\tRangeControl,\n\tRadioControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\n/**\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\n * \n */\n\nexport default function Edit( props ) {\n\t//check for QSM initialize data\n\tif ( 'undefined' === typeof qsmBlockData ) {\n\t\treturn null;\n\t}\n\t\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\n\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\n\n\tconst quizID = context['quiz-master-next/quizID'];\n\tconst pageID = context['quiz-master-next/pageID'];\n\t\n\tconst {\n\t\tquestionID,\n\t\ttype,\n\t\tdescription,\n\t\ttitle,\n\t\tcorrectAnswerInfo,\n\t\tcommentBox,\n\t\tcategory,\n\t\tmulticategories,\n\t\thint,\n\t\tfeatureImageID,\n\t\tfeatureImageSrc,\n\t\tanswers,\n\t\tanswerEditor,\n\t\tmatchAnswer,\n\t\totherSettings,\n\t\tsettings,\n\t} = attributes;\n\n\tconst [ quesAttr, setQuesAttr ] = useState( settings );\n\n\t/**Initialize block from server */\n\tuseEffect( () => {\n\t\tlet shouldSetQSMAttr = true;\n\t\tif ( shouldSetQSMAttr ) {\n\n\t\t\t\n\t\t}\n\t\t\n\t\t//cleanup\n\t\treturn () => {\n\t\t\tshouldSetQSMAttr = false;\n\t\t};\n\t\t\n\t}, [ quizID ] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\n\t} );\n\n\t//Decode htmlspecialchars\n\tconst decodeHtml = ( html ) => {\n\t\tvar txt = document.createElement(\"textarea\");\n\t\ttxt.innerHTML = html;\n\t\treturn txt.value;\n\t}\n\n\tconst QUESTION_TEMPLATE = [\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'0'\n\t\t\t}\n\t\t],\n\t\t[\n\t\t\t'qsm/quiz-answer-option',\n\t\t\t{\n\t\t\t\toptionID:'1'\n\t\t\t}\n\t\t]\n\n\t];\n\n\treturn (\n\t<>\n\t\n\t\t\n\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\n\t\t{ /** Question Type **/ }\n\t\t\n\t\t\t\tsetAttributes( { type } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t{\n\t\t\t ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \n\t\t\t\t(\n\t\t\t\t\n\t\t\t\t\t{\n\t\t\t\t\t\tqtypes.types.map( qtype => \n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t \t\n\t\t{/**Answer Type */}\n\t\t\n\t\t\t\tsetAttributes( { answerEditor } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t
\n\t\t{/**Comment Box */}\n\t\t\n\t\t\n\t\t\t\tsetAttributes( { commentBox } )\n\t\t\t}\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t\t\n\t
\n\t
\n\t\t setAttributes( { title: qsmStripTags( title ) } ) }\n\t\t\tallowedFormats={ [ ] }\n\t\t\twithoutInteractiveFormatting\n\t\t\tclassName={ 'qsm-question-title' }\n\t\t/>\n\t\t{\n\t\t\tisParentOfSelectedBlock && \n\t\t\t<>\n\t\t\t setAttributes({ description }) }\n\t\t\t\tclassName={ 'qsm-question-description' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t\n\t\t\t setAttributes({ correctAnswerInfo }) }\n\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\n\t\t\t\tallowedFormats={ [ ] }\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\tclassName={ 'qsm-question-hint' }\n\t\t\t/>\n\t\t\t\n\t\t}\n\t
\n\t\n\t);\n}\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\nimport Edit from './edit';\nimport metadata from './block.json';\n\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n} );\n"],"names":["qsmIsEmpty","data","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","__","useState","useEffect","apiFetch","InspectorControls","RichText","InnerBlocks","useBlockProps","store","editorStore","coreStore","useDispatch","useSelect","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","select","hasSelectedInnerBlock","quizID","pageID","questionID","type","description","title","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageID","featureImageSrc","answers","answerEditor","matchAnswer","otherSettings","settings","quesAttr","setQuesAttr","shouldSetQSMAttr","blockProps","decodeHtml","html","txt","document","createElement","innerHTML","value","QUESTION_TEMPLATE","optionID","Fragment","initialOpen","label","question_type","default","onChange","__nextHasNoMarginBottom","options","map","qtypes","key","types","qtype","slug","heading","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/render.php b/blocks/build/render.php deleted file mode 100644 index 02d32ba52..000000000 --- a/blocks/build/render.php +++ /dev/null @@ -1,8 +0,0 @@ - -

> - -

diff --git a/blocks/build/style-index.css b/blocks/build/style-index.css index 74830d632..8b1378917 100644 --- a/blocks/build/style-index.css +++ b/blocks/build/style-index.css @@ -1,11 +1 @@ -/*!***************************************************************************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! - \***************************************************************************************************************************************************************************************************************************************/ -/** - * The following styles get applied both on the front of your site - * and in the editor. - * - * Replace them with your own styles or remove the file completely. - */ -/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/blocks/build/style-index.css.map b/blocks/build/style-index.css.map deleted file mode 100644 index 4ba6a61fa..000000000 --- a/blocks/build/style-index.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA,C","sources":["webpack://qsm/./src/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n// .wp-block-qsm-main-block {\n// \tbackground-color: #21759b;\n// \tcolor: #fff;\n// \tpadding: 2px;\n// }\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/view.asset.php b/blocks/build/view.asset.php deleted file mode 100644 index c2564797e..000000000 --- a/blocks/build/view.asset.php +++ /dev/null @@ -1 +0,0 @@ - array(), 'version' => 'ed4bdcfa47e5d03db91a'); diff --git a/blocks/build/view.js b/blocks/build/view.js deleted file mode 100644 index 3d316cab8..000000000 --- a/blocks/build/view.js +++ /dev/null @@ -1,29 +0,0 @@ -/******/ (function() { // webpackBootstrap -var __webpack_exports__ = {}; -/*!*********************!*\ - !*** ./src/view.js ***! - \*********************/ -/** - * Use this file for JavaScript code that you want to run in the front-end - * on posts/pages that contain this block. - * - * When this file is defined as the value of the `viewScript` property - * in `block.json` it will be enqueued on the front end of the site. - * - * Example: - * - * ```js - * { - * "viewScript": "file:./view.js" - * } - * ``` - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script - */ - -/* eslint-disable no-console */ -console.log("Hello World! (from qsm-main-block block)"); -/* eslint-enable no-console */ -/******/ })() -; -//# sourceMappingURL=view.js.map \ No newline at end of file diff --git a/blocks/build/view.js.map b/blocks/build/view.js.map deleted file mode 100644 index e791abefb..000000000 --- a/blocks/build/view.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"view.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACAA,OAAO,CAACC,GAAG,CAAC,0CAA0C,CAAC;AACvD,8B","sources":["webpack://qsm/./src/view.js"],"sourcesContent":["/**\n * Use this file for JavaScript code that you want to run in the front-end \n * on posts/pages that contain this block.\n *\n * When this file is defined as the value of the `viewScript` property\n * in `block.json` it will be enqueued on the front end of the site.\n *\n * Example:\n *\n * ```js\n * {\n * \"viewScript\": \"file:./view.js\"\n * }\n * ```\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script\n */\n \n/* eslint-disable no-console */\nconsole.log(\"Hello World! (from qsm-main-block block)\");\n/* eslint-enable no-console */\n"],"names":["console","log"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/src/answer-option/block.json b/blocks/src/answer-option/block.json index a5e76e8ec..161924681 100644 --- a/blocks/src/answer-option/block.json +++ b/blocks/src/answer-option/block.json @@ -26,7 +26,7 @@ "default": "0" } }, - "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/questionID" ], + "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/quizAttr", "quiz-master-next/questionID" ], "example": {}, "supports": { "html": false @@ -34,7 +34,5 @@ "textdomain": "main-block", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } \ No newline at end of file diff --git a/blocks/src/block.json b/blocks/src/block.json index a9c9f7874..810f1aa07 100644 --- a/blocks/src/block.json +++ b/blocks/src/block.json @@ -11,10 +11,15 @@ "quizID": { "type": "string", "default": "0" + }, + "quizAttr": { + "type": "object", + "default": {} } }, "providesContext": { - "quiz-master-next/quizID": "quizID" + "quiz-master-next/quizID": "quizID", + "quiz-master-next/quizAttr": "quizAttr" }, "example": {}, "supports": { @@ -23,7 +28,5 @@ "textdomain": "main-block", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } \ No newline at end of file diff --git a/blocks/src/component/FeaturedImage.js b/blocks/src/component/FeaturedImage.js new file mode 100644 index 000000000..1791d508b --- /dev/null +++ b/blocks/src/component/FeaturedImage.js @@ -0,0 +1,206 @@ +/** + * WordPress dependencies + */ +import { __, sprintf } from '@wordpress/i18n'; +import { applyFilters } from '@wordpress/hooks'; +import { + DropZone, + Button, + Spinner, + ResponsiveWrapper, + withNotices, + withFilters, + __experimentalHStack as HStack, +} from '@wordpress/components'; +import { isBlobURL } from '@wordpress/blob'; +import { useState, useRef, useEffect } from '@wordpress/element'; +import { store as noticesStore } from '@wordpress/notices'; +import { useDispatch, useSelect, select, withDispatch, withSelect } from '@wordpress/data'; +import { + MediaUpload, + MediaUploadCheck, + store as blockEditorStore, +} from '@wordpress/block-editor'; +import { store as coreStore } from '@wordpress/core-data'; +import { qsmIsEmpty } from '../helper'; + +const ALLOWED_MEDIA_TYPES = [ 'image' ]; + +// Used when labels from post type were not yet loaded or when they are not present. +const DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' ); +const DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' ); + +const instructions = ( +

+ { __( + 'To edit the featured image, you need permission to upload media.' + ) } +

+); + +const FeaturedImage = ( { + featureImageID, + onUpdateImage, + onRemoveImage +} ) => { + const { createNotice } = useDispatch( noticesStore ); + const toggleRef = useRef(); + const [ isLoading, setIsLoading ] = useState( false ); + const [ media, setMedia ] = useState( undefined ); + const { mediaFeature, mediaUpload } = useSelect( ( select ) => { + const { getMedia } = select( coreStore ); + return { + mediaFeature: qsmIsEmpty( media ) && ! qsmIsEmpty( featureImageID ) && getMedia( featureImageID ), + mediaUpload: select( blockEditorStore ).getSettings().mediaUpload + }; + }, [] ); + + /**Set media data */ + useEffect( () => { + let shouldSetQSMAttr = true; + if ( shouldSetQSMAttr ) { + if ( ! qsmIsEmpty( mediaFeature ) && 'object' === typeof mediaFeature ) { + setMedia({ + id: featureImageID, + width: mediaFeature.media_details.width, + height: mediaFeature.media_details.height, + url: mediaFeature.source_url, + alt_text: mediaFeature.alt_text, + slug: mediaFeature.slug + }); + } + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + + }, [ mediaFeature ] ); + + function onDropFiles( filesList ) { + mediaUpload( { + allowedTypes: [ 'image' ], + filesList, + onFileChange( [ image ] ) { + if ( isBlobURL( image?.url ) ) { + setIsLoading( true ); + return; + } + onUpdateImage( image ); + setIsLoading( false ); + }, + onError( message ) { + createNotice( 'error', message, { + isDismissible: true, + type: 'snackbar', + } ); + }, + } ); + } + + return ( +
+ { media && ( +
+ { media.alt_text && + sprintf( + // Translators: %s: The selected image alt text. + __( 'Current image: %s' ), + media.alt_text + ) } + { ! media.alt_text && + sprintf( + // Translators: %s: The selected image filename. + __( + 'The current image has no alternative text. The file name is: %s' + ), + media.slug + ) } +
+ ) } + + { + setMedia( media ); + onUpdateImage( media ); + } } + unstableFeaturedImageFlow + allowedTypes={ ALLOWED_MEDIA_TYPES } + modalClass="editor-post-featured-image__media-modal" + render={ ( { open } ) => ( +
+ + { !! featureImageID && ( + + + + + ) } + +
+ ) } + value={ featureImageID } + /> +
+
+ ); +} + +export default FeaturedImage; \ No newline at end of file diff --git a/blocks/src/component/SelectAddCategory.js b/blocks/src/component/SelectAddCategory.js new file mode 100644 index 000000000..359bf110c --- /dev/null +++ b/blocks/src/component/SelectAddCategory.js @@ -0,0 +1,189 @@ +/** + * Select or add a category + */ +import { __ } from '@wordpress/i18n'; +import { useState, useEffect } from '@wordpress/element'; +import apiFetch from '@wordpress/api-fetch'; +import { + PanelBody, + Button, + TreeSelect, + TextControl, + ToggleControl, + RangeControl, + RadioControl, + SelectControl, + CheckboxControl, + Flex, + FlexItem, +} from '@wordpress/components'; +import { qsmIsEmpty, qsmFormData } from '../helper'; + +const SelectAddCategory = ({ + isCategorySelected, + setUnsetCatgory +}) => { + + //weather showing add category form + const [ showForm, setShowForm ] = useState( false ); + //new category name + const [ formCatName, setFormCatName ] = useState( '' ); + //new category prent id + const [ formCatParent, setFormCatParent ] = useState( 0 ); + //new category adding start status + const [ addingNewCategory, setAddingNewCategory ] = useState( false ); + //error + const [ newCategoryError, setNewCategoryError ] = useState( false ); + //category list + const [ categories, setCategories ] = useState( qsmBlockData?.hierarchicalCategoryList ); + + const addNewCategoryLabel = __( 'Add New Category ', 'quiz-master-next' ); + const noParentOption = `— ${ __( 'Parent Category ', 'quiz-master-next' ) } —`; + + //Add new category + const onAddCategory = async ( event ) => { + event.preventDefault(); + if ( newCategoryError || qsmIsEmpty( formCatName ) || addingNewCategory ) { + return; + } + setAddingNewCategory( true ); + + //create a page + apiFetch( { + url: qsmBlockData.ajax_url, + method: 'POST', + body: qsmFormData({ + 'action': 'save_new_category', + 'name': formCatName, + 'parent': formCatParent + }) + } ).then( ( res ) => { + if ( ! qsmIsEmpty( res.term_id ) ) { + let term_id = res.term_id; + //console.log("save_new_category",res); + //set category list + apiFetch( { + path: '/quiz-survey-master/v1/quiz/hierarchical-category-list', + method: 'POST' + } ).then( ( res ) => { + // console.log("new categorieslist", res); + if ( 'success' == res.status ) { + setCategories( res.result ); + //set form + setFormCatName( '' ); + setFormCatParent( 0 ); + //set category selected + setUnsetCatgory( term_id ); + setAddingNewCategory( false ); + } + }); + + } + + }); + } + + const addNewCategoryInList = () => { + + } + + //check if category name already exists and set new category name + const checkSetNewCategory = ( catName, categories ) => { + let matchName = false; + categories.forEach( cat => { + if ( cat.name == catName ) { + matchName = true; + return false; + } else if ( 0 < cat.children.length ) { + checkSetNewCategory( catName, cat.children ) + } + }); + + setNewCategoryError( matchName ); + setFormCatName( catName ); + } + + const renderTerms = ( categories ) => { + return categories.map( ( term ) => { + return ( +
+ setUnsetCatgory( term.id ) } + /> + { !! term.children.length && ( +
+ { renderTerms( term.children ) } +
+ ) } +
+ ); + } ); + }; + + return( + +
+ { renderTerms( categories ) } +
+
+ +
+ { showForm && ( +
+ + checkSetNewCategory( formCatName, categories ) } + required + /> + { 0 < categories.length && ( + setFormCatParent( id ) } + selectedId={ formCatParent } + tree={ categories } + /> + ) } + + + + +

+ { newCategoryError && __( 'Category ', 'quiz-master-next' ) + formCatName + __( ' already exists.', 'quiz-master-next' ) } +

+
+
+
+ ) } +
+ ); +} + +export default SelectAddCategory; \ No newline at end of file diff --git a/blocks/src/edit.js b/blocks/src/edit.js index c4e0c34d6..bdfa76c8a 100644 --- a/blocks/src/edit.js +++ b/blocks/src/edit.js @@ -25,7 +25,7 @@ import { __experimentalVStack as VStack, } from '@wordpress/components'; import './editor.scss'; -import { qsmIsEmpty, qsmFormData, qsmUniqid, qsmValueOrDefault } from './helper'; +import { qsmIsEmpty, qsmFormData, qsmUniqid, qsmValueOrDefault, qsmDecodeHtml } from './helper'; export default function Edit( props ) { //check for QSM initialize data if ( 'undefined' === typeof qsmBlockData ) { @@ -35,11 +35,12 @@ export default function Edit( props ) { const { className, attributes, setAttributes, isSelected, clientId } = props; const { createNotice } = useDispatch( noticesStore ); const { - quizID + quizID, + quizAttr } = attributes; //quiz attribute - const [ quizAttr, setQuizAttr ] = useState( qsmBlockData.globalQuizsetting ); + const globalQuizsetting = qsmBlockData.globalQuizsetting; //quiz list const [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList ); //quiz list @@ -61,155 +62,26 @@ export default function Edit( props ) { //check if page is saving const isSavingPage = useSelect( ( select ) => { const { isAutosavingPost, isSavingPost } = select( editorStore ); - return isSavingPost() || isAutosavingPost(); + return isSavingPost() && ! isAutosavingPost(); }, [] ); const { getBlock } = useSelect( blockEditorStore ); - /** - * Prepare quiz data e.g. quiz details, questions, answers etc to save - * @returns quiz data - */ - const getQuizDataToSave = ( ) => { - let blocks = getBlock( clientId ); - if ( qsmIsEmpty( blocks ) ) { - return false; - } - console.log( "blocks", blocks); - blocks = blocks.innerBlocks; - let quizDataToSave = { - quiz_id: quizAttr.quiz_id, - post_id: quizAttr.post_id, - quiz:{}, - pages:[], - qpages:[], - questions:[] - }; - let pageSNo = 0; - //loop through inner blocks - blocks.forEach( (block) => { - if ( 'qsm/quiz-page' === block.name ) { - let pageID = block.attributes.pageID; - let questions = []; - if ( ! qsmIsEmpty( block.innerBlocks ) && 0 < block.innerBlocks.length ) { - let questionBlocks = block.innerBlocks; - //Question Blocks - questionBlocks.forEach( ( questionBlock ) => { - if ( 'qsm/quiz-question' !== questionBlock.name ) { - return true; - } - let answers = []; - //Answer option blocks - if ( ! qsmIsEmpty( questionBlock.innerBlocks ) && 0 < questionBlock.innerBlocks.length ) { - let answerOptionBlocks = questionBlock.innerBlocks; - answerOptionBlocks.forEach( ( answerOptionBlock ) => { - if ( 'qsm/quiz-answer-option' !== answerOptionBlock.name ) { - return true; - } - let answerAttr = answerOptionBlock.attributes; - answers.push([ - qsmValueOrDefault( answerAttr?.content ), - qsmValueOrDefault( answerAttr?.points ), - qsmValueOrDefault( answerAttr?.isCorrect ), - ]); - }); - } - - //questions Data - let questionAttr = questionBlock.attributes; - questions.push( questionAttr.questionID ); - quizDataToSave.questions.push({ - "id": questionAttr.questionID, - "quizID": quizAttr.quiz_id, - "postID": quizAttr.post_id, - "type": qsmValueOrDefault( questionAttr?.type , '0' ), - "name": qsmValueOrDefault( questionAttr?.description ), - "question_title": qsmValueOrDefault( questionAttr?.title ), - "answerInfo": qsmValueOrDefault( questionAttr?.correctAnswerInfo ), - "comments": qsmValueOrDefault( questionAttr?.commentBox, '1' ), - "hint": qsmValueOrDefault( questionAttr?.hint ), - "category": qsmValueOrDefault( questionAttr?.category ), - "required": qsmValueOrDefault( questionAttr?.required, 1 ), - "answers": answers, - "page": pageSNo - }); - }); - } - - // pages[0][]: 2512 - // qpages[0][id]: 2 - // qpages[0][quizID]: 76 - // qpages[0][pagekey]: Ipj90nNT - // qpages[0][hide_prevbtn]: 0 - // qpages[0][questions][]: 2512 - // post_id: 111 - //page data - quizDataToSave.pages.push( questions ); - quizDataToSave.qpages.push( { - 'id': pageID, - 'quizID': quizAttr.quiz_id, - 'pagekey': block.attributes.pageKey, - 'hide_prevbtn':block.attributes.hidePrevBtn, - 'questions': questions - } ); - pageSNo++; - } - }); - - //Quiz details - quizDataToSave.quiz = { - 'quiz_name': quizAttr.quiz_name, - 'quiz_id': quizAttr.quiz_id, - 'post_id': quizAttr.post_id, - }; - if ( showAdvanceOption ) { - [ - 'form_type', - 'system', - 'timer_limit', - 'pagination', - 'enable_contact_form', - 'enable_pagination_quiz', - 'show_question_featured_image_in_result', - 'progress_bar', - 'require_log_in', - 'disable_first_page', - 'comment_section' - ].forEach( ( item ) => { - if ( 'undefined' !== typeof quizAttr[ item ] && null !== quizAttr[ item ] ) { - quizDataToSave.quiz[ item ] = quizAttr[ item ]; - } - }); - } - return quizDataToSave; - } - - //saving Quiz on save page - useEffect( () => { - if ( isSavingPage ) { - let qsmData = getQuizDataToSave(); - console.log("qsmData",qsmData); - } - }, [ isSavingPage ] ); - /**Initialize block from server */ useEffect( () => { let shouldSetQSMAttr = true; if ( shouldSetQSMAttr ) { - if ( ! qsmIsEmpty( quizID ) && 0 < quizID && ( qsmIsEmpty( quizAttr ) || qsmIsEmpty( quizAttr?.quizID ) || quizID != quizAttr.quiz_id ) ) { + if ( ! qsmIsEmpty( quizID ) && 0 < quizID ) { apiFetch( { path: '/quiz-survey-master/v1/quiz/structure', method: 'POST', data: { quizID: quizID }, } ).then( ( res ) => { - console.log( res ); + console.log( "quiz render data", res ); if ( 'success' == res.status ) { let result = res.result; - setQuizAttr( { - ...quizAttr, - ...result - } ); + setAttributes( { quizAttr: { ...result } } ); if ( ! qsmIsEmpty( result.qpages ) ) { let quizTemp = []; result.qpages.forEach( page => { @@ -439,9 +311,167 @@ export default function Edit( props ) { const setQuizAttributes = ( value , attr_name ) => { let newAttr = quizAttr; newAttr[ attr_name ] = value; - setQuizAttr( { ...newAttr } ); + setAttributes( { quizAttr: { ...newAttr } } ); } + /** + * Prepare quiz data e.g. quiz details, questions, answers etc to save + * @returns quiz data + */ + const getQuizDataToSave = ( ) => { + let blocks = getBlock( clientId ); + if ( qsmIsEmpty( blocks ) ) { + return false; + } + console.log( "blocks", blocks); + blocks = blocks.innerBlocks; + let quizDataToSave = { + quiz_id: quizAttr.quiz_id, + post_id: quizAttr.post_id, + quiz:{}, + pages:[], + qpages:[], + questions:[] + }; + let pageSNo = 0; + //loop through inner blocks + blocks.forEach( (block) => { + if ( 'qsm/quiz-page' === block.name ) { + let pageID = block.attributes.pageID; + let questions = []; + if ( ! qsmIsEmpty( block.innerBlocks ) && 0 < block.innerBlocks.length ) { + let questionBlocks = block.innerBlocks; + //Question Blocks + questionBlocks.forEach( ( questionBlock ) => { + if ( 'qsm/quiz-question' !== questionBlock.name ) { + return true; + } + let answers = []; + //Answer option blocks + if ( ! qsmIsEmpty( questionBlock.innerBlocks ) && 0 < questionBlock.innerBlocks.length ) { + let answerOptionBlocks = questionBlock.innerBlocks; + answerOptionBlocks.forEach( ( answerOptionBlock ) => { + if ( 'qsm/quiz-answer-option' !== answerOptionBlock.name ) { + return true; + } + let answerAttr = answerOptionBlock.attributes; + answers.push([ + qsmValueOrDefault( answerAttr?.content ), + qsmValueOrDefault( answerAttr?.points ), + qsmValueOrDefault( answerAttr?.isCorrect ), + ]); + }); + } + + //questions Data + let questionAttr = questionBlock.attributes; + questions.push( questionAttr.questionID ); + quizDataToSave.questions.push({ + "id": questionAttr.questionID, + "quizID": quizAttr.quiz_id, + "postID": quizAttr.post_id, + "answerEditor": qsmValueOrDefault( questionAttr?.answerEditor, 'text' ), + "type": qsmValueOrDefault( questionAttr?.type , '0' ), + "name": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.description ) ), + "question_title": qsmValueOrDefault( questionAttr?.title ), + "answerInfo": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.correctAnswerInfo ) ), + "comments": qsmValueOrDefault( questionAttr?.commentBox, '1' ), + "hint": qsmValueOrDefault( questionAttr?.hint ), + "category": qsmValueOrDefault( questionAttr?.category ), + "multicategories": [], + "required": qsmValueOrDefault( questionAttr?.required, 1 ), + "answers": answers, + "page": pageSNo + }); + }); + } + + // pages[0][]: 2512 + // qpages[0][id]: 2 + // qpages[0][quizID]: 76 + // qpages[0][pagekey]: Ipj90nNT + // qpages[0][hide_prevbtn]: 0 + // qpages[0][questions][]: 2512 + // post_id: 111 + //page data + quizDataToSave.pages.push( questions ); + quizDataToSave.qpages.push( { + 'id': pageID, + 'quizID': quizAttr.quiz_id, + 'pagekey': block.attributes.pageKey, + 'hide_prevbtn':block.attributes.hidePrevBtn, + 'questions': questions + } ); + pageSNo++; + } + }); + + //Quiz details + quizDataToSave.quiz = { + 'quiz_name': quizAttr.quiz_name, + 'quiz_id': quizAttr.quiz_id, + 'post_id': quizAttr.post_id, + }; + if ( showAdvanceOption ) { + [ + 'form_type', + 'system', + 'timer_limit', + 'pagination', + 'enable_contact_form', + 'enable_pagination_quiz', + 'show_question_featured_image_in_result', + 'progress_bar', + 'require_log_in', + 'disable_first_page', + 'comment_section' + ].forEach( ( item ) => { + if ( 'undefined' !== typeof quizAttr[ item ] && null !== quizAttr[ item ] ) { + quizDataToSave.quiz[ item ] = quizAttr[ item ]; + } + }); + } + return quizDataToSave; + } + + //saving Quiz on save page + useEffect( () => { + if ( isSavingPage ) { + let quizData = getQuizDataToSave(); + console.log( "quizData", quizData); + //save quiz status + setSaveQuiz( true ); + + quizData = qsmFormData({ + 'save_entire_quiz': '1', + 'quizData': JSON.stringify( quizData ), + 'qsm_block_quiz_nonce' : qsmBlockData.nonce, + "nonce": qsmBlockData.saveNonce,//save pages nonce + }); + + //AJAX call + apiFetch( { + path: '/quiz-survey-master/v1/quiz/save_quiz', + method: 'POST', + body: quizData + } ).then( ( res ) => { + console.log( res ); + } ).catch( + ( error ) => { + console.log( 'error',error ); + createNotice( 'error', error.message, { + isDismissible: true, + type: 'snackbar', + } ); + } + ); + } + }, [ isSavingPage ] ); + + /** + * Create new quiz and set quiz ID + * + */ const createNewQuiz = () => { if ( qsmIsEmpty( quizAttr.quiz_name ) ) { console.log("empty quiz_name"); @@ -449,10 +479,7 @@ export default function Edit( props ) { } //save quiz status setSaveQuiz( true ); - // let quizData = { - // "quiz_name": quizAttr.quiz_name, - // "qsm_new_quiz_nonce": qsmBlockData.qsm_new_quiz_nonce - // }; + let quizData = qsmFormData({ 'quiz_name': quizAttr.quiz_name, 'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce @@ -487,6 +514,7 @@ export default function Edit( props ) { let newQuestion = qsmFormData( { "id": null, "quizID": res.quizID, + "answerEditor": "text", "type": "0", "name": "", "question_title": "", diff --git a/blocks/src/editor.scss b/blocks/src/editor.scss index 84d61d3ff..ae64b8c28 100644 --- a/blocks/src/editor.scss +++ b/blocks/src/editor.scss @@ -17,6 +17,14 @@ } } +.qsm-ptb-1{ + padding: 1rem 0; +} + +p.qsm-error-text{ + color: #FD3E3E; +} + .qsm-placeholder-quiz-create-form{ width: 50%; .components-button{ diff --git a/blocks/src/helper.js b/blocks/src/helper.js index 7c04bb359..45b219e2e 100644 --- a/blocks/src/helper.js +++ b/blocks/src/helper.js @@ -1,6 +1,13 @@ //Check if undefined, null, empty export const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data ); +//Decode htmlspecialchars +export const qsmDecodeHtml = ( html ) => { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; +} + export const qsmSanitizeName = ( name ) => { if ( qsmIsEmpty( name ) ) { name = ''; @@ -18,6 +25,7 @@ export const qsmStripTags = ( text ) => text.replace( /<\/?a[^>]*>/g, '' ); //prepare form data export const qsmFormData = ( obj = false ) => { let newData = new FormData(); + //add to check if api call from editor newData.append('qsm_block_api_call', '1'); if ( false !== obj ) { for ( let k in obj ) { @@ -29,6 +37,27 @@ export const qsmFormData = ( obj = false ) => { return newData; } +//add objecyt to form data +export const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => { + if ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) { + return data; + } + + for (let key in valueObj) { + if ( valueObj.hasOwnProperty(key) ) { + let value = valueObj[key]; + if ( 'object' === value ) { + qsmAddObjToFormData( formKey+'['+key+']', value, data ); + } else { + data.append( formKey+'['+key+']', valueObj[key] ); + } + + } + } + + return data; +} + //generate uiniq id export const qsmUniqid = (prefix = "", random = false) => { const sec = Date.now() * 1000 + Math.random() * 1000; diff --git a/blocks/src/page/block.json b/blocks/src/page/block.json index a613e61c6..9aa9af2b9 100644 --- a/blocks/src/page/block.json +++ b/blocks/src/page/block.json @@ -22,18 +22,17 @@ "default": "0" } }, - "usesContext": [ "quiz-master-next/quizID" ], + "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/quizAttr" ], "providesContext": { "quiz-master-next/pageID": "pageID" }, "example": {}, "supports": { - "html": false + "html": false, + "multiple": false }, "textdomain": "main-block", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } \ No newline at end of file diff --git a/blocks/src/page/edit.js b/blocks/src/page/edit.js index 83be8c66a..712a670f7 100644 --- a/blocks/src/page/edit.js +++ b/blocks/src/page/edit.js @@ -34,20 +34,6 @@ export default function Edit( props ) { const [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting ); - /**Initialize block from server */ - useEffect( () => { - let shouldSetQSMAttr = true; - if ( shouldSetQSMAttr ) { - //console.log("attr",attributes); - - } - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - - }, [ quizID ] ); const blockProps = useBlockProps(); return ( diff --git a/blocks/src/question/block.json b/blocks/src/question/block.json index 4587cb05c..9532240a7 100644 --- a/blocks/src/question/block.json +++ b/blocks/src/question/block.json @@ -67,16 +67,14 @@ "type": "string", "default": "0" }, - "otherSettings": { - "type": "object", - "default": {} + "media": { + "type": "object" }, "settings": { - "type": "object", - "default": {} + "type": "object" } }, - "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID" ], + "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/quizAttr" ], "providesContext": { "quiz-master-next/questionID": "questionID" }, @@ -87,7 +85,5 @@ "textdomain": "main-block", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } \ No newline at end of file diff --git a/blocks/src/question/edit.js b/blocks/src/question/edit.js index e399ba8a3..9b1d97cf7 100644 --- a/blocks/src/question/edit.js +++ b/blocks/src/question/edit.js @@ -7,9 +7,8 @@ import { InnerBlocks, useBlockProps, } from '@wordpress/block-editor'; -import { store as editorStore } from '@wordpress/editor'; -import { store as coreStore } from '@wordpress/core-data'; -import { useDispatch, useSelect } from '@wordpress/data'; +import { store as noticesStore } from '@wordpress/notices'; +import { useDispatch, useSelect, select } from '@wordpress/data'; import { PanelBody, PanelRow, @@ -18,13 +17,27 @@ import { RangeControl, RadioControl, SelectControl, + CheckboxControl, } from '@wordpress/components'; -import { qsmIsEmpty, qsmStripTags } from '../helper'; +import FeaturedImage from '../component/FeaturedImage'; +import SelectAddCategory from '../component/SelectAddCategory'; +import { qsmIsEmpty, qsmStripTags, qsmFormData, qsmValueOrDefault, qsmDecodeHtml, qsmAddObjToFormData } from '../helper'; + + +//check for duplicate questionID attr +const isQuestionIDReserved = ( questionIDCheck, clientIdCheck ) => { + const blocksClientIds = select( 'core/block-editor' ).getClientIdsWithDescendants(); + return qsmIsEmpty( blocksClientIds ) ? false : blocksClientIds.some( ( blockClientId ) => { + const { questionID } = select( 'core/block-editor' ).getBlockAttributes( blockClientId ); + //different Client Id but same questionID attribute means duplicate + return clientIdCheck !== blockClientId && questionID === questionIDCheck; + } ); +}; + /** * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array * */ - export default function Edit( props ) { //check for QSM initialize data if ( 'undefined' === typeof qsmBlockData ) { @@ -37,8 +50,14 @@ export default function Edit( props ) { const isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) ); const quizID = context['quiz-master-next/quizID']; + const { + quiz_name, + post_id, + rest_nonce + } = context['quiz-master-next/quizAttr']; const pageID = context['quiz-master-next/pageID']; - + const { createNotice } = useDispatch( noticesStore ); + const { questionID, type, @@ -54,38 +73,78 @@ export default function Edit( props ) { answers, answerEditor, matchAnswer, - otherSettings, + required, settings, } = attributes; const [ quesAttr, setQuesAttr ] = useState( settings ); - - /**Initialize block from server */ + + /**Generate question id if not set or in case duplicate questionID ***/ useEffect( () => { - let shouldSetQSMAttr = true; - if ( shouldSetQSMAttr ) { + let shouldSetID = true; + if ( shouldSetID ) { + + if ( qsmIsEmpty( questionID ) || '0' == questionID || ( ! qsmIsEmpty( questionID ) && isQuestionIDReserved( questionID, clientId ) ) ) { + + //create a question + let newQuestion = qsmFormData( { + "id": null, + "rest_nonce": rest_nonce, + "quizID": quizID, + "quiz_name": quiz_name, + "postID": post_id, + "answerEditor": qsmValueOrDefault( answerEditor, 'text' ), + "type": qsmValueOrDefault( type , '0' ), + "name": qsmDecodeHtml( qsmValueOrDefault( description ) ), + "question_title": qsmValueOrDefault( title ), + "answerInfo": qsmDecodeHtml( qsmValueOrDefault( correctAnswerInfo ) ), + "comments": qsmValueOrDefault( commentBox, '1' ), + "hint": qsmValueOrDefault( hint ), + "category": qsmValueOrDefault( category ), + "multicategories": [], + "required": qsmValueOrDefault( required, 1 ), + "answers": answers, + "page": 0, + "featureImageID": featureImageID, + "featureImageSrc": featureImageSrc, + "matchAnswer": null, + } ); - + //AJAX call + apiFetch( { + path: '/quiz-survey-master/v1/questions', + method: 'POST', + body: newQuestion + } ).then( ( response ) => { + console.log("question created", response); + if ( 'success' == response.status ) { + let question_id = response.id; + setAttributes( { questionID: question_id } ); + } + }).catch( + ( error ) => { + console.log( 'error',error ); + createNotice( 'error', error.message, { + isDismissible: true, + type: 'snackbar', + } ); + } + ); + } } //cleanup return () => { - shouldSetQSMAttr = false; + shouldSetID = false; }; - }, [ quizID ] ); + }, [] ); + //add classes const blockProps = useBlockProps( { className: isParentOfSelectedBlock ? ' in-editing-mode':'' , } ); - //Decode htmlspecialchars - const decodeHtml = ( html ) => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; - } - const QUESTION_TEMPLATE = [ [ 'qsm/quiz-answer-option', @@ -102,6 +161,34 @@ export default function Edit( props ) { ]; + //check if a category is selected + const isCategorySelected = ( termId ) => ( category == termId || multicategories.includes( termId ) ); + + //set or unset category + const setUnsetCatgory = ( termId ) => { + if ( qsmIsEmpty( category ) && ( qsmIsEmpty( multicategories ) || 0 === multicategories.length ) ) { + setAttributes({ category: termId }); + } else if ( termId == category ) { + setAttributes({ category: '' }); + } else { + let multiCat = ( qsmIsEmpty( multicategories ) || 0 === multicategories.length ) ? [] : multicategories; + + if ( multiCat.includes( termId ) ) { + //remove category if already set + multiCat = multiCat.filter( catID => catID != termId ); + } else { + //add category if not set + multiCat.push( termId ); + //console.log("add multi", termId); + } + + setAttributes({ + category: '', + multicategories: [ ...multiCat ] + }); + } + } + return ( <> @@ -142,6 +229,34 @@ export default function Edit( props ) { } __nextHasNoMarginBottom /> + setAttributes( { required : ( ( ! qsmIsEmpty( required ) && '1' == required ) ? 0 : 1 ) } ) } + /> + + {/**Categories */} + + {/**Feature Image */} + + { + setAttributes({ + featureImageID: mediaDetails.id, + featureImageSrc: mediaDetails.url + }); + } } + onRemoveImage={ ( id ) => { + setAttributes({ + featureImageID: undefined, + featureImageSrc: undefined, + }); + } } + /> {/**Comment Box */} @@ -176,7 +291,7 @@ export default function Edit( props ) { title={ __( 'Question description', 'quiz-master-next' ) } aria-label={ __( 'Question description', 'quiz-master-next' ) } placeholder={ __( 'Description goes here', 'quiz-master-next' ) } - value={ decodeHtml( description ) } + value={ qsmDecodeHtml( description ) } onChange={ ( description ) => setAttributes({ description }) } className={ 'qsm-question-description' } __unstableEmbedURLOnPaste @@ -191,7 +306,7 @@ export default function Edit( props ) { title={ __( 'Correct Answer Info', 'quiz-master-next' ) } aria-label={ __( 'Correct Answer Info', 'quiz-master-next' ) } placeholder={ __( 'Correct answer info goes here', 'quiz-master-next' ) } - value={ decodeHtml( correctAnswerInfo ) } + value={ qsmDecodeHtml( correctAnswerInfo ) } onChange={ ( correctAnswerInfo ) => setAttributes({ correctAnswerInfo }) } className={ 'qsm-question-correct-answer-info' } __unstableEmbedURLOnPaste diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index fab119ed6..bb37c6f39 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -556,6 +556,7 @@ public function register_quiz_post_types() { 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, + 'show_in_rest' => true, 'show_tagcloud' => false, 'rewrite' => false, ); diff --git a/php/admin/options-page-questions-tab.php b/php/admin/options-page-questions-tab.php index b46e4c3ae..e9f11cb7a 100644 --- a/php/admin/options-page-questions-tab.php +++ b/php/admin/options-page-questions-tab.php @@ -872,6 +872,9 @@ function qsm_ajax_save_pages() { ); wp_update_post( $update ); } + if ( is_qsm_block_api_call( 'save_entire_quiz' ) ) { + return true; + } echo wp_json_encode( $json ); wp_die(); } From 417e4cd602a1ab660c602061b525ffb07dbb3b8f Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Mon, 16 Oct 2023 14:07:05 +0530 Subject: [PATCH 05/27] save and render quiz --- blocks/block.php | 25 ++- blocks/build/block.json | 7 +- blocks/build/index.asset.php | 2 +- blocks/build/index.js | 2 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 2 +- blocks/src/block.json | 7 +- blocks/src/component/SelectAddCategory.js | 47 +++-- blocks/src/edit.js | 237 +++++++++++----------- 9 files changed, 186 insertions(+), 145 deletions(-) diff --git a/blocks/block.php b/blocks/block.php index bc3c1d897..b4a318b31 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -35,7 +35,7 @@ public function __construct() { add_action( 'enqueue_block_editor_assets', array( $this, 'register_block_scripts' ) ); add_action( 'rest_api_init', array( $this, 'register_editor_rest_routes' ) ); - + //$this->get_post_id_from_quiz_id( 98 ); } /** @@ -230,6 +230,9 @@ private function get_rest_nonce( $quiz_id ) { */ public function qsm_block_render( $attributes, $content, $block ) { global $qmnQuizManager; + if ( ! empty( $attributes ) && ! empty( $attributes['quizID'] ) ) { + $attributes['quiz'] = intval( $attributes['quizID'] ); + } return $qmnQuizManager->display_shortcode( $attributes ); } @@ -320,6 +323,7 @@ private function get_post_id_from_quiz_id( $quiz_id ) { $post_ids = get_posts( array( 'posts_per_page' => 1, 'post_type' => 'qsm_quiz', + 'post_status' => array( 'publish', 'draft' ), 'fields' => 'ids', 'meta_query' => array( array( @@ -330,6 +334,8 @@ private function get_post_id_from_quiz_id( $quiz_id ) { ), ) ); wp_reset_postdata(); + // echo "quis id $quiz_id
"; + // print_r( $post_ids );exit; return ( empty( $post_ids ) || ! is_array( $post_ids ) )? 0 : $post_ids[0]; } @@ -519,7 +525,8 @@ public function save_quiz( WP_REST_Request $request ) { if ( empty( $quiz_id ) || empty( $post_id ) ) { return array( 'status' => 'error', - 'msg' => __( 'Missing quiz_id or post_id', 'quiz-master-next' ) + 'msg' => __( 'Missing quiz_id or post_id', 'quiz-master-next' ), + 'post' => $_POST ); } @@ -537,11 +544,23 @@ public function save_quiz( WP_REST_Request $request ) { } } - //save quiz name + //save quiz name and publish quiz if ( ! empty( $_POST['quizData']['quiz'] ) && ! empty( $_POST['quizData']['quiz']['quiz_name'] ) ) { $quiz_name = sanitize_key( wp_unslash( $_POST['quizData']['quiz']['quiz_name'] ) ); if ( ! empty( $quiz_id ) && ! empty( $post_id ) && ! empty( $quiz_name ) ) { + //update quiz name $mlwQuizMasterNext->quizCreator->edit_quiz_name( $quiz_id, $quiz_name, $post_id ); + + //publish quiz + $update_status = wp_update_post( array( + 'ID' => $post_id, + 'post_status' => 'publish', + ) ); + $update_status = wp_update_post( $arg_post_arr ); + + if ( false === $update_status ) { + $mlwQuizMasterNext->log_manager->add( 'Error when updating quiz status', '', 0, 'error' ); + } } } diff --git a/blocks/build/block.json b/blocks/build/block.json index b5f90f8bc..2b3fe0436 100644 --- a/blocks/build/block.json +++ b/blocks/build/block.json @@ -9,12 +9,11 @@ "description": "Easily and quickly add quizzes and surveys inside the block editor.", "attributes": { "quizID": { - "type": "string", - "default": "0" + "type": "number", + "default": 0 }, "quizAttr": { - "type": "object", - "default": {} + "type": "object" } }, "providesContext": { diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 831ae1fa5..029abdc45 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '10d7a08f262e9513bd32'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '01f6847228e2d540454d'); diff --git a/blocks/build/index.js b/blocks/build/index.js index f9d96a9a2..f141c5522 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={758:function(e,t,n){var i=window.wp.blocks,s=window.wp.element,a=window.wp.i18n,o=window.wp.apiFetch,r=n.n(o),u=window.wp.blockEditor,l=window.wp.notices,c=window.wp.data,m=window.wp.editor,p=window.wp.components;const q=e=>null==e||""===e,_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},d=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},g=(e,t="")=>q(e)?t:e;(0,i.registerBlockType)("qsm/quiz",{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:o,clientId:z}=e,{createNotice:h}=(0,c.useDispatch)(l.store),{quizID:f,quizAttr:b}=n,[w,v]=(qsmBlockData.globalQuizsetting,(0,s.useState)(qsmBlockData.QSMQuizList)),[y,k]=(0,s.useState)({error:!1,msg:""}),[D,E]=(0,s.useState)(!1),[I,B]=(0,s.useState)(!1),[x,S]=(0,s.useState)(!1),[C,O]=(0,s.useState)([]),P=qsmBlockData.quizOptions,N=(0,c.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(m.store);return n()&&!t()}),[]),{getBlock:A}=(0,c.useSelect)(u.store);(0,s.useEffect)((()=>{let e=!0;return e&&!q(f)&&0{if(console.log("quiz render data",e),"success"==e.status){let t=e.result;if(i({quizAttr:{...t}}),!q(t.qpages)){let e=[];t.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2]}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),O(e)}}else console.log("error "+e.msg)})),()=>{e=!1}}),[f]);const T=(e,t)=>{let n=b;n[t]=e,i({quizAttr:{...n}})};(0,s.useEffect)((()=>{if(N){let e=(()=>{let e=A(z);if(q(e))return!1;console.log("blocks",e),e=e.innerBlocks;let t={quiz_id:b.quiz_id,post_id:b.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,s=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes;i.push([g(t?.content),g(t?.points),g(t?.isCorrect)])}));let a=e.attributes;s.push(a.questionID),t.questions.push({id:a.questionID,quizID:b.quiz_id,postID:b.post_id,answerEditor:g(a?.answerEditor,"text"),type:g(a?.type,"0"),name:_(g(a?.description)),question_title:g(a?.title),answerInfo:_(g(a?.correctAnswerInfo)),comments:g(a?.commentBox,"1"),hint:g(a?.hint),category:g(a?.category),multicategories:[],required:g(a?.required,1),answers:i,page:n})})),t.pages.push(s),t.qpages.push({id:i,quizID:b.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:b.quiz_name,quiz_id:b.quiz_id,post_id:b.post_id},x&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==b[e]&&null!==b[e]&&(t.quiz[e]=b[e])})),t})();console.log("quizData",e),B(!0),e=d({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),r()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{console.log(e)})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[N]);const M=(0,u.useBlockProps)(),Q=(0,u.useInnerBlocksProps)(M,{template:C,allowedBlocks:["qsm/quiz-page"]});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.InspectorControls,null,(0,s.createElement)(p.PanelBody,{title:(0,a.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,s.createElement)(p.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:b?.quiz_name||"",onChange:e=>T(e,"quiz_name")}))),q(f)||"0"==f?(0,s.createElement)(p.Placeholder,{icon:()=>(0,s.createElement)(p.Icon,{icon:"vault",size:"36"}),label:(0,a.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,a.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,s.createElement)(s.Fragment,null,!q(w)&&0i({quizID:e}),disabled:D,__nextHasNoMarginBottom:!0}),(0,s.createElement)("span",null,(0,a.__)("OR","quiz-master-next")),(0,s.createElement)(p.Button,{variant:"link",onClick:()=>E(!D)},(0,a.__)("Add New","quiz-master-next"))),(q(w)||D)&&(0,s.createElement)(p.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,s.createElement)(p.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:b?.quiz_name||"",onChange:e=>T(e,"quiz_name")}),(0,s.createElement)(p.Button,{variant:"link",onClick:()=>S(!x)},(0,a.__)("Advance options","quiz-master-next")),x&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.SelectControl,{label:P?.form_type?.label,value:b?.form_type,options:P?.form_type?.options,onChange:e=>T(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,s.createElement)(p.SelectControl,{label:P?.system?.label,value:b?.system,options:P?.system?.options,onChange:e=>T(e,"system"),help:P?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,s.createElement)(p.TextControl,{key:"quiz-create-text-"+e,type:"number",label:P?.[e]?.label,help:P?.[e]?.help,value:q(b[e])?0:b[e],onChange:t=>T(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,s.createElement)(p.ToggleControl,{key:"quiz-create-toggle-"+e,label:P?.[e]?.label,help:P?.[e]?.help,checked:!q(b[e])&&"1"==b[e],onChange:()=>T(q(b[e])||"1"!=b[e]?1:0,e)})))),(0,s.createElement)(p.Button,{variant:"primary",disabled:I||q(b.quiz_name),onClick:()=>(()=>{if(q(b.quiz_name))return void console.log("empty quiz_name");B(!0);let e=d({quiz_name:b.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});x&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===b[t]||null===b[t]?"":e.append(t,b[t]))),r()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(console.log(e),B(!1),"success"==e.status){let t=d({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});r()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if(console.log("question response",t),"success"==t.status){let n=t.id,s=d({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});s.append("pages[0][]",n),s.append("qpages[0][id]",1),s.append("qpages[0][quizID]",e.quizID),s.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+1e3*Math.random()).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.trunc(1e8*Math.random())}`:""}`)()),s.append("qpages[0][hide_prevbtn]",0),s.append("qpages[0][questions][]",n),r()({url:qsmBlockData.ajax_url,method:"POST",body:s}).then((t=>{console.log("pageResponse",t),"success"==t.status&&i({quizID:e.quizID})}))}})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))}h(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,a.__)("Create Quiz","quiz-master-next"))))):(0,s.createElement)("div",{...Q}))},save:e=>null})}},n={};function i(e){var s=n[e];if(void 0!==s)return s.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.m=t,e=[],i.O=function(t,n,s,a){if(!n){var o=1/0;for(c=0;c=a)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(r=!1,a0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,s,a]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,a,o=n[0],r=n[1],u=n[2],l=0;if(o.some((function(t){return 0!==e[t]}))){for(s in r)i.o(r,s)&&(i.m[s]=r[s]);if(u)var c=u(i)}for(t&&t(n);lnull==e||""===e,_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},d=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},g=(e,t="")=>q(e)?t:e;(0,i.registerBlockType)("qsm/quiz",{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:z}=e,{createNotice:h}=(0,c.useDispatch)(l.store),f=qsmBlockData.globalQuizsetting,{quizID:b,quizAttr:w=f}=n,[v,y]=(0,s.useState)(qsmBlockData.QSMQuizList),[k,E]=(0,s.useState)({error:!1,msg:""}),[D,I]=(0,s.useState)(!1),[B,x]=(0,s.useState)(!1),[S,C]=(0,s.useState)(!1),[O,P]=(0,s.useState)([]),N=qsmBlockData.quizOptions,A=(0,c.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(m.store);return n()&&!t()}),[]),{getBlock:T}=(0,c.useSelect)(u.store);(0,s.useEffect)((()=>{let e=!0;return e&&!q(b)&&0{e=!1}}),[]);const M=e=>{!q(e)&&0{if("success"==t.status){let n=t.result;if(i({quizID:parseInt(e),quizAttr:{...w,...n}}),!q(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2]}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),P(e)}}else console.log("error "+t.msg)}))},Q=(e,t)=>{let n=w;n[t]=e,i({quizAttr:{...n}})};(0,s.useEffect)((()=>{if(A){let e=(()=>{let e=T(z);if(q(e))return!1;e=e.innerBlocks;let t={quiz_id:w.quiz_id,post_id:w.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,s=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes;i.push([g(t?.content),g(t?.points),g(t?.isCorrect)])}));let a=e.attributes;s.push(a.questionID),t.questions.push({id:a.questionID,quizID:w.quiz_id,postID:w.post_id,answerEditor:g(a?.answerEditor,"text"),type:g(a?.type,"0"),name:_(g(a?.description)),question_title:g(a?.title),answerInfo:_(g(a?.correctAnswerInfo)),comments:g(a?.commentBox,"1"),hint:g(a?.hint),category:g(a?.category),multicategories:[],required:g(a?.required,1),answers:i,page:n})})),t.pages.push(s),t.qpages.push({id:i,quizID:w.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:w.quiz_name,quiz_id:w.quiz_id,post_id:w.post_id},S&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==w[e]&&null!==w[e]&&(t.quiz[e]=w[e])})),t})();x(!0),e=d({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[A]);const j=(0,u.useBlockProps)(),F=(0,u.useInnerBlocksProps)(j,{template:O,allowedBlocks:["qsm/quiz-page"]});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.InspectorControls,null,(0,s.createElement)(p.PanelBody,{title:(0,a.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,s.createElement)(p.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:w?.quiz_name||"",onChange:e=>Q(e,"quiz_name")}))),q(b)||"0"==b?(0,s.createElement)(p.Placeholder,{icon:()=>(0,s.createElement)(p.Icon,{icon:"vault",size:"36"}),label:(0,a.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,a.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,s.createElement)(s.Fragment,null,!q(v)&&0M(e),disabled:D,__nextHasNoMarginBottom:!0}),(0,s.createElement)("span",null,(0,a.__)("OR","quiz-master-next")),(0,s.createElement)(p.Button,{variant:"link",onClick:()=>I(!D)},(0,a.__)("Add New","quiz-master-next"))),(q(v)||D)&&(0,s.createElement)(p.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,s.createElement)(p.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:w?.quiz_name||"",onChange:e=>Q(e,"quiz_name")}),(0,s.createElement)(p.Button,{variant:"link",onClick:()=>C(!S)},(0,a.__)("Advance options","quiz-master-next")),S&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.SelectControl,{label:N?.form_type?.label,value:w?.form_type,options:N?.form_type?.options,onChange:e=>Q(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,s.createElement)(p.SelectControl,{label:N?.system?.label,value:w?.system,options:N?.system?.options,onChange:e=>Q(e,"system"),help:N?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,s.createElement)(p.TextControl,{key:"quiz-create-text-"+e,type:"number",label:N?.[e]?.label,help:N?.[e]?.help,value:q(w[e])?0:w[e],onChange:t=>Q(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,s.createElement)(p.ToggleControl,{key:"quiz-create-toggle-"+e,label:N?.[e]?.label,help:N?.[e]?.help,checked:!q(w[e])&&"1"==w[e],onChange:()=>Q(q(w[e])||"1"!=w[e]?1:0,e)})))),(0,s.createElement)(p.Button,{variant:"primary",disabled:B||q(w.quiz_name),onClick:()=>(()=>{if(q(w.quiz_name))return void console.log("empty quiz_name");x(!0);let e=d({quiz_name:w.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===w[t]||null===w[t]?"":e.append(t,w[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(console.log(e),x(!1),"success"==e.status){let t=d({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if(console.log("question response",t),"success"==t.status){let n=t.id,i=d({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});i.append("pages[0][]",n),i.append("qpages[0][id]",1),i.append("qpages[0][quizID]",e.quizID),i.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+1e3*Math.random()).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.trunc(1e8*Math.random())}`:""}`)()),i.append("qpages[0][hide_prevbtn]",0),i.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:i}).then((t=>{console.log("pageResponse",t),"success"==t.status&&M(e.quizID)}))}})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))}h(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,a.__)("Create Quiz","quiz-master-next"))))):(0,s.createElement)("div",{...F}))},save:e=>null})}},n={};function i(e){var s=n[e];if(void 0!==s)return s.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.m=t,e=[],i.O=function(t,n,s,a){if(!n){var r=1/0;for(c=0;c=a)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(o=!1,a0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,s,a]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,a,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(s in o)i.o(o,s)&&(i.m[s]=o[s]);if(u)var c=u(i)}for(t&&t(n);l array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'a24cbeda6e49d7c65688'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '959b91094cdbec43f14c'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 8b472805e..001c18005 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -2,4 +2,4 @@ // Translators: %s: The selected image alt text. (0,r.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,r.sprintf)( // Translators: %s: The selected image filename. -(0,r.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:f,onSelect:e=>{E(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:q,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,r.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&w),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,r.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{n(),_.current.focus()}},(0,r.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:I})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[n,i]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[h,q]=(0,a.useState)(!1),[f,w]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=(0,r.__)("Add New Category ","quiz-master-next"),E=`— ${(0,r.__)("Parent Category ","quiz-master-next")} —`,b=(e,t)=>{let a=!1;t.forEach((t=>{if(t.name==e)return a=!0,!1;0r.map((r=>(0,a.createElement)("div",{key:r.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:r.name,checked:e(r.id),onChange:()=>t(r.id)}),!!r.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},y(r.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,r.__)("Categories","quiz-master-next")},y(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!n)},x)),n&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),h||d(l)||_||(p(!0),o()({url:qsmBlockData.ajax_url,method:"POST",body:g({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;o()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(w(e.result),s(""),u(0),t(a),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,r.__)("Category Name","quiz-master-next"),value:l,onChange:e=>b(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:h||_},x)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},h&&(0,r.__)("Category ","quiz-master-next")+l+(0,r.__)(" already exists.","quiz-master-next"))))))},y=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(y.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:m,isSelected:u,clientId:q,context:f}=e,w=(0,s.useSelect)((e=>u||e("core/block-editor").hasSelectedInnerBlock(q,!0))),x=f["quiz-master-next/quizID"],{quiz_name:y,post_id:I,rest_nonce:k}=f["quiz-master-next/quizAttr"],{createNotice:v}=(f["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{questionID:C,type:B,description:D,title:z,correctAnswerInfo:N,commentBox:S,category:T,multicategories:F,hint:P,featureImageID:O,featureImageSrc:R,answers:A,answerEditor:U,matchAnswer:H,required:M,settings:L}=n,[Q,j]=(0,a.useState)(L);(0,a.useEffect)((()=>{let e=!0;if(e&&(d(C)||"0"==C||!d(C)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:r}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&r===e}))})(C,q))){let e=g({id:null,rest_nonce:k,quizID:x,quiz_name:y,postID:I,answerEditor:h(U,"text"),type:h(B,"0"),name:_(h(D)),question_title:h(z),answerInfo:_(h(N)),comments:h(S,"1"),hint:h(P),category:h(T),multicategories:[],required:h(M,1),answers:A,page:0,featureImageID:O,featureImageSrc:R,matchAnswer:null});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if(console.log("question created",e),"success"==e.status){let t=e.id;m({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]);const W=(0,i.useBlockProps)({className:w?" in-editing-mode":""});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,r.__)("ID","quiz-master-next")+": "+C),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:B||qsmBlockData.question_type.default,onChange:e=>m({type:e}),__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:U||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>m({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,r.__)("Required","quiz-master-next"),checked:!d(M)&&"1"==M,onChange:()=>m({required:d(M)||"1"!=M?1:0})})),(0,a.createElement)(b,{isCategorySelected:e=>T==e||F.includes(e),setUnsetCatgory:e=>{if(d(T)&&(d(F)||0===F.length))m({category:e});else if(e==T)m({category:""});else{let t=d(F)||0===F.length?[]:F;t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),m({category:"",multicategories:[...t]})}}}),(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(E,{featureImageID:O,onUpdateImage:e=>{m({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{m({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:S||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>m({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...W},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,r.__)("Question title","quiz-master-next"),"aria-label":(0,r.__)("Question title","quiz-master-next"),placeholder:(0,r.__)("Type your question here","quiz-master-next"),value:z,onChange:e=>m({title:p(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),w&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Question description","quiz-master-next"),"aria-label":(0,r.__)("Question description","quiz-master-next"),placeholder:(0,r.__)("Description goes here","quiz-master-next"),value:_(D),onChange:e=>m({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,r.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,r.__)("Correct answer info goes here","quiz-master-next"),value:_(N),onChange:e=>m({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Hint","quiz-master-next"),"aria-label":(0,r.__)("Hint","quiz-master-next"),placeholder:(0,r.__)("hint goes here","quiz-master-next"),value:P,onChange:e=>m({hint:p(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"}))))}})}(); \ No newline at end of file +(0,r.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:f,onSelect:e=>{E(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:q,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,r.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&w),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,r.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{n(),_.current.focus()}},(0,r.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:I})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[n,i]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[h,q]=(0,a.useState)(!1),[f,w]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=(0,r.__)("Add New Category ","quiz-master-next"),E=`— ${(0,r.__)("Parent Category ","quiz-master-next")} —`,b=e=>{let t=[];return e.forEach((e=>{if(t.push(e.name),0r.map((r=>(0,a.createElement)("div",{key:r.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:r.name,checked:e(r.id),onChange:()=>t(r.id)}),!!r.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},y(r.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,r.__)("Categories","quiz-master-next")},y(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!n)},x)),n&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),h||d(l)||_||(p(!0),o()({url:qsmBlockData.ajax_url,method:"POST",body:g({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;o()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(w(e.result),s(""),u(0),t(a),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,r.__)("Category Name","quiz-master-next"),value:l,onChange:e=>((e,t)=>{t=b(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:h||_},x)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==h&&(0,r.__)("Category ","quiz-master-next")+h+(0,r.__)(" already exists.","quiz-master-next"))))))},y=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(y.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:m,isSelected:u,clientId:q,context:f}=e,w=(0,s.useSelect)((e=>u||e("core/block-editor").hasSelectedInnerBlock(q,!0))),x=f["quiz-master-next/quizID"],{quiz_name:y,post_id:I,rest_nonce:k}=f["quiz-master-next/quizAttr"],{createNotice:v}=(f["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{questionID:C,type:B,description:D,title:z,correctAnswerInfo:N,commentBox:S,category:T,multicategories:F,hint:P,featureImageID:O,featureImageSrc:R,answers:A,answerEditor:U,matchAnswer:H,required:M,settings:L}=n,[Q,j]=(0,a.useState)(L);(0,a.useEffect)((()=>{let e=!0;if(e&&(d(C)||"0"==C||!d(C)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:r}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&r===e}))})(C,q))){let e=g({id:null,rest_nonce:k,quizID:x,quiz_name:y,postID:I,answerEditor:h(U,"text"),type:h(B,"0"),name:_(h(D)),question_title:h(z),answerInfo:_(h(N)),comments:h(S,"1"),hint:h(P),category:h(T),multicategories:[],required:h(M,1),answers:A,page:0,featureImageID:O,featureImageSrc:R,matchAnswer:null});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if(console.log("question created",e),"success"==e.status){let t=e.id;m({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]);const W=(0,i.useBlockProps)({className:w?" in-editing-mode":""});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,r.__)("ID","quiz-master-next")+": "+C),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:B||qsmBlockData.question_type.default,onChange:e=>m({type:e}),__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:U||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>m({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,r.__)("Required","quiz-master-next"),checked:!d(M)&&"1"==M,onChange:()=>m({required:d(M)||"1"!=M?1:0})})),(0,a.createElement)(b,{isCategorySelected:e=>T==e||F.includes(e),setUnsetCatgory:e=>{if(d(T)&&(d(F)||0===F.length))m({category:e});else if(e==T)m({category:""});else{let t=d(F)||0===F.length?[]:F;t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),m({category:"",multicategories:[...t]})}}}),(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(E,{featureImageID:O,onUpdateImage:e=>{m({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{m({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:S||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>m({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...W},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,r.__)("Question title","quiz-master-next"),"aria-label":(0,r.__)("Question title","quiz-master-next"),placeholder:(0,r.__)("Type your question here","quiz-master-next"),value:z,onChange:e=>m({title:p(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),w&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Question description","quiz-master-next"),"aria-label":(0,r.__)("Question description","quiz-master-next"),placeholder:(0,r.__)("Description goes here","quiz-master-next"),value:_(D),onChange:e=>m({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,r.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,r.__)("Correct answer info goes here","quiz-master-next"),value:_(N),onChange:e=>m({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Hint","quiz-master-next"),"aria-label":(0,r.__)("Hint","quiz-master-next"),placeholder:(0,r.__)("hint goes here","quiz-master-next"),value:P,onChange:e=>m({hint:p(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"}))))}})}(); \ No newline at end of file diff --git a/blocks/src/block.json b/blocks/src/block.json index 810f1aa07..f86462048 100644 --- a/blocks/src/block.json +++ b/blocks/src/block.json @@ -9,12 +9,11 @@ "description": "Easily and quickly add quizzes and surveys inside the block editor.", "attributes": { "quizID": { - "type": "string", - "default": "0" + "type": "number", + "default": 0 }, "quizAttr": { - "type": "object", - "default": {} + "type": "object" } }, "providesContext": { diff --git a/blocks/src/component/SelectAddCategory.js b/blocks/src/component/SelectAddCategory.js index 359bf110c..dece9879a 100644 --- a/blocks/src/component/SelectAddCategory.js +++ b/blocks/src/component/SelectAddCategory.js @@ -83,24 +83,43 @@ const SelectAddCategory = ({ }); } - const addNewCategoryInList = () => { - + const getCategoryNameArray = ( categories ) => { + let cats = []; + categories.forEach( cat => { + cats.push( cat.name ); + if ( 0 < cat.children.length ) { + let childCategory = getCategoryNameArray( cat.children ); + cats = [ ...cats, ...childCategory ]; + } + }); + return cats; } //check if category name already exists and set new category name const checkSetNewCategory = ( catName, categories ) => { - let matchName = false; - categories.forEach( cat => { - if ( cat.name == catName ) { - matchName = true; - return false; - } else if ( 0 < cat.children.length ) { - checkSetNewCategory( catName, cat.children ) - } - }); + categories = getCategoryNameArray( categories ); + console.log( "categories", categories ); + if ( categories.includes( catName ) ) { + setNewCategoryError( catName ); + } else { + setNewCategoryError( false ); + setFormCatName( catName ); + } + // categories.forEach( cat => { + // if ( cat.name == catName ) { + // matchName = true; + // return false; + // } else if ( 0 < cat.children.length ) { + // checkSetNewCategory( catName, cat.children ) + // } + // }); - setNewCategoryError( matchName ); - setFormCatName( catName ); + // if ( matchName ) { + // setNewCategoryError( matchName ); + // } else { + // setNewCategoryError( matchName ); + // setFormCatName( catName ); + // } } const renderTerms = ( categories ) => { @@ -176,7 +195,7 @@ const SelectAddCategory = ({

- { newCategoryError && __( 'Category ', 'quiz-master-next' ) + formCatName + __( ' already exists.', 'quiz-master-next' ) } + { false !== newCategoryError && __( 'Category ', 'quiz-master-next' ) + newCategoryError + __( ' already exists.', 'quiz-master-next' ) }

diff --git a/blocks/src/edit.js b/blocks/src/edit.js index bdfa76c8a..6941c088a 100644 --- a/blocks/src/edit.js +++ b/blocks/src/edit.js @@ -34,13 +34,14 @@ export default function Edit( props ) { const { className, attributes, setAttributes, isSelected, clientId } = props; const { createNotice } = useDispatch( noticesStore ); + //quiz attribute + const globalQuizsetting = qsmBlockData.globalQuizsetting; const { quizID, - quizAttr + quizAttr = globalQuizsetting } = attributes; - //quiz attribute - const globalQuizsetting = qsmBlockData.globalQuizsetting; + //quiz list const [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList ); //quiz list @@ -70,98 +71,8 @@ export default function Edit( props ) { /**Initialize block from server */ useEffect( () => { let shouldSetQSMAttr = true; - if ( shouldSetQSMAttr ) { - - if ( ! qsmIsEmpty( quizID ) && 0 < quizID ) { - apiFetch( { - path: '/quiz-survey-master/v1/quiz/structure', - method: 'POST', - data: { quizID: quizID }, - } ).then( ( res ) => { - console.log( "quiz render data", res ); - if ( 'success' == res.status ) { - let result = res.result; - setAttributes( { quizAttr: { ...result } } ); - if ( ! qsmIsEmpty( result.qpages ) ) { - let quizTemp = []; - result.qpages.forEach( page => { - let questions = []; - if ( ! qsmIsEmpty( page.question_arr ) ) { - page.question_arr.forEach( question => { - if ( ! qsmIsEmpty( question ) ) { - let answers = []; - //answers options blocks - if ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) { - - question.answers.forEach( ( answer, aIndex ) => { - answers.push( - [ - 'qsm/quiz-answer-option', - { - optionID:aIndex, - content:answer[0], - points:answer[1], - isCorrect:answer[2] - } - ] - ); - }); - } - //question blocks - questions.push( - [ - 'qsm/quiz-question', - { - questionID: question.question_id, - type: question.question_type_new, - answerEditor: question.settings.answerEditor, - title: question.settings.question_title, - description: question.question_name, - required: question.settings.required, - hint:question.hints, - answers: question.answers, - correctAnswerInfo:question.question_answer_info, - category:question.category, - multicategories:question.multicategories, - commentBox: question.comments, - matchAnswer: question.settings.matchAnswer, - featureImageID: question.settings.featureImageID, - featureImageSrc: question.settings.featureImageSrc, - settings: question.settings - }, - answers - ] - ); - } - }); - } - //console.log("page",page); - quizTemp.push( - [ - 'qsm/quiz-page', - { - pageID:page.id, - pageKey: page.pagekey, - hidePrevBtn: page.hide_prevbtn, - quizID: page.quizID - }, - questions - ] - ) - }); - setQuizTemplate( quizTemp ); - } - // QSM_QUIZ = [ - // [ - - // ] - // ]; - } else { - console.log( "error "+ res.msg ); - } - } ); - - } + if ( shouldSetQSMAttr && ! qsmIsEmpty( quizID ) && 0 < quizID ) { + initializeQuizAttributes( quizID ); } //cleanup @@ -169,8 +80,104 @@ export default function Edit( props ) { shouldSetQSMAttr = false; }; - }, [ quizID ] ); + }, [ ] ); + /**Initialize quiz attributes: first time render only */ + const initializeQuizAttributes = ( quiz_id ) => { + if ( ! qsmIsEmpty( quiz_id ) && 0 < quiz_id ) { + apiFetch( { + path: '/quiz-survey-master/v1/quiz/structure', + method: 'POST', + data: { quizID: quiz_id }, + } ).then( ( res ) => { + //console.log( "quiz render data", res ); + if ( 'success' == res.status ) { + let result = res.result; + setAttributes( { + quizID: parseInt( quiz_id ), + quizAttr: { ...quizAttr, ...result } + } ); + if ( ! qsmIsEmpty( result.qpages ) ) { + let quizTemp = []; + result.qpages.forEach( page => { + let questions = []; + if ( ! qsmIsEmpty( page.question_arr ) ) { + page.question_arr.forEach( question => { + if ( ! qsmIsEmpty( question ) ) { + let answers = []; + //answers options blocks + if ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) { + + question.answers.forEach( ( answer, aIndex ) => { + answers.push( + [ + 'qsm/quiz-answer-option', + { + optionID:aIndex, + content:answer[0], + points:answer[1], + isCorrect:answer[2] + } + ] + ); + }); + } + //question blocks + questions.push( + [ + 'qsm/quiz-question', + { + questionID: question.question_id, + type: question.question_type_new, + answerEditor: question.settings.answerEditor, + title: question.settings.question_title, + description: question.question_name, + required: question.settings.required, + hint:question.hints, + answers: question.answers, + correctAnswerInfo:question.question_answer_info, + category:question.category, + multicategories:question.multicategories, + commentBox: question.comments, + matchAnswer: question.settings.matchAnswer, + featureImageID: question.settings.featureImageID, + featureImageSrc: question.settings.featureImageSrc, + settings: question.settings + }, + answers + ] + ); + } + }); + } + //console.log("page",page); + quizTemp.push( + [ + 'qsm/quiz-page', + { + pageID:page.id, + pageKey: page.pagekey, + hidePrevBtn: page.hide_prevbtn, + quizID: page.quizID + }, + questions + ] + ) + }); + setQuizTemplate( quizTemp ); + } + // QSM_QUIZ = [ + // [ + + // ] + // ]; + } else { + console.log( "error "+ res.msg ); + } + } ); + + } + } /** * vault dash Icon * @returns vault dash Icon @@ -202,7 +209,7 @@ export default function Edit( props ) { value={ quizID } options={ quizList } onChange={ ( quizID ) => - setAttributes( { quizID } ) + initializeQuizAttributes( quizID ) } disabled={ createQuiz } __nextHasNoMarginBottom @@ -323,7 +330,7 @@ export default function Edit( props ) { if ( qsmIsEmpty( blocks ) ) { return false; } - console.log( "blocks", blocks); + //console.log( "blocks", blocks); blocks = blocks.innerBlocks; let quizDataToSave = { quiz_id: quizAttr.quiz_id, @@ -438,7 +445,7 @@ export default function Edit( props ) { useEffect( () => { if ( isSavingPage ) { let quizData = getQuizDataToSave(); - console.log( "quizData", quizData); + //console.log( "quizData", quizData); //save quiz status setSaveQuiz( true ); @@ -455,7 +462,7 @@ export default function Edit( props ) { method: 'POST', body: quizData } ).then( ( res ) => { - console.log( res ); + //console.log( res ); } ).catch( ( error ) => { console.log( 'error',error ); @@ -485,20 +492,18 @@ export default function Edit( props ) { 'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce }); - if ( showAdvanceOption ) { - ['form_type', - 'system', - 'timer_limit', - 'pagination', - 'enable_contact_form', - 'enable_pagination_quiz', - 'show_question_featured_image_in_result', - 'progress_bar', - 'require_log_in', - 'disable_first_page', - 'comment_section' - ].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) ); - } + ['form_type', + 'system', + 'timer_limit', + 'pagination', + 'enable_contact_form', + 'enable_pagination_quiz', + 'show_question_featured_image_in_result', + 'progress_bar', + 'require_log_in', + 'disable_first_page', + 'comment_section' + ].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) ); //AJAX call apiFetch( { @@ -567,8 +572,8 @@ export default function Edit( props ) { } ).then( ( pageResponse ) => { console.log("pageResponse", pageResponse); if ( 'success' == pageResponse.status ) { - //set new quiz ID - setAttributes( { quizID: res.quizID } ); + //set new quiz + initializeQuizAttributes( res.quizID ); } }); From 3a54a6d1813e09064e7c5118f0db469ff1c4aad7 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Mon, 16 Oct 2023 15:26:17 +0530 Subject: [PATCH 06/27] added radio and checkbox in answer-option block --- blocks/build/answer-option/block.json | 3 ++- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 2 +- blocks/build/question/block.json | 3 ++- blocks/src/answer-option/block.json | 2 +- blocks/src/answer-option/edit.js | 11 +++++++++++ blocks/src/question/block.json | 3 ++- 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/blocks/build/answer-option/block.json b/blocks/build/answer-option/block.json index 1746753ad..60f27d474 100644 --- a/blocks/build/answer-option/block.json +++ b/blocks/build/answer-option/block.json @@ -32,7 +32,8 @@ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/quizAttr", - "quiz-master-next/questionID" + "quiz-master-next/questionID", + "quiz-master-next/questionType" ], "example": {}, "supports": { diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index 858d42ec4..503598046 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '616315fba7b8ee52d7b1'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '4f7348d521d28eea99f6'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index 6b280bef3..a8437a84a 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -1 +1 @@ -!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,o=(window.wp.apiFetch,window.wp.blockEditor),r=(window.wp.editor,window.wp.coreData,window.wp.data,window.wp.components);const i=e=>null==e||""===e;var a=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(a.u2,{merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(a){if("undefined"==typeof qsmBlockData)return null;const{className:s,attributes:l,setAttributes:c,isSelected:u,clientId:w,context:m,mergeBlocks:p,onReplace:d,onRemove:q}=a,g=m["quiz-master-next/quizID"],{optionID:x,content:_,points:z,isCorrect:h}=(m["quiz-master-next/pageID"],m["quiz-master-next/questionID"],l);(0,t.useEffect)((()=>{let e=!0;return()=>{e=!1}}),[g]);const v=(0,o.useBlockProps)({className:""});return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(o.InspectorControls,null,(0,t.createElement)(r.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(r.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:z,onChange:e=>c({points:e})}),(0,t.createElement)(r.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!i(h)&&"1"==h,onChange:()=>c({isCorrect:i(h)||"1"!=h?1:0})}))),(0,t.createElement)("div",{...v},(0,t.createElement)(o.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:_,onChange:e=>{return c({content:(t=e,t.replace(/<\/?a[^>]*>/g,""))});var t},onSplit:(t,n)=>{let o;(n||t)&&(o={...l,content:t});const r=(0,e.createBlock)("qsm/quiz-answer-option",o);return n&&(r.clientId=w),r},onMerge:p,onReplace:d,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"})))}})}(); \ No newline at end of file +!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,o=(window.wp.apiFetch,window.wp.blockEditor),i=(window.wp.editor,window.wp.coreData,window.wp.data,window.wp.components);const r=e=>null==e||""===e;var a=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(a.u2,{merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(a){if("undefined"==typeof qsmBlockData)return null;const{className:s,attributes:l,setAttributes:c,isSelected:u,clientId:m,context:p,mergeBlocks:w,onReplace:d,onRemove:q}=a,x=p["quiz-master-next/quizID"],_=(p["quiz-master-next/pageID"],p["quiz-master-next/questionID"],p["quiz-master-next/questionType"]),{optionID:g,content:z,points:E,isCorrect:b}=l;(0,t.useEffect)((()=>{let e=!0;return()=>{e=!1}}),[x]);const f=(0,o.useBlockProps)({className:""}),h=["4","10"].includes(_)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(o.InspectorControls,null,(0,t.createElement)(i.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(i.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:E,onChange:e=>c({points:e})}),(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!r(b)&&"1"==b,onChange:()=>c({isCorrect:r(b)||"1"!=b?1:0})}))),(0,t.createElement)("div",{...f},(0,t.createElement)(i.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:h,readOnly:!0,tabIndex:"-1"}),(0,t.createElement)(o.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:z,onChange:e=>{return c({content:(t=e,t.replace(/<\/?a[^>]*>/g,""))});var t},onSplit:(t,n)=>{let o;(n||t)&&(o={...l,content:t});const i=(0,e.createBlock)("qsm/quiz-answer-option",o);return n&&(i.clientId=m),i},onMerge:w,onReplace:d,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}))))}})}(); \ No newline at end of file diff --git a/blocks/build/question/block.json b/blocks/build/question/block.json index f30637e9f..cc46e529d 100644 --- a/blocks/build/question/block.json +++ b/blocks/build/question/block.json @@ -82,7 +82,8 @@ "quiz-master-next/quizAttr" ], "providesContext": { - "quiz-master-next/questionID": "questionID" + "quiz-master-next/questionID": "questionID", + "quiz-master-next/questionType": "type" }, "example": {}, "supports": { diff --git a/blocks/src/answer-option/block.json b/blocks/src/answer-option/block.json index 161924681..faa35eb81 100644 --- a/blocks/src/answer-option/block.json +++ b/blocks/src/answer-option/block.json @@ -26,7 +26,7 @@ "default": "0" } }, - "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/quizAttr", "quiz-master-next/questionID" ], + "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/quizAttr", "quiz-master-next/questionID", "quiz-master-next/questionType" ], "example": {}, "supports": { "html": false diff --git a/blocks/src/answer-option/edit.js b/blocks/src/answer-option/edit.js index df6f2891f..d50d7009e 100644 --- a/blocks/src/answer-option/edit.js +++ b/blocks/src/answer-option/edit.js @@ -15,6 +15,7 @@ import { PanelRow, TextControl, ToggleControl, + __experimentalHStack as HStack, RangeControl, RadioControl, SelectControl, @@ -34,6 +35,7 @@ onRemove } = props; const quizID = context['quiz-master-next/quizID']; const pageID = context['quiz-master-next/pageID']; const questionID = context['quiz-master-next/questionID']; + const questionType = context['quiz-master-next/questionType']; const name = 'qsm/quiz-answer-option'; const { optionID, @@ -67,6 +69,8 @@ onRemove } = props; txt.innerHTML = html; return txt.value; } + + const inputType = ['4','10'].includes( questionType ) ? "checkbox":"radio"; return ( <> @@ -87,6 +91,12 @@ onRemove } = props;
+ + +
); diff --git a/blocks/src/question/block.json b/blocks/src/question/block.json index 9532240a7..b2c2e8111 100644 --- a/blocks/src/question/block.json +++ b/blocks/src/question/block.json @@ -76,7 +76,8 @@ }, "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/quizAttr" ], "providesContext": { - "quiz-master-next/questionID": "questionID" + "quiz-master-next/questionID": "questionID", + "quiz-master-next/questionType":"type" }, "example": {}, "supports": { From 92c870d6edac55dd40ab0060e99b6b96345124b5 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Thu, 19 Oct 2023 16:57:15 +0530 Subject: [PATCH 07/27] added: image answer type and save only changed questions --- blocks/block.php | 20 ++ blocks/build/answer-option/block.json | 8 +- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 2 +- blocks/build/index.asset.php | 2 +- blocks/build/index.js | 2 +- blocks/build/question/block.json | 8 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 4 +- blocks/package-lock.json | 49 ++++- blocks/package.json | 1 + blocks/src/answer-option/block.json | 6 +- blocks/src/answer-option/edit.js | 213 +++++++++++++++------ blocks/src/component/ImageType.js | 208 ++++++++++++++++++++ blocks/src/component/SelectAddCategory.js | 22 ++- blocks/src/edit.js | 71 ++++--- blocks/src/helper.js | 17 +- blocks/src/question/block.json | 8 +- blocks/src/question/edit.js | 140 ++++++++++---- php/admin/options-page-questions-tab.php | 43 +---- php/classes/class-qmn-plugin-helper.php | 45 +++++ 21 files changed, 689 insertions(+), 184 deletions(-) create mode 100644 blocks/src/component/ImageType.js diff --git a/blocks/block.php b/blocks/block.php index b4a318b31..7e8a133b3 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -96,6 +96,9 @@ private function qsm_block_register_legacy() { ), ), ), + 'supports' => array( + 'inserter' => false // Hide this block from the inserter. + ), 'editor_script' => 'qsm-quiz-block', 'render_callback' => array( $this, 'qsm_block_render' ), ) ); @@ -152,7 +155,21 @@ public function register_block_scripts() { $question_type = $mlwQuizMasterNext->pluginHelper->categorize_question_types(); $question_types = array(); + $question_type_description = array( + '13' => __( 'Displays a range between two given option. Please keep only two option here and remove others.', 'quiz-master-next' ) + ); if ( ! empty( $question_type ) && is_array( $question_type ) ) { + //Question description + $question_type_desc = $mlwQuizMasterNext->pluginHelper->description_array(); + if ( ! empty( $question_type_desc ) && is_array( $question_type_desc ) ) { + foreach ( $question_type_desc as $question_desc ) { + if ( ! empty( $question_desc['question_type_id'] ) && ! empty( $question_desc['description'] ) ) { + $question_type_description[ $question_desc['question_type_id'] ] = $question_desc['description']; + } + } + } + + //Question types category wise foreach ($question_type as $category => $qtypes ) { $question_types[] = array( 'category' => $category, @@ -184,6 +201,9 @@ public function register_block_scripts() { 'default' => '0', 'documentation_link' => esc_url( qsm_get_plugin_link( 'docs/about-quiz-survey-master/question-types/', 'quiz_editor', 'question_type', 'quizsurvey-question-type_doc' ) ), ), + 'question_type_description' => $question_type_description, + 'is_pro_activated' => class_exists( 'QSM_Advance_Question' ) ? '1' : '0', + 'upgrade_link' => function_exists( 'qsm_get_plugin_link' ) ? qsm_get_plugin_link( 'pricing', 'qsm', 'upgrade-box', 'upgrade', 'qsm_plugin_upsell' ) : '', 'answerEditor' => array( 'label' => __( 'Answers Type', 'quiz-master-next' ), 'options' => array( diff --git a/blocks/build/answer-option/block.json b/blocks/build/answer-option/block.json index 60f27d474..f07f58e92 100644 --- a/blocks/build/answer-option/block.json +++ b/blocks/build/answer-option/block.json @@ -19,6 +19,10 @@ "type": "string", "default": "" }, + "caption": { + "type": "string", + "default": "" + }, "points": { "type": "string", "default": "0" @@ -33,7 +37,9 @@ "quiz-master-next/pageID", "quiz-master-next/quizAttr", "quiz-master-next/questionID", - "quiz-master-next/questionType" + "quiz-master-next/questionType", + "quiz-master-next/answerType", + "quiz-master-next/questionChanged" ], "example": {}, "supports": { diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index 503598046..e13bf24f3 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n'), 'version' => '4f7348d521d28eea99f6'); + array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'a80dd97eb4798c9747cd'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index a8437a84a..4f85c06c5 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -1 +1 @@ -!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,o=(window.wp.apiFetch,window.wp.blockEditor),i=(window.wp.editor,window.wp.coreData,window.wp.data,window.wp.components);const r=e=>null==e||""===e;var a=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(a.u2,{merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(a){if("undefined"==typeof qsmBlockData)return null;const{className:s,attributes:l,setAttributes:c,isSelected:u,clientId:m,context:p,mergeBlocks:w,onReplace:d,onRemove:q}=a,x=p["quiz-master-next/quizID"],_=(p["quiz-master-next/pageID"],p["quiz-master-next/questionID"],p["quiz-master-next/questionType"]),{optionID:g,content:z,points:E,isCorrect:b}=l;(0,t.useEffect)((()=>{let e=!0;return()=>{e=!1}}),[x]);const f=(0,o.useBlockProps)({className:""}),h=["4","10"].includes(_)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(o.InspectorControls,null,(0,t.createElement)(i.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(i.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:E,onChange:e=>c({points:e})}),(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!r(b)&&"1"==b,onChange:()=>c({isCorrect:r(b)||"1"!=b?1:0})}))),(0,t.createElement)("div",{...f},(0,t.createElement)(i.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:h,readOnly:!0,tabIndex:"-1"}),(0,t.createElement)(o.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:z,onChange:e=>{return c({content:(t=e,t.replace(/<\/?a[^>]*>/g,""))});var t},onSplit:(t,n)=>{let o;(n||t)&&(o={...l,content:t});const i=(0,e.createBlock)("qsm/quiz-answer-option",o);return n&&(i.clientId=m),i},onMerge:w,onReplace:d,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}))))}})}(); \ No newline at end of file +!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,i=window.wp.htmlEntities,o=window.wp.escapeHtml,a=window.wp.blockEditor,r=window.wp.data,l=window.wp.url,s=window.wp.components,c=window.wp.blob,u=window.React,m=window.wp.primitives,d=(0,u.createElement)(m.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,u.createElement)(m.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),p=window.wp.notices;const w=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},E=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText};var f=function({url:e="",caption:i="",alt:o="",setURLCaption:l}){const u=["image"],[m,g]=(0,t.useState)(null),[E,f]=(0,t.useState)(),{imageDefaultSize:x,mediaUpload:_}=((0,t.useRef)(),(0,r.useSelect)((e=>{const{getSettings:t}=e(a.store),n=t();return{imageDefaultSize:n.imageDefaultSize,mediaUpload:n.mediaUpload}}),[])),{createErrorNotice:h}=(0,r.useDispatch)(p.store);function q(e){h(e,{type:"snackbar"}),l(void 0,void 0),f(void 0)}function v(e){if(!e||!e.url)return void l(void 0,void 0);if((0,c.isBlobURL)(e.url))return void f(e.url);f();let t=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));return n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e.url,n})(e,x);g(t.id),l(t.url,t.caption)}function z(t){t!==e&&l(t,i)}let b=((e,t)=>!e&&(0,c.isBlobURL)(t))(m,e);(0,t.useEffect)((()=>{if(!b)return;const t=(0,c.getBlobByURL)(e);t&&_({filesList:[t],onFileChange:([e])=>{v(e)},allowedTypes:u,onError:e=>{b=!1,q(e)}})}),[]),(0,t.useEffect)((()=>{b?f(e):(0,c.revokeBlobURL)(E)}),[b,e]);const R=((e,t)=>t&&!e&&!(0,c.isBlobURL)(t))(m,e)?e:void 0,B=!!e&&(0,t.createElement)("img",{alt:(0,n.__)("Edit image"),title:(0,n.__)("Edit image"),className:"edit-image-preview",src:e});let k=(0,t.createElement)(t.Fragment,null,(0,t.createElement)("img",{src:E||e,alt:"",className:"qsm-answer-option-image",style:{width:"200",height:"auto"}}),E&&(0,t.createElement)(s.Spinner,null));return(0,t.createElement)("figure",null,w(e)?(0,t.createElement)(a.MediaPlaceholder,{icon:(0,t.createElement)(a.BlockIcon,{icon:d}),onSelect:v,onSelectURL:z,onError:q,accept:"image/*",allowedTypes:u,value:{id:m,src:R},mediaPreview:B,disableMediaButtons:E||e}):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.BlockControls,{group:"other"},(0,t.createElement)(a.MediaReplaceFlow,{mediaId:m,mediaURL:e,allowedTypes:u,accept:"image/*",onSelect:v,onSelectURL:z,onError:q})),(0,t.createElement)("div",null,k)))},x=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(x.u2,{merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(c){if("undefined"==typeof qsmBlockData)return null;const{className:u,attributes:m,setAttributes:d,isSelected:p,clientId:x,context:_,mergeBlocks:h,onReplace:q,onRemove:v}=c,z=(_["quiz-master-next/quizID"],_["quiz-master-next/pageID"],_["quiz-master-next/questionID"],_["quiz-master-next/questionType"]),b=_["quiz-master-next/answerType"],R=_["quiz-master-next/questionChanged"],B="qsm/quiz-answer-option",{optionID:k,content:S,caption:C,points:L,isCorrect:y}=m,{selectBlock:U}=(0,r.useDispatch)(a.store),{updateBlockAttributes:T}=(0,r.useDispatch)(a.store),I=(0,r.useSelect)((e=>{let t=e(a.store).getBlockParentsByBlockName(x,"qsm/quiz-question",!0);return w(t)?"":t[0]}),[x]);(0,t.useEffect)((()=>{let e=!0;return e&&p&&!w(I)&&!1===R&&T(I,{isChanged:!0}),()=>{e=!1}}),[S,C,L,y]),(0,t.useEffect)((()=>{let e=!0;return e&&(w(S)||!(0,l.isURL)(S)||-1===S.indexOf("https://")&&-1===S.indexOf("http://")||!["rich","text"].includes(b)||d({content:"",caption:""})),()=>{e=!1}}),[b]);const N=(0,a.useBlockProps)({className:""}),D=["4","10"].includes(z)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.InspectorControls,null,(0,t.createElement)(s.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},"image"===b&&(0,t.createElement)(s.TextControl,{type:"text",label:(0,n.__)("Caption","quiz-master-next"),value:C,onChange:e=>d({caption:(0,o.escapeAttribute)(e)})}),(0,t.createElement)(s.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:L,onChange:e=>d({points:e})}),["0","4","1","10","2"].includes(z)&&(0,t.createElement)(s.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!w(y)&&"1"==y,onChange:()=>d({isCorrect:w(y)||"1"!=y?1:0})}))),(0,t.createElement)("div",{...N},(0,t.createElement)(s.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:D,readOnly:!0,tabIndex:"-1"}),!["rich","image"].includes(b)&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:E((0,i.decodeEntities)(S)),onChange:e=>d({content:E((0,i.decodeEntities)(e))}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=x),o},onMerge:h,onReplace:q,onRemove:v,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}),"rich"===b&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:g((0,i.decodeEntities)(S)),onChange:e=>d({content:e}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=x),o},onMerge:h,onReplace:q,onRemove:v,className:"qsm-question-answer-option",identifier:"text",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),"image"===b&&(0,t.createElement)(f,{url:(0,l.isURL)(S)?S:"",caption:C,setURLCaption:(e,t)=>d({content:(0,l.isURL)(e)?e:"",caption:t})}))))}})}(); \ No newline at end of file diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 029abdc45..57aa0d043 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '01f6847228e2d540454d'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '009cf34c85093aeba67e'); diff --git a/blocks/build/index.js b/blocks/build/index.js index f141c5522..08a155f0b 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={758:function(e,t,n){var i=window.wp.blocks,s=window.wp.element,a=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),u=window.wp.blockEditor,l=window.wp.notices,c=window.wp.data,m=window.wp.editor,p=window.wp.components;const q=e=>null==e||""===e,_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},d=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},g=(e,t="")=>q(e)?t:e;(0,i.registerBlockType)("qsm/quiz",{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:z}=e,{createNotice:h}=(0,c.useDispatch)(l.store),f=qsmBlockData.globalQuizsetting,{quizID:b,quizAttr:w=f}=n,[v,y]=(0,s.useState)(qsmBlockData.QSMQuizList),[k,E]=(0,s.useState)({error:!1,msg:""}),[D,I]=(0,s.useState)(!1),[B,x]=(0,s.useState)(!1),[S,C]=(0,s.useState)(!1),[O,P]=(0,s.useState)([]),N=qsmBlockData.quizOptions,A=(0,c.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(m.store);return n()&&!t()}),[]),{getBlock:T}=(0,c.useSelect)(u.store);(0,s.useEffect)((()=>{let e=!0;return e&&!q(b)&&0{e=!1}}),[]);const M=e=>{!q(e)&&0{if("success"==t.status){let n=t.result;if(i({quizID:parseInt(e),quizAttr:{...w,...n}}),!q(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2]}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),P(e)}}else console.log("error "+t.msg)}))},Q=(e,t)=>{let n=w;n[t]=e,i({quizAttr:{...n}})};(0,s.useEffect)((()=>{if(A){let e=(()=>{let e=T(z);if(q(e))return!1;e=e.innerBlocks;let t={quiz_id:w.quiz_id,post_id:w.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,s=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes;i.push([g(t?.content),g(t?.points),g(t?.isCorrect)])}));let a=e.attributes;s.push(a.questionID),t.questions.push({id:a.questionID,quizID:w.quiz_id,postID:w.post_id,answerEditor:g(a?.answerEditor,"text"),type:g(a?.type,"0"),name:_(g(a?.description)),question_title:g(a?.title),answerInfo:_(g(a?.correctAnswerInfo)),comments:g(a?.commentBox,"1"),hint:g(a?.hint),category:g(a?.category),multicategories:[],required:g(a?.required,1),answers:i,page:n})})),t.pages.push(s),t.qpages.push({id:i,quizID:w.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:w.quiz_name,quiz_id:w.quiz_id,post_id:w.post_id},S&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==w[e]&&null!==w[e]&&(t.quiz[e]=w[e])})),t})();x(!0),e=d({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[A]);const j=(0,u.useBlockProps)(),F=(0,u.useInnerBlocksProps)(j,{template:O,allowedBlocks:["qsm/quiz-page"]});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.InspectorControls,null,(0,s.createElement)(p.PanelBody,{title:(0,a.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,s.createElement)(p.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:w?.quiz_name||"",onChange:e=>Q(e,"quiz_name")}))),q(b)||"0"==b?(0,s.createElement)(p.Placeholder,{icon:()=>(0,s.createElement)(p.Icon,{icon:"vault",size:"36"}),label:(0,a.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,a.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,s.createElement)(s.Fragment,null,!q(v)&&0M(e),disabled:D,__nextHasNoMarginBottom:!0}),(0,s.createElement)("span",null,(0,a.__)("OR","quiz-master-next")),(0,s.createElement)(p.Button,{variant:"link",onClick:()=>I(!D)},(0,a.__)("Add New","quiz-master-next"))),(q(v)||D)&&(0,s.createElement)(p.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,s.createElement)(p.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:w?.quiz_name||"",onChange:e=>Q(e,"quiz_name")}),(0,s.createElement)(p.Button,{variant:"link",onClick:()=>C(!S)},(0,a.__)("Advance options","quiz-master-next")),S&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.SelectControl,{label:N?.form_type?.label,value:w?.form_type,options:N?.form_type?.options,onChange:e=>Q(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,s.createElement)(p.SelectControl,{label:N?.system?.label,value:w?.system,options:N?.system?.options,onChange:e=>Q(e,"system"),help:N?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,s.createElement)(p.TextControl,{key:"quiz-create-text-"+e,type:"number",label:N?.[e]?.label,help:N?.[e]?.help,value:q(w[e])?0:w[e],onChange:t=>Q(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,s.createElement)(p.ToggleControl,{key:"quiz-create-toggle-"+e,label:N?.[e]?.label,help:N?.[e]?.help,checked:!q(w[e])&&"1"==w[e],onChange:()=>Q(q(w[e])||"1"!=w[e]?1:0,e)})))),(0,s.createElement)(p.Button,{variant:"primary",disabled:B||q(w.quiz_name),onClick:()=>(()=>{if(q(w.quiz_name))return void console.log("empty quiz_name");x(!0);let e=d({quiz_name:w.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===w[t]||null===w[t]?"":e.append(t,w[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(console.log(e),x(!1),"success"==e.status){let t=d({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if(console.log("question response",t),"success"==t.status){let n=t.id,i=d({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});i.append("pages[0][]",n),i.append("qpages[0][id]",1),i.append("qpages[0][quizID]",e.quizID),i.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+1e3*Math.random()).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.trunc(1e8*Math.random())}`:""}`)()),i.append("qpages[0][hide_prevbtn]",0),i.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:i}).then((t=>{console.log("pageResponse",t),"success"==t.status&&M(e.quizID)}))}})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))}h(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),h("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,a.__)("Create Quiz","quiz-master-next"))))):(0,s.createElement)("div",{...F}))},save:e=>null})}},n={};function i(e){var s=n[e];if(void 0!==s)return s.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.m=t,e=[],i.O=function(t,n,s,a){if(!n){var r=1/0;for(c=0;c=a)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(o=!1,a0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,s,a]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,a,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(s in o)i.o(o,s)&&(i.m[s]=o[s]);if(u)var c=u(i)}for(t&&t(n);lnull==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=(e,t="")=>_(e)?t:e;(0,i.registerBlockType)("qsm/quiz",{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:z}=e,{createNotice:f}=(0,m.useDispatch)(c.store),w=qsmBlockData.globalQuizsetting,{quizID:b,quizAttr:v=w}=n,[y,k]=(0,a.useState)(qsmBlockData.QSMQuizList),[E,D]=(0,a.useState)({error:!1,msg:""}),[I,B]=(0,a.useState)(!1),[x,S]=(0,a.useState)(!1),[C,O]=(0,a.useState)(!1),[P,N]=(0,a.useState)([]),A=qsmBlockData.quizOptions,T=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:M}=(0,m.useSelect)(l.store);(0,a.useEffect)((()=>{let e=!0;return e&&!_(b)&&0{e=!1}}),[]);const Q=e=>{!_(e)&&0{if(console.log("quiz render data",t),"success"==t.status){let n=t.result;if(i({quizID:parseInt(e),quizAttr:{...v,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2]}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),N(e)}}else console.log("error "+t.msg)}))},j=(e,t)=>{let n=v;n[t]=e,i({quizAttr:{...n}})};(0,a.useEffect)((()=>{if(T){let e=(()=>{let e=M(z);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:v.quiz_id,post_id:v.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,a=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=e.attributes,s=h(i?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=h(t?.content);_(i?.answerEditor)||"rich"!==i.answerEditor||(n=d((0,u.decodeEntities)(n)));let a=[n,h(t?.points),h(t?.isCorrect)];"image"!==s||_(t?.caption)||a.push(t?.caption),r.push(a)})),a.push(i.questionID),i.isChanged&&t.questions.push({id:i.questionID,quizID:v.quiz_id,postID:v.post_id,answerEditor:s,type:h(i?.type,"0"),name:d(h(i?.description)),question_title:h(i?.title),answerInfo:d(h(i?.correctAnswerInfo)),comments:h(i?.commentBox,"1"),hint:h(i?.hint),category:h(i?.category),multicategories:h(i?.multicategories,[]),required:h(i?.required,1),answers:r,featureImageID:h(i?.featureImageID),featureImageSrc:h(i?.featureImageSrc),page:n})})),t.pages.push(a),t.qpages.push({id:i,quizID:v.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:a}),n++}})),t.quiz={quiz_name:v.quiz_name,quiz_id:v.quiz_id,post_id:v.post_id},C&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==v[e]&&null!==v[e]&&(t.quiz[e]=v[e])})),t})();console.log("quizData",e),S(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[T]);const F=(0,l.useBlockProps)(),H=(0,l.useInnerBlocksProps)(F,{template:P,allowedBlocks:["qsm/quiz-page"]});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.InspectorControls,null,(0,a.createElement)(q.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:v?.quiz_name||"",onChange:e=>j(e,"quiz_name")}))),_(b)||"0"==b?(0,a.createElement)(q.Placeholder,{icon:()=>(0,a.createElement)(q.Icon,{icon:"vault",size:"36"}),label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,a.createElement)(a.Fragment,null,!_(y)&&0Q(e),disabled:I,__nextHasNoMarginBottom:!0}),(0,a.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>B(!I)},(0,s.__)("Add New","quiz-master-next"))),(_(y)||I)&&(0,a.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:v?.quiz_name||"",onChange:e=>j(e,"quiz_name")}),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>O(!C)},(0,s.__)("Advance options","quiz-master-next")),C&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(q.SelectControl,{label:A?.form_type?.label,value:v?.form_type,options:A?.form_type?.options,onChange:e=>j(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,a.createElement)(q.SelectControl,{label:A?.system?.label,value:v?.system,options:A?.system?.options,onChange:e=>j(e,"system"),help:A?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,a.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:A?.[e]?.label,help:A?.[e]?.help,value:_(v[e])?0:v[e],onChange:t=>j(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,a.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:A?.[e]?.label,help:A?.[e]?.help,checked:!_(v[e])&&"1"==v[e],onChange:()=>j(_(v[e])||"1"!=v[e]?1:0,e)})))),(0,a.createElement)(q.Button,{variant:"primary",disabled:x||_(v.quiz_name),onClick:()=>(()=>{if(_(v.quiz_name))return void console.log("empty quiz_name");S(!0);let e=g({quiz_name:v.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===v[t]||null===v[t]?"":e.append(t,v[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(console.log(e),S(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if(console.log("question response",t),"success"==t.status){let n=t.id,i=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});i.append("pages[0][]",n),i.append("qpages[0][id]",1),i.append("qpages[0][quizID]",e.quizID),i.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+1e3*Math.random()).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.trunc(1e8*Math.random())}`:""}`)()),i.append("qpages[0][hide_prevbtn]",0),i.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:i}).then((t=>{console.log("pageResponse",t),"success"==t.status&&Q(e.quizID)}))}})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))))):(0,a.createElement)("div",{...H}))},save:e=>null})}},n={};function i(e){var a=n[e];if(void 0!==a)return a.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,i),s.exports}i.m=t,e=[],i.O=function(t,n,a,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,a,s]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var a,s,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(a in o)i.o(o,a)&&(i.m[a]=o[a]);if(u)var c=u(i)}for(t&&t(n);l array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '959b91094cdbec43f14c'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '936a9892dc15806200a3'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 001c18005..996ca425c 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -1,5 +1,5 @@ -!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,r=window.wp.i18n,n=window.wp.apiFetch,o=e.n(n),i=window.wp.blockEditor,l=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},p=e=>e.replace(/<\/?a[^>]*>/g,""),g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},h=(e,t="")=>d(e)?t:e,q=["image"],f=(0,r.__)("Featured image"),w=(0,r.__)("Set featured image"),x=(0,a.createElement)("p",null,(0,r.__)("To edit the featured image, you need permission to upload media."));var E=({featureImageID:e,onUpdateImage:t,onRemoveImage:n})=>{const{createNotice:o}=(0,s.useDispatch)(l.store),_=(0,a.useRef)(),[p,g]=(0,a.useState)(!1),[h,E]=(0,a.useState)(void 0),{mediaFeature:b,mediaUpload:y}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function I(e){y({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){o("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(b)||"object"!=typeof b||E({id:e,width:b.media_details.width,height:b.media_details.height,url:b.source_url,alt_text:b.alt_text,slug:b.slug})),()=>{t=!1}}),[b]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,r.sprintf)( +!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,r=window.wp.i18n,n=window.wp.apiFetch,i=e.n(n),o=window.wp.blockEditor,l=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,p=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=_(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],w=(0,r.__)("Featured image"),x=(0,r.__)("Set featured image"),E=(0,a.createElement)("p",null,(0,r.__)("To edit the featured image, you need permission to upload media."));var y=({featureImageID:e,onUpdateImage:t,onRemoveImage:n})=>{const{createNotice:i}=(0,s.useDispatch)(l.store),p=(0,a.useRef)(),[_,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:y,mediaUpload:b}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(o.store).getSettings().mediaUpload}}),[]);function k(e){b({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){i("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(y)||"object"!=typeof y||q({id:e,width:y.media_details.width,height:y.media_details.height,url:y.source_url,alt_text:y.alt_text,slug:y.slug})),()=>{t=!1}}),[y]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,r.sprintf)( // Translators: %s: The selected image alt text. (0,r.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,r.sprintf)( // Translators: %s: The selected image filename. -(0,r.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:f,onSelect:e=>{E(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:q,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,r.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&w),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,r.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{n(),_.current.focus()}},(0,r.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:I})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[n,i]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[h,q]=(0,a.useState)(!1),[f,w]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=(0,r.__)("Add New Category ","quiz-master-next"),E=`— ${(0,r.__)("Parent Category ","quiz-master-next")} —`,b=e=>{let t=[];return e.forEach((e=>{if(t.push(e.name),0r.map((r=>(0,a.createElement)("div",{key:r.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:r.name,checked:e(r.id),onChange:()=>t(r.id)}),!!r.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},y(r.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,r.__)("Categories","quiz-master-next")},y(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!n)},x)),n&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),h||d(l)||_||(p(!0),o()({url:qsmBlockData.ajax_url,method:"POST",body:g({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;o()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(w(e.result),s(""),u(0),t(a),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,r.__)("Category Name","quiz-master-next"),value:l,onChange:e=>((e,t)=>{t=b(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:h||_},x)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==h&&(0,r.__)("Category ","quiz-master-next")+h+(0,r.__)(" already exists.","quiz-master-next"))))))},y=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(y.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:m,isSelected:u,clientId:q,context:f}=e,w=(0,s.useSelect)((e=>u||e("core/block-editor").hasSelectedInnerBlock(q,!0))),x=f["quiz-master-next/quizID"],{quiz_name:y,post_id:I,rest_nonce:k}=f["quiz-master-next/quizAttr"],{createNotice:v}=(f["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{questionID:C,type:B,description:D,title:z,correctAnswerInfo:N,commentBox:S,category:T,multicategories:F,hint:P,featureImageID:O,featureImageSrc:R,answers:A,answerEditor:U,matchAnswer:H,required:M,settings:L}=n,[Q,j]=(0,a.useState)(L);(0,a.useEffect)((()=>{let e=!0;if(e&&(d(C)||"0"==C||!d(C)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:r}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&r===e}))})(C,q))){let e=g({id:null,rest_nonce:k,quizID:x,quiz_name:y,postID:I,answerEditor:h(U,"text"),type:h(B,"0"),name:_(h(D)),question_title:h(z),answerInfo:_(h(N)),comments:h(S,"1"),hint:h(P),category:h(T),multicategories:[],required:h(M,1),answers:A,page:0,featureImageID:O,featureImageSrc:R,matchAnswer:null});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if(console.log("question created",e),"success"==e.status){let t=e.id;m({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]);const W=(0,i.useBlockProps)({className:w?" in-editing-mode":""});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,r.__)("ID","quiz-master-next")+": "+C),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:B||qsmBlockData.question_type.default,onChange:e=>m({type:e}),__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:U||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>m({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,r.__)("Required","quiz-master-next"),checked:!d(M)&&"1"==M,onChange:()=>m({required:d(M)||"1"!=M?1:0})})),(0,a.createElement)(b,{isCategorySelected:e=>T==e||F.includes(e),setUnsetCatgory:e=>{if(d(T)&&(d(F)||0===F.length))m({category:e});else if(e==T)m({category:""});else{let t=d(F)||0===F.length?[]:F;t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),m({category:"",multicategories:[...t]})}}}),(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(E,{featureImageID:O,onUpdateImage:e=>{m({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{m({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:S||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>m({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...W},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,r.__)("Question title","quiz-master-next"),"aria-label":(0,r.__)("Question title","quiz-master-next"),placeholder:(0,r.__)("Type your question here","quiz-master-next"),value:z,onChange:e=>m({title:p(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),w&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Question description","quiz-master-next"),"aria-label":(0,r.__)("Question description","quiz-master-next"),placeholder:(0,r.__)("Description goes here","quiz-master-next"),value:_(D),onChange:e=>m({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,r.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,r.__)("Correct answer info goes here","quiz-master-next"),value:_(N),onChange:e=>m({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,r.__)("Hint","quiz-master-next"),"aria-label":(0,r.__)("Hint","quiz-master-next"),placeholder:(0,r.__)("hint goes here","quiz-master-next"),value:P,onChange:e=>m({hint:p(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"}))))}})}(); \ No newline at end of file +(0,r.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(o.MediaUploadCheck,{fallback:E},(0,a.createElement)(o.MediaUpload,{title:w,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:p,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,r.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),_&&(0,a.createElement)(c.Spinner,null),!e&&!_&&x),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,r.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{n(),p.current.focus()}},(0,r.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:k})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[n,o]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[p,_]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,w]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0r.map((r=>(0,a.createElement)("div",{key:r.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:r.name,checked:e(r.id),onChange:()=>t(r.id,E)}),!!r.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},C(r.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,r.__)("Categories","quiz-master-next")},C(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>o(!n)},b)),n&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(l)||p||(_(!0),i()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;i()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(w(e.result),y(e.result),s(""),u(0),t(a,x(term.id)),_(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,r.__)("Category Name","quiz-master-next"),value:l,onChange:e=>((e,t)=>{t=I(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||p},b)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,r.__)("Category ","quiz-master-next")+g+(0,r.__)(" already exists.","quiz-master-next"))))))},k=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(k.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:m,isSelected:u,clientId:f,context:w}=e,x=(0,s.useSelect)((e=>u||e("core/block-editor").hasSelectedInnerBlock(f,!0))),E=w["quiz-master-next/quizID"],{quiz_name:k,post_id:I,rest_nonce:C}=w["quiz-master-next/quizAttr"],{createNotice:v}=(w["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{isChanged:B=!1,questionID:D,type:z,description:N,title:S,correctAnswerInfo:T,commentBox:F,category:P,multicategories:A,hint:O,featureImageID:R,featureImageSrc:U,answers:H,answerEditor:M,matchAnswer:L,required:Q}=n;(0,a.useEffect)((()=>{let e=!0;if(e&&(d(D)||"0"==D||!d(D)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:r}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&r===e}))})(D,f))){let e=h({id:null,rest_nonce:C,quizID:E,quiz_name:k,postID:I,answerEditor:q(M,"text"),type:q(z,"0"),name:_(q(N)),question_title:q(S),answerInfo:_(q(T)),comments:q(F,"1"),hint:q(O),category:q(P),multicategories:[],required:q(Q,1),answers:H,page:0,featureImageID:R,featureImageSrc:U,matchAnswer:null});i()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if(console.log("question created",e),"success"==e.status){let t=e.id;m({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&u&&!1===B&&m({isChanged:!0}),()=>{e=!1}}),[D,z,N,S,T,F,P,A,O,R,U,H,M,L,Q]);const j=(0,o.useBlockProps)({className:x?" in-editing-mode":""}),W=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let r=W(e,t);a=[...a,...r]}return p(a)},$=["12","7","3","5","14"].includes(z)?(0,r.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"";return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,r.__)("ID","quiz-master-next")+": "+D),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:z||qsmBlockData.question_type.default,onChange:e=>m({type:e}),help:d(qsmBlockData.question_type_description[z])?"":qsmBlockData.question_type_description[z]+" "+$,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),["0","4","1","10","13"].includes(z)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:M||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>m({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,r.__)("Required","quiz-master-next"),checked:!d(Q)&&"1"==Q,onChange:()=>m({required:d(Q)||"1"!=Q?1:0})})),(0,a.createElement)(b,{isCategorySelected:e=>A.includes(e),setUnsetCatgory:(e,t)=>{let a=d(A)||0===A.length?d(P)?[]:[P]:A;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((r=>{W(r,t).includes(e)&&(a=a.filter((e=>e!=r)))}));else{a.push(e);let r=W(e,t);a=[...a,...r]}a=p(a),m({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(y,{featureImageID:R,onUpdateImage:e=>{m({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{m({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:F||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>m({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...j},(0,a.createElement)(o.RichText,{tagName:"h4",title:(0,r.__)("Question title","quiz-master-next"),"aria-label":(0,r.__)("Question title","quiz-master-next"),placeholder:(0,r.__)("Type your question here","quiz-master-next"),value:S,onChange:e=>m({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),x&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.RichText,{tagName:"p",title:(0,r.__)("Question description","quiz-master-next"),"aria-label":(0,r.__)("Question description","quiz-master-next"),placeholder:(0,r.__)("Description goes here","quiz-master-next"),value:_(N),onChange:e=>m({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(z)&&(0,a.createElement)(o.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(o.RichText,{tagName:"p",title:(0,r.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,r.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,r.__)("Correct answer info goes here","quiz-master-next"),value:_(T),onChange:e=>m({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(o.RichText,{tagName:"p",title:(0,r.__)("Hint","quiz-master-next"),"aria-label":(0,r.__)("Hint","quiz-master-next"),placeholder:(0,r.__)("hint goes here","quiz-master-next"),value:O,onChange:e=>m({hint:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"}))))}})}(); \ No newline at end of file diff --git a/blocks/package-lock.json b/blocks/package-lock.json index 17c85511c..9da18decc 100644 --- a/blocks/package-lock.json +++ b/blocks/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "GPL-2.0-or-later", "devDependencies": { + "@wordpress/icons": "^9.35.0", "@wordpress/scripts": "^26.12.0" } }, @@ -4139,15 +4140,15 @@ } }, "node_modules/@wordpress/element": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-5.18.0.tgz", - "integrity": "sha512-OynuZuTFdmterh/ASmMSSKjdBj5r1hcwQi37AQnp7+GpyIV3Ol5PR4UWWYB0coW0Gkd0giJkQAwC71/ZkEPYqQ==", + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-5.21.0.tgz", + "integrity": "sha512-iHuVj5gVGLqGtegfMtQp7pUqBksMDhF4Zt3sN4uMWEOewjAhdO18jOQjVrP5aKh7SrdBAzQeGpnsrNUvA7Aj1g==", "dev": true, "dependencies": { "@babel/runtime": "^7.16.0", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", - "@wordpress/escape-html": "^2.41.0", + "@wordpress/escape-html": "^2.44.0", "change-case": "^4.1.2", "is-plain-object": "^5.0.0", "react": "^18.2.0", @@ -4158,9 +4159,9 @@ } }, "node_modules/@wordpress/escape-html": { - "version": "2.41.0", - "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.41.0.tgz", - "integrity": "sha512-fFDuAO/csLVemQrJKTrwxjmR7d2a6zEuDVCKi2jUt7j9rpLpz9IZnEVD2q/icOj2+u6joeDwvCyyPyTreqEZHA==", + "version": "2.44.0", + "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.44.0.tgz", + "integrity": "sha512-FZkljTE+cnc0zS+NWy1c/LH+IEa2NA7DZAJYs0zy/RBGS/qe26AYFRzbyqxxHg1SiKwQUcw+VppLo4bFs5432g==", "dev": true, "dependencies": { "@babel/runtime": "^7.16.0" @@ -4254,6 +4255,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@wordpress/icons": { + "version": "9.35.0", + "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.35.0.tgz", + "integrity": "sha512-Lm7B/2YlBUHjIQIGMbptdpB3is4+EYktITrNmZi4rZ7mveSVon32NzMsVb23nLx0iKyghLfJ4C4t+K2+wLFGJA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.16.0", + "@wordpress/element": "^5.21.0", + "@wordpress/primitives": "^3.42.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@wordpress/jest-console": { "version": "7.12.0", "resolved": "https://registry.npmjs.org/@wordpress/jest-console/-/jest-console-7.12.0.tgz", @@ -4327,6 +4342,20 @@ "prettier": ">=2" } }, + "node_modules/@wordpress/primitives": { + "version": "3.42.0", + "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.42.0.tgz", + "integrity": "sha512-xK2nCDmJMNwzOV52YVTc4Atd48LFKfixMbO4NFdh990qSjBjMyJNykSXcnidOtmcrpXnqWNRIZomWJkqPvaPkQ==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.16.0", + "@wordpress/element": "^5.21.0", + "classnames": "^2.3.1" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@wordpress/scripts": { "version": "26.12.0", "resolved": "https://registry.npmjs.org/@wordpress/scripts/-/scripts-26.12.0.tgz", @@ -5698,6 +5727,12 @@ "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", "dev": true }, + "node_modules/classnames": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz", + "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==", + "dev": true + }, "node_modules/clean-webpack-plugin": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/clean-webpack-plugin/-/clean-webpack-plugin-3.0.0.tgz", diff --git a/blocks/package.json b/blocks/package.json index b207c4263..738b1cb36 100644 --- a/blocks/package.json +++ b/blocks/package.json @@ -15,6 +15,7 @@ "start": "wp-scripts start" }, "devDependencies": { + "@wordpress/icons": "^9.35.0", "@wordpress/scripts": "^26.12.0" } } diff --git a/blocks/src/answer-option/block.json b/blocks/src/answer-option/block.json index faa35eb81..77fe8b9ed 100644 --- a/blocks/src/answer-option/block.json +++ b/blocks/src/answer-option/block.json @@ -17,6 +17,10 @@ "type": "string", "default": "" }, + "caption": { + "type": "string", + "default": "" + }, "points":{ "type": "string", "default": "0" @@ -26,7 +30,7 @@ "default": "0" } }, - "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/quizAttr", "quiz-master-next/questionID", "quiz-master-next/questionType" ], + "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/quizAttr", "quiz-master-next/questionID", "quiz-master-next/questionType", "quiz-master-next/answerType", "quiz-master-next/questionChanged" ], "example": {}, "supports": { "html": false diff --git a/blocks/src/answer-option/edit.js b/blocks/src/answer-option/edit.js index d50d7009e..dfa01edd3 100644 --- a/blocks/src/answer-option/edit.js +++ b/blocks/src/answer-option/edit.js @@ -1,27 +1,24 @@ import { __ } from '@wordpress/i18n'; import { useState, useEffect } from '@wordpress/element'; -import apiFetch from '@wordpress/api-fetch'; +import { decodeEntities } from '@wordpress/html-entities'; +import { escapeAttribute } from "@wordpress/escape-html"; import { InspectorControls, + store as blockEditorStore, RichText, - InnerBlocks, useBlockProps, } from '@wordpress/block-editor'; -import { store as editorStore } from '@wordpress/editor'; -import { store as coreStore } from '@wordpress/core-data'; -import { useDispatch, useSelect } from '@wordpress/data'; +import { useDispatch, useSelect, select } from '@wordpress/data'; +import { isURL } from '@wordpress/url'; import { PanelBody, - PanelRow, TextControl, ToggleControl, __experimentalHStack as HStack, - RangeControl, - RadioControl, - SelectControl, } from '@wordpress/components'; import { createBlock } from '@wordpress/blocks'; -import { qsmIsEmpty, qsmStripTags } from '../helper'; +import ImageType from '../component/ImageType'; +import { qsmIsEmpty, qsmStripTags, qsmDecodeHtml } from '../helper'; export default function Edit( props ) { //check for QSM initialize data @@ -36,20 +33,62 @@ onRemove } = props; const pageID = context['quiz-master-next/pageID']; const questionID = context['quiz-master-next/questionID']; const questionType = context['quiz-master-next/questionType']; + const answerType = context['quiz-master-next/answerType']; + const questionChanged = context['quiz-master-next/questionChanged']; + const name = 'qsm/quiz-answer-option'; const { optionID, content, + caption, points, isCorrect } = attributes; + const { + selectBlock, + } = useDispatch( blockEditorStore ); + + //Use to to update block attributes using clientId + const { updateBlockAttributes } = useDispatch( blockEditorStore ); + + const questionClientID = useSelect( + ( select ) => { + //get parent gutena form clientIds + let questionClientID = select( blockEditorStore ).getBlockParentsByBlockName( clientId,'qsm/quiz-question', true ); + return qsmIsEmpty( questionClientID ) ? '': questionClientID[0]; + }, + [ clientId ] + ); + + //detect change in question + useEffect( () => { + let shouldSetChanged = true; + if ( shouldSetChanged && isSelected && ! qsmIsEmpty( questionClientID ) && false === questionChanged ) { + updateBlockAttributes( questionClientID, { isChanged: true } ); + } + + //cleanup + return () => { + shouldSetChanged = false; + }; + }, [ + content, + caption, + points, + isCorrect + ] ) + /**Initialize block from server */ useEffect( () => { let shouldSetQSMAttr = true; - if ( shouldSetQSMAttr ) { - - + if ( shouldSetQSMAttr ) { + if ( ! qsmIsEmpty( content ) && isURL( content ) && ( -1 !== content.indexOf('https://') || -1 !== content.indexOf('http://') ) && ['rich','text'].includes( answerType ) ) { + setAttributes({ + content:'', + caption:'' + }) + } } //cleanup @@ -57,25 +96,27 @@ onRemove } = props; shouldSetQSMAttr = false; }; - }, [ quizID ] ); + }, [ answerType ] ); const blockProps = useBlockProps( { className: '', } ); - //Decode htmlspecialchars - const decodeHtml = (html) => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; - } - const inputType = ['4','10'].includes( questionType ) ? "checkbox":"radio"; return ( <> + { /**Image answer option */ + 'image' === answerType && + setAttributes( { caption: escapeAttribute( caption ) } ) } + /> + } setAttributes( { points } ) } /> - setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) } - /> + { + ['0','4','1','10', '2'].includes( questionType ) && + setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) } + /> + }
@@ -97,39 +141,90 @@ onRemove } = props; justify='left' > - setAttributes( { content: qsmStripTags( content ) } ) } - onSplit={ ( value, isOriginal ) => { - let newAttributes; - - if ( isOriginal || value ) { - newAttributes = { - ...attributes, - content: value, - }; - } - - const block = createBlock( name, newAttributes ); - - if ( isOriginal ) { - block.clientId = clientId; - } - - return block; - } } - onMerge={ mergeBlocks } - onReplace={ onReplace } - onRemove={ onRemove } - allowedFormats={ [ ] } - withoutInteractiveFormatting - className={ 'qsm-question-answer-option' } - identifier='text' - /> + { /**Text answer option*/ + ! ['rich','image'].includes( answerType ) && + setAttributes( { content: qsmStripTags( decodeEntities( content ) ) } ) } + onSplit={ ( value, isOriginal ) => { + let newAttributes; + + if ( isOriginal || value ) { + newAttributes = { + ...attributes, + content: value, + }; + } + + const block = createBlock( name, newAttributes ); + + if ( isOriginal ) { + block.clientId = clientId; + } + + return block; + } } + onMerge={ mergeBlocks } + onReplace={ onReplace } + onRemove={ onRemove } + allowedFormats={ [ ] } + withoutInteractiveFormatting + className={ 'qsm-question-answer-option' } + identifier='text' + /> + } + { /**Rich Text answer option */ + 'rich' === answerType && + setAttributes( { content } ) } + onSplit={ ( value, isOriginal ) => { + let newAttributes; + + if ( isOriginal || value ) { + newAttributes = { + ...attributes, + content: value, + }; + } + + const block = createBlock( name, newAttributes ); + + if ( isOriginal ) { + block.clientId = clientId; + } + + return block; + } } + onMerge={ mergeBlocks } + onReplace={ onReplace } + onRemove={ onRemove } + className={ 'qsm-question-answer-option' } + identifier='text' + __unstableEmbedURLOnPaste + __unstableAllowPrefixTransformations + /> + } + { /**Image answer option */ + 'image' === answerType && + setAttributes({ + content: isURL( url ) ? url: '', + caption: caption + }) } + /> + } +
diff --git a/blocks/src/component/ImageType.js b/blocks/src/component/ImageType.js new file mode 100644 index 000000000..82444d7cd --- /dev/null +++ b/blocks/src/component/ImageType.js @@ -0,0 +1,208 @@ +/** + * Image Component: Upload, Use media, external image url + */ +import { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob'; +import { + Button, + Spinner, +} from '@wordpress/components'; +import { useDispatch, useSelect } from '@wordpress/data'; +import { + BlockControls, + BlockIcon, + MediaReplaceFlow, + MediaPlaceholder, + store as blockEditorStore, +} from '@wordpress/block-editor'; +import { useEffect, useRef, useState } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; +import { image as icon } from '@wordpress/icons'; +import { store as noticesStore } from '@wordpress/notices'; +import { isURL } from '@wordpress/url'; +import { qsmIsEmpty } from '../helper'; + +export const pickRelevantMediaFiles = ( image, size ) => { + const imageProps = Object.fromEntries( + Object.entries( image ?? {} ).filter( ( [ key ] ) => + [ 'alt', 'id', 'link', 'caption' ].includes( key ) + ) + ); + + imageProps.url = + image?.sizes?.[ size ]?.url || + image?.media_details?.sizes?.[ size ]?.source_url || + image.url; + return imageProps; +}; + +/** + * Is the URL a temporary blob URL? A blob URL is one that is used temporarily + * while the image is being uploaded and will not have an id yet allocated. + * + * @param {number=} id The id of the image. + * @param {string=} url The url of the image. + * + * @return {boolean} Is the URL a Blob URL + */ +const isTemporaryImage = ( id, url ) => ! id && isBlobURL( url ); + +/** + * Is the url for the image hosted externally. An externally hosted image has no + * id and is not a blob url. + * + * @param {number=} id The id of the image. + * @param {string=} url The url of the image. + * + * @return {boolean} Is the url an externally hosted url? + */ +export const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url ); + + +export function ImageType( { + url = '', + caption = '', + alt = '', + setURLCaption, +} ) { + + const ALLOWED_MEDIA_TYPES = [ 'image' ]; + const [ id, setId ] = useState( null ); + const [ temporaryURL, setTemporaryURL ] = useState(); + + const ref = useRef(); + const { imageDefaultSize, mediaUpload } = useSelect( ( select ) => { + const { getSettings } = select( blockEditorStore ); + const settings = getSettings(); + return { + imageDefaultSize: settings.imageDefaultSize, + mediaUpload: settings.mediaUpload, + }; + }, [] ); + + const { createErrorNotice } = useDispatch( noticesStore ); + function onUploadError( message ) { + createErrorNotice( message, { type: 'snackbar' } ); + setURLCaption( undefined, undefined ); + setTemporaryURL( undefined ); + } + + function onSelectImage( media ) { + if ( ! media || ! media.url ) { + setURLCaption( undefined, undefined ); + return; + } + + if ( isBlobURL( media.url ) ) { + setTemporaryURL( media.url ); + return; + } + + setTemporaryURL(); + + let mediaAttributes = pickRelevantMediaFiles( media, imageDefaultSize ); + setId( mediaAttributes.id ); + setURLCaption( mediaAttributes.url, mediaAttributes.caption ); + } + + function onSelectURL( newURL ) { + if ( newURL !== url ) { + setURLCaption( newURL, caption ); + } + } + + let isTemp = isTemporaryImage( id, url ); + + // Upload a temporary image on mount. + useEffect( () => { + if ( ! isTemp ) { + return; + } + + const file = getBlobByURL( url ); + + if ( file ) { + mediaUpload( { + filesList: [ file ], + onFileChange: ( [ img ] ) => { + onSelectImage( img ); + }, + allowedTypes: ALLOWED_MEDIA_TYPES, + onError: ( message ) => { + isTemp = false; + onUploadError( message ); + }, + } ); + } + }, [] ); + + // If an image is temporary, revoke the Blob url when it is uploaded (and is + // no longer temporary). + useEffect( () => { + if ( isTemp ) { + setTemporaryURL( url ); + return; + } + revokeBlobURL( temporaryURL ); + }, [ isTemp, url ] ); + + const isExternal = isExternalImage( id, url ); + const src = isExternal ? url : undefined; + const mediaPreview = !! url && ( + { + ); + + let img = ( + <> + + { temporaryURL && } + + ); + + return ( +
+ { qsmIsEmpty( url ) ? ( + } + onSelect={ onSelectImage } + onSelectURL={ onSelectURL } + onError={ onUploadError } + accept="image/*" + allowedTypes={ ALLOWED_MEDIA_TYPES } + value={ { id, src } } + mediaPreview={ mediaPreview } + disableMediaButtons={ temporaryURL || url } + /> + ) : ( + <> + + + +
{ img }
+ + ) } +
+ ); +} + +export default ImageType; diff --git a/blocks/src/component/SelectAddCategory.js b/blocks/src/component/SelectAddCategory.js index dece9879a..b18ec1fe5 100644 --- a/blocks/src/component/SelectAddCategory.js +++ b/blocks/src/component/SelectAddCategory.js @@ -37,6 +37,22 @@ const SelectAddCategory = ({ //category list const [ categories, setCategories ] = useState( qsmBlockData?.hierarchicalCategoryList ); + //get category id-details object + const getCategoryIdDetailsObject = ( categories ) => { + let catObj = {}; + categories.forEach( cat => { + catObj[ cat.id ] = cat; + if ( 0 < cat.children.length ) { + let childCategory = getCategoryIdDetailsObject( cat.children ); + catObj = { ...catObj, ...childCategory }; + } + }); + return catObj; + } + + //category id wise details + const [ categoryIdDetails, setCategoryIdDetails ] = useState( qsmIsEmpty( qsmBlockData?.hierarchicalCategoryList ) ? {} : getCategoryIdDetailsObject( qsmBlockData.hierarchicalCategoryList ) ); + const addNewCategoryLabel = __( 'Add New Category ', 'quiz-master-next' ); const noParentOption = `— ${ __( 'Parent Category ', 'quiz-master-next' ) } —`; @@ -69,11 +85,12 @@ const SelectAddCategory = ({ // console.log("new categorieslist", res); if ( 'success' == res.status ) { setCategories( res.result ); + setCategoryIdDetails( res.result ); //set form setFormCatName( '' ); setFormCatParent( 0 ); //set category selected - setUnsetCatgory( term_id ); + setUnsetCatgory( term_id, getCategoryIdDetailsObject( term.id ) ); setAddingNewCategory( false ); } }); @@ -83,6 +100,7 @@ const SelectAddCategory = ({ }); } + //get category name array const getCategoryNameArray = ( categories ) => { let cats = []; categories.forEach( cat => { @@ -132,7 +150,7 @@ const SelectAddCategory = ({ setUnsetCatgory( term.id ) } + onChange={ () => setUnsetCatgory( term.id, categoryIdDetails ) } /> { !! term.children.length && (
diff --git a/blocks/src/edit.js b/blocks/src/edit.js index 6941c088a..5cd8baf3f 100644 --- a/blocks/src/edit.js +++ b/blocks/src/edit.js @@ -1,6 +1,7 @@ import { __ } from '@wordpress/i18n'; import { useState, useEffect } from '@wordpress/element'; import apiFetch from '@wordpress/api-fetch'; +import { decodeEntities } from '@wordpress/html-entities'; import { InspectorControls, InnerBlocks, @@ -90,7 +91,7 @@ export default function Edit( props ) { method: 'POST', data: { quizID: quiz_id }, } ).then( ( res ) => { - //console.log( "quiz render data", res ); + console.log( "quiz render data", res ); if ( 'success' == res.status ) { let result = res.result; setAttributes( { @@ -353,6 +354,9 @@ export default function Edit( props ) { if ( 'qsm/quiz-question' !== questionBlock.name ) { return true; } + + let questionAttr = questionBlock.attributes; + let answerEditor = qsmValueOrDefault( questionAttr?.answerEditor, 'text' ); let answers = []; //Answer option blocks if ( ! qsmIsEmpty( questionBlock.innerBlocks ) && 0 < questionBlock.innerBlocks.length ) { @@ -362,34 +366,49 @@ export default function Edit( props ) { return true; } let answerAttr = answerOptionBlock.attributes; - answers.push([ - qsmValueOrDefault( answerAttr?.content ), + let answerContent = qsmValueOrDefault( answerAttr?.content ); + //if rich text + if ( ! qsmIsEmpty( questionAttr?.answerEditor ) && 'rich' === questionAttr.answerEditor ) { + answerContent = qsmDecodeHtml( decodeEntities( answerContent ) ); + } + let ans = [ + answerContent, qsmValueOrDefault( answerAttr?.points ), qsmValueOrDefault( answerAttr?.isCorrect ), - ]); + ]; + //answer options are image type + if ( 'image' === answerEditor && ! qsmIsEmpty( answerAttr?.caption ) ) { + ans.push( answerAttr?.caption ); + } + answers.push( ans ); }); } //questions Data - let questionAttr = questionBlock.attributes; questions.push( questionAttr.questionID ); - quizDataToSave.questions.push({ - "id": questionAttr.questionID, - "quizID": quizAttr.quiz_id, - "postID": quizAttr.post_id, - "answerEditor": qsmValueOrDefault( questionAttr?.answerEditor, 'text' ), - "type": qsmValueOrDefault( questionAttr?.type , '0' ), - "name": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.description ) ), - "question_title": qsmValueOrDefault( questionAttr?.title ), - "answerInfo": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.correctAnswerInfo ) ), - "comments": qsmValueOrDefault( questionAttr?.commentBox, '1' ), - "hint": qsmValueOrDefault( questionAttr?.hint ), - "category": qsmValueOrDefault( questionAttr?.category ), - "multicategories": [], - "required": qsmValueOrDefault( questionAttr?.required, 1 ), - "answers": answers, - "page": pageSNo - }); + //update question only if changes occured + if ( questionAttr.isChanged ) { + quizDataToSave.questions.push({ + "id": questionAttr.questionID, + "quizID": quizAttr.quiz_id, + "postID": quizAttr.post_id, + "answerEditor": answerEditor, + "type": qsmValueOrDefault( questionAttr?.type , '0' ), + "name": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.description ) ), + "question_title": qsmValueOrDefault( questionAttr?.title ), + "answerInfo": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.correctAnswerInfo ) ), + "comments": qsmValueOrDefault( questionAttr?.commentBox, '1' ), + "hint": qsmValueOrDefault( questionAttr?.hint ), + "category": qsmValueOrDefault( questionAttr?.category ), + "multicategories": qsmValueOrDefault( questionAttr?.multicategories, [] ), + "required": qsmValueOrDefault( questionAttr?.required, 1 ), + "answers": answers, + "featureImageID":qsmValueOrDefault( questionAttr?.featureImageID ), + "featureImageSrc":qsmValueOrDefault( questionAttr?.featureImageSrc ), + "page": pageSNo + }); + } + }); } @@ -445,7 +464,7 @@ export default function Edit( props ) { useEffect( () => { if ( isSavingPage ) { let quizData = getQuizDataToSave(); - //console.log( "quizData", quizData); + console.log( "quizData", quizData); //save quiz status setSaveQuiz( true ); @@ -462,7 +481,11 @@ export default function Edit( props ) { method: 'POST', body: quizData } ).then( ( res ) => { - //console.log( res ); + //create notice + createNotice( res.status, res.msg, { + isDismissible: true, + type: 'snackbar', + } ); } ).catch( ( error ) => { console.log( 'error',error ); diff --git a/blocks/src/helper.js b/blocks/src/helper.js index 45b219e2e..85cf0f22e 100644 --- a/blocks/src/helper.js +++ b/blocks/src/helper.js @@ -1,6 +1,15 @@ //Check if undefined, null, empty export const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data ); +//Get Unique array values +export const qsmUniqueArray = ( arr ) => { + if ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) { + return arr; + } + return arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index ); +} + + //Decode htmlspecialchars export const qsmDecodeHtml = ( html ) => { var txt = document.createElement("textarea"); @@ -19,8 +28,12 @@ export const qsmSanitizeName = ( name ) => { return name; } -// Remove anchor tags from button text content. -export const qsmStripTags = ( text ) => text.replace( /<\/?a[^>]*>/g, '' ); +// Remove anchor tags from text content. +export const qsmStripTags = ( text ) => { + let div = document.createElement("div"); + div.innerHTML = qsmDecodeHtml( text ); + return div.innerText; +} //prepare form data export const qsmFormData = ( obj = false ) => { diff --git a/blocks/src/question/block.json b/blocks/src/question/block.json index b2c2e8111..a9dfa4094 100644 --- a/blocks/src/question/block.json +++ b/blocks/src/question/block.json @@ -9,6 +9,10 @@ "icon": "move", "description": "QSM Quiz Question", "attributes": { + "isChanged":{ + "type": "string", + "default": false + }, "questionID": { "type": "string", "default": "0" @@ -77,7 +81,9 @@ "usesContext": [ "quiz-master-next/quizID", "quiz-master-next/pageID", "quiz-master-next/quizAttr" ], "providesContext": { "quiz-master-next/questionID": "questionID", - "quiz-master-next/questionType":"type" + "quiz-master-next/questionType":"type", + "quiz-master-next/answerType":"answerEditor", + "quiz-master-next/questionChanged":"isChanged" }, "example": {}, "supports": { diff --git a/blocks/src/question/edit.js b/blocks/src/question/edit.js index 9b1d97cf7..19d9032a8 100644 --- a/blocks/src/question/edit.js +++ b/blocks/src/question/edit.js @@ -21,7 +21,7 @@ import { } from '@wordpress/components'; import FeaturedImage from '../component/FeaturedImage'; import SelectAddCategory from '../component/SelectAddCategory'; -import { qsmIsEmpty, qsmStripTags, qsmFormData, qsmValueOrDefault, qsmDecodeHtml, qsmAddObjToFormData } from '../helper'; +import { qsmIsEmpty, qsmStripTags, qsmFormData, qsmValueOrDefault, qsmDecodeHtml, qsmUniqueArray } from '../helper'; //check for duplicate questionID attr @@ -59,6 +59,7 @@ export default function Edit( props ) { const { createNotice } = useDispatch( noticesStore ); const { + isChanged = false,//use in editor only to detect if any change occur in this block questionID, type, description, @@ -74,10 +75,8 @@ export default function Edit( props ) { answerEditor, matchAnswer, required, - settings, } = attributes; - - const [ quesAttr, setQuesAttr ] = useState( settings ); + /**Generate question id if not set or in case duplicate questionID ***/ useEffect( () => { @@ -140,6 +139,36 @@ export default function Edit( props ) { }, [] ); + //detect change in question + useEffect( () => { + let shouldSetChanged = true; + if ( shouldSetChanged && isSelected && false === isChanged ) { + //console.log("changed question", questionID ); + setAttributes( { isChanged: true } ); + } + + //cleanup + return () => { + shouldSetChanged = false; + }; + }, [ + questionID, + type, + description, + title, + correctAnswerInfo, + commentBox, + category, + multicategories, + hint, + featureImageID, + featureImageSrc, + answers, + answerEditor, + matchAnswer, + required, + ] ) + //add classes const blockProps = useBlockProps( { className: isParentOfSelectedBlock ? ' in-editing-mode':'' , @@ -161,34 +190,63 @@ export default function Edit( props ) { ]; + //Get category ancestor + const getCategoryAncestors = ( termId, categories ) => { + let parents = []; + if ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) { + termId = categories[ termId ]['parent']; + parents.push( termId ); + if ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) { + let ancestor = getCategoryAncestors( termId, categories ); + parents = [ ...parents, ...ancestor ]; + } + } + + return qsmUniqueArray( parents ); + } + //check if a category is selected - const isCategorySelected = ( termId ) => ( category == termId || multicategories.includes( termId ) ); + const isCategorySelected = ( termId ) => multicategories.includes( termId ); //set or unset category - const setUnsetCatgory = ( termId ) => { - if ( qsmIsEmpty( category ) && ( qsmIsEmpty( multicategories ) || 0 === multicategories.length ) ) { - setAttributes({ category: termId }); - } else if ( termId == category ) { - setAttributes({ category: '' }); + const setUnsetCatgory = ( termId, categories ) => { + let multiCat = ( qsmIsEmpty( multicategories ) || 0 === multicategories.length ) ? ( qsmIsEmpty( category ) ? [] : [ category ] ) : multicategories; + + //Case: category unselected + if ( multiCat.includes( termId ) ) { + //remove category if already set + multiCat = multiCat.filter( catID => catID != termId ); + let children = []; + //check for if any child is selcted + multiCat.forEach( childCatID => { + //get ancestors of category + let ancestorIds = getCategoryAncestors( childCatID, categories ); + //given unselected category is an ancestor of selected category + if ( ancestorIds.includes( termId ) ) { + //remove category if already set + multiCat = multiCat.filter( catID => catID != childCatID ); + } + }); } else { - let multiCat = ( qsmIsEmpty( multicategories ) || 0 === multicategories.length ) ? [] : multicategories; + //add category if not set + multiCat.push( termId ); + //get ancestors of category + let ancestorIds = getCategoryAncestors( termId, categories ); + //select all ancestor + multiCat = [ ...multiCat, ...ancestorIds ]; + } - if ( multiCat.includes( termId ) ) { - //remove category if already set - multiCat = multiCat.filter( catID => catID != termId ); - } else { - //add category if not set - multiCat.push( termId ); - //console.log("add multi", termId); - } + multiCat = qsmUniqueArray( multiCat ); - setAttributes({ - category: '', - multicategories: [ ...multiCat ] - }); - } + setAttributes({ + category: '', + multicategories: [ ...multiCat ] + }); } + //Notes relation to question type + const notes = ['12','7','3','5','14'].includes( type ) ? __( 'Note: Add only correct answer options with their respective points score.', 'quiz-master-next' ) : ''; + return ( <> @@ -201,6 +259,7 @@ export default function Edit( props ) { onChange={ ( type ) => setAttributes( { type } ) } + help={ qsmIsEmpty( qsmBlockData.question_type_description[ type ] ) ? '' : qsmBlockData.question_type_description[ type ]+' '+notes } __nextHasNoMarginBottom > { @@ -220,15 +279,18 @@ export default function Edit( props ) { } {/**Answer Type */} - - setAttributes( { answerEditor } ) - } - __nextHasNoMarginBottom - /> + { + ['0','4','1','10','13'].includes( type ) && + + setAttributes( { answerEditor } ) + } + __nextHasNoMarginBottom + /> + } - + { + ! ['8','11','6','9'].includes( type ) && + + } +
11, - 'description' => __( 'For this question type, users will see a file upload field on front end.', 'quiz-master-next' ), - ), - array( - 'question_type_id' => '14', - 'description' => __( 'Use %BLANK% variable in the description field to display input boxes.', 'quiz-master-next' ), - ), - array( - 'question_type_id' => '12', - 'description' => __( 'For this question type, users will see a date input field on front end.', 'quiz-master-next' ), - ), - array( - 'question_type_id' => '3', - 'description' => __( 'For this question type, users will see a standard input box on front end.', 'quiz-master-next' ), - ), - array( - 'question_type_id' => '5', - 'description' => __( 'For this question type, users will see a standard textarea input box on front end.', 'quiz-master-next' ), - ), - array( - 'question_type_id' => '6', - 'description' => __( 'Displays a simple section on front end. Description is mandatory. ', 'quiz-master-next' ), - ), - array( - 'question_type_id' => '7', - 'description' => __( 'For this question type, users will see an input box which accepts only number values on front end.', 'quiz-master-next' ), - ), - array( - 'question_type_id' => '8', - 'description' => __( "For this question type, users will see a checkbox on front end. The text in description field will act like it's label.", 'quiz-master-next' ), - ), - array( - 'question_type_id' => '9', - 'description' => __( 'For this question type, users will see a Captcha field on front end.', 'quiz-master-next' ), - ), - // array( - // 'question_type_id' => '13', - // 'description' => __( 'Use points based grading system for Polar questions.', 'quiz-master-next' ), - // ), - ); + $description_arr = $mlwQuizMasterNext->pluginHelper->description_array(); foreach ( $question_types as $type ) { if ( isset( $type['options']['description'] ) && null !== $type['options']['description'] ) { $description = array( diff --git a/php/classes/class-qmn-plugin-helper.php b/php/classes/class-qmn-plugin-helper.php index de13793f0..bbcc855dd 100644 --- a/php/classes/class-qmn-plugin-helper.php +++ b/php/classes/class-qmn-plugin-helper.php @@ -1146,4 +1146,49 @@ public function categorize_question_types() { $question_type_categorized = array_merge( $question_type_categorized, $question_type_uncategorized ); return $question_type_categorized; } + + public function description_array() { + return array( + array( + 'question_type_id' => 11, + 'description' => __( 'For this question type, users will see a file upload field on front end.', 'quiz-master-next' ), + ), + array( + 'question_type_id' => '14', + 'description' => __( 'Use %BLANK% variable in the description field to display input boxes.', 'quiz-master-next' ), + ), + array( + 'question_type_id' => '12', + 'description' => __( 'For this question type, users will see a date input field on front end.', 'quiz-master-next' ), + ), + array( + 'question_type_id' => '3', + 'description' => __( 'For this question type, users will see a standard input box on front end.', 'quiz-master-next' ), + ), + array( + 'question_type_id' => '5', + 'description' => __( 'For this question type, users will see a standard textarea input box on front end.', 'quiz-master-next' ), + ), + array( + 'question_type_id' => '6', + 'description' => __( 'Displays a simple section on front end. Description is mandatory. ', 'quiz-master-next' ), + ), + array( + 'question_type_id' => '7', + 'description' => __( 'For this question type, users will see an input box which accepts only number values on front end.', 'quiz-master-next' ), + ), + array( + 'question_type_id' => '8', + 'description' => __( "For this question type, users will see a checkbox on front end. The text in description field will act like it's label.", 'quiz-master-next' ), + ), + array( + 'question_type_id' => '9', + 'description' => __( 'For this question type, users will see a Captcha field on front end.', 'quiz-master-next' ), + ), + // array( + // 'question_type_id' => '13', + // 'description' => __( 'Use points based grading system for Polar questions.', 'quiz-master-next' ), + // ), + ); + } } From 7d39fd49a83cbda081a1b67b39d0f6596ae35982 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Thu, 19 Oct 2023 17:07:31 +0530 Subject: [PATCH 08/27] update branch from master --- mlw_quizmaster2.php | 1 - 1 file changed, 1 deletion(-) diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index f7c02b6cf..cacc764d5 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -2,7 +2,6 @@ /** * Plugin Name: Quiz And Survey Master * Description: Easily and quickly add quizzes and surveys to your website. - * Version: 9.1.16 * Version: 8.1.17 * Author: ExpressTech * Author URI: https://quizandsurveymaster.com/ From bf3851a6a765398a3b912d3cc3aa6248b000070c Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Fri, 20 Oct 2023 13:17:38 +0530 Subject: [PATCH 09/27] disable pro question type --- blocks/block.php | 33 ++++++++++++++++- blocks/build/index.asset.php | 2 +- blocks/build/index.css | 2 +- blocks/build/index.js | 2 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 6 ++-- blocks/src/edit.js | 52 ++++++++++++++++++++++----- blocks/src/editor.scss | 2 +- blocks/src/question/edit.js | 37 ++++++++++++++++--- php/admin/functions.php | 15 ++++++++ php/admin/quiz-options-page.php | 13 +------ 11 files changed, 132 insertions(+), 34 deletions(-) diff --git a/blocks/block.php b/blocks/block.php index 7e8a133b3..92112f32f 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -271,7 +271,7 @@ public function register_editor_rest_routes() { return; } - //get quiz structure data + //get quiz hierarchical category structure data register_rest_route( 'quiz-survey-master/v1', '/quiz/hierarchical-category-list', @@ -284,6 +284,19 @@ public function register_editor_rest_routes() { ) ); + //get quiz advance question type upgrade popup html + register_rest_route( + 'quiz-survey-master/v1', + '/quiz/advance-ques-type-upgrade-popup', + array( + 'methods' => WP_REST_Server::CREATABLE, + 'callback' => array( $this, 'advance_question_type_upgrade_popup' ), + 'permission_callback' => function () { + return current_user_can( 'edit_posts' ); + }, + ) + ); + //get quiz structure data register_rest_route( 'quiz-survey-master/v1', @@ -338,6 +351,24 @@ public function hierarchical_category_list() { ); } + /** + * REST API + * get hierarchical qsm category list + */ + public function advance_question_type_upgrade_popup() { + $contents = ''; + if ( function_exists( 'qsm_advance_question_type_upgrade_popup' ) ) { + ob_start(); + qsm_advance_question_type_upgrade_popup(); + $contents = ob_get_clean(); + } + return array( + 'status' => 'success', + 'result' => $contents, + ); + } + + //get post id from quiz id private function get_post_id_from_quiz_id( $quiz_id ) { $post_ids = get_posts( array( diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 57aa0d043..85182509e 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '009cf34c85093aeba67e'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '84c4a9e9e0a01d83314b'); diff --git a/blocks/build/index.css b/blocks/build/index.css index a14e1e98f..967eb23ed 100644 --- a/blocks/build/index.css +++ b/blocks/build/index.css @@ -1 +1 @@ -.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}p.qsm-error-text{color:#fd3e3e}.qsm-placeholder-quiz-create-form{width:50%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{font-size:1rem}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666} +.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.qsm-placeholder-quiz-create-form{width:50%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{font-size:1rem}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666} diff --git a/blocks/build/index.js b/blocks/build/index.js index 08a155f0b..3d604511d 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={101:function(e,t,n){var i=window.wp.blocks,a=window.wp.element,s=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),u=window.wp.htmlEntities,l=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,q=window.wp.components;const _=e=>null==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=(e,t="")=>_(e)?t:e;(0,i.registerBlockType)("qsm/quiz",{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:z}=e,{createNotice:f}=(0,m.useDispatch)(c.store),w=qsmBlockData.globalQuizsetting,{quizID:b,quizAttr:v=w}=n,[y,k]=(0,a.useState)(qsmBlockData.QSMQuizList),[E,D]=(0,a.useState)({error:!1,msg:""}),[I,B]=(0,a.useState)(!1),[x,S]=(0,a.useState)(!1),[C,O]=(0,a.useState)(!1),[P,N]=(0,a.useState)([]),A=qsmBlockData.quizOptions,T=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:M}=(0,m.useSelect)(l.store);(0,a.useEffect)((()=>{let e=!0;return e&&!_(b)&&0{e=!1}}),[]);const Q=e=>{!_(e)&&0{if(console.log("quiz render data",t),"success"==t.status){let n=t.result;if(i({quizID:parseInt(e),quizAttr:{...v,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2]}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),N(e)}}else console.log("error "+t.msg)}))},j=(e,t)=>{let n=v;n[t]=e,i({quizAttr:{...n}})};(0,a.useEffect)((()=>{if(T){let e=(()=>{let e=M(z);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:v.quiz_id,post_id:v.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,a=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=e.attributes,s=h(i?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=h(t?.content);_(i?.answerEditor)||"rich"!==i.answerEditor||(n=d((0,u.decodeEntities)(n)));let a=[n,h(t?.points),h(t?.isCorrect)];"image"!==s||_(t?.caption)||a.push(t?.caption),r.push(a)})),a.push(i.questionID),i.isChanged&&t.questions.push({id:i.questionID,quizID:v.quiz_id,postID:v.post_id,answerEditor:s,type:h(i?.type,"0"),name:d(h(i?.description)),question_title:h(i?.title),answerInfo:d(h(i?.correctAnswerInfo)),comments:h(i?.commentBox,"1"),hint:h(i?.hint),category:h(i?.category),multicategories:h(i?.multicategories,[]),required:h(i?.required,1),answers:r,featureImageID:h(i?.featureImageID),featureImageSrc:h(i?.featureImageSrc),page:n})})),t.pages.push(a),t.qpages.push({id:i,quizID:v.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:a}),n++}})),t.quiz={quiz_name:v.quiz_name,quiz_id:v.quiz_id,post_id:v.post_id},C&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==v[e]&&null!==v[e]&&(t.quiz[e]=v[e])})),t})();console.log("quizData",e),S(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[T]);const F=(0,l.useBlockProps)(),H=(0,l.useInnerBlocksProps)(F,{template:P,allowedBlocks:["qsm/quiz-page"]});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.InspectorControls,null,(0,a.createElement)(q.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:v?.quiz_name||"",onChange:e=>j(e,"quiz_name")}))),_(b)||"0"==b?(0,a.createElement)(q.Placeholder,{icon:()=>(0,a.createElement)(q.Icon,{icon:"vault",size:"36"}),label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,a.createElement)(a.Fragment,null,!_(y)&&0Q(e),disabled:I,__nextHasNoMarginBottom:!0}),(0,a.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>B(!I)},(0,s.__)("Add New","quiz-master-next"))),(_(y)||I)&&(0,a.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:v?.quiz_name||"",onChange:e=>j(e,"quiz_name")}),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>O(!C)},(0,s.__)("Advance options","quiz-master-next")),C&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(q.SelectControl,{label:A?.form_type?.label,value:v?.form_type,options:A?.form_type?.options,onChange:e=>j(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,a.createElement)(q.SelectControl,{label:A?.system?.label,value:v?.system,options:A?.system?.options,onChange:e=>j(e,"system"),help:A?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,a.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:A?.[e]?.label,help:A?.[e]?.help,value:_(v[e])?0:v[e],onChange:t=>j(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,a.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:A?.[e]?.label,help:A?.[e]?.help,checked:!_(v[e])&&"1"==v[e],onChange:()=>j(_(v[e])||"1"!=v[e]?1:0,e)})))),(0,a.createElement)(q.Button,{variant:"primary",disabled:x||_(v.quiz_name),onClick:()=>(()=>{if(_(v.quiz_name))return void console.log("empty quiz_name");S(!0);let e=g({quiz_name:v.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===v[t]||null===v[t]?"":e.append(t,v[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(console.log(e),S(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if(console.log("question response",t),"success"==t.status){let n=t.id,i=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});i.append("pages[0][]",n),i.append("qpages[0][id]",1),i.append("qpages[0][quizID]",e.quizID),i.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+1e3*Math.random()).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.trunc(1e8*Math.random())}`:""}`)()),i.append("qpages[0][hide_prevbtn]",0),i.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:i}).then((t=>{console.log("pageResponse",t),"success"==t.status&&Q(e.quizID)}))}})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))))):(0,a.createElement)("div",{...H}))},save:e=>null})}},n={};function i(e){var a=n[e];if(void 0!==a)return a.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,i),s.exports}i.m=t,e=[],i.O=function(t,n,a,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,a,s]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var a,s,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(a in o)i.o(o,a)&&(i.m[a]=o[a]);if(u)var c=u(i)}for(t&&t(n);lnull==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=(e,t="")=>_(e)?t:e;(0,i.registerBlockType)("qsm/quiz",{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:z}=e,{createNotice:f}=(0,m.useDispatch)(c.store),b=qsmBlockData.globalQuizsetting,{quizID:w,quizAttr:y=b}=n,[v,k]=(0,a.useState)(qsmBlockData.QSMQuizList),[E,D]=(0,a.useState)({error:!1,msg:""}),[I,B]=(0,a.useState)(!1),[x,S]=(0,a.useState)(!1),[C,O]=(0,a.useState)(!1),[P,T]=(0,a.useState)([]),A=qsmBlockData.quizOptions,N=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:M}=(0,m.useSelect)(l.store);(0,a.useEffect)((()=>{let e=!0;return e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{Q()}),100),!_(w)&&0{e=!1}}),[]);const Q=()=>{let e=document.getElementById("modal-advanced-question-type");_(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");_(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},j=e=>{!_(e)&&0{if("success"==t.status){let n=t.result;if(i({quizID:parseInt(e),quizAttr:{...y,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:h(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),T(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},F=(e,t)=>{let n=y;n[t]=e,i({quizAttr:{...n}})};(0,a.useEffect)((()=>{if(N){let e=(()=>{let e=M(z);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:y.quiz_id,post_id:y.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,a=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=e.attributes,s=h(i?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=h(t?.content);_(i?.answerEditor)||"rich"!==i.answerEditor||(n=d((0,u.decodeEntities)(n)));let a=[n,h(t?.points),h(t?.isCorrect)];"image"!==s||_(t?.caption)||a.push(t?.caption),r.push(a)})),a.push(i.questionID),i.isChanged&&t.questions.push({id:i.questionID,quizID:y.quiz_id,postID:y.post_id,answerEditor:s,type:h(i?.type,"0"),name:d(h(i?.description)),question_title:h(i?.title),answerInfo:d(h(i?.correctAnswerInfo)),comments:h(i?.commentBox,"1"),hint:h(i?.hint),category:h(i?.category),multicategories:h(i?.multicategories,[]),required:h(i?.required,1),answers:r,featureImageID:h(i?.featureImageID),featureImageSrc:h(i?.featureImageSrc),page:n})})),t.pages.push(a),t.qpages.push({id:i,quizID:y.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:a}),n++}})),t.quiz={quiz_name:y.quiz_name,quiz_id:y.quiz_id,post_id:y.post_id},C&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==y[e]&&null!==y[e]&&(t.quiz[e]=y[e])})),t})();S(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[N]);const H=(0,l.useBlockProps)(),$=(0,l.useInnerBlocksProps)(H,{template:P,allowedBlocks:["qsm/quiz-page"]});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.InspectorControls,null,(0,a.createElement)(q.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:y?.quiz_name||"",onChange:e=>F(e,"quiz_name")}))),_(w)||"0"==w?(0,a.createElement)(q.Placeholder,{icon:()=>(0,a.createElement)(q.Icon,{icon:"vault",size:"36"}),label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,a.createElement)(a.Fragment,null,!_(v)&&0j(e),disabled:I,__nextHasNoMarginBottom:!0}),(0,a.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>B(!I)},(0,s.__)("Add New","quiz-master-next"))),(_(v)||I)&&(0,a.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:y?.quiz_name||"",onChange:e=>F(e,"quiz_name")}),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>O(!C)},(0,s.__)("Advance options","quiz-master-next")),C&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(q.SelectControl,{label:A?.form_type?.label,value:y?.form_type,options:A?.form_type?.options,onChange:e=>F(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,a.createElement)(q.SelectControl,{label:A?.system?.label,value:y?.system,options:A?.system?.options,onChange:e=>F(e,"system"),help:A?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,a.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:A?.[e]?.label,help:A?.[e]?.help,value:_(y[e])?0:y[e],onChange:t=>F(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,a.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:A?.[e]?.label,help:A?.[e]?.help,checked:!_(y[e])&&"1"==y[e],onChange:()=>F(_(y[e])||"1"!=y[e]?1:0,e)})))),(0,a.createElement)(q.Button,{variant:"primary",disabled:x||_(y.quiz_name),onClick:()=>(()=>{if(_(y.quiz_name))return void console.log("empty quiz_name");S(!0);let e=g({quiz_name:y.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===y[t]||null===y[t]?"":e.append(t,y[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(S(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,i=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});i.append("pages[0][]",n),i.append("qpages[0][id]",1),i.append("qpages[0][quizID]",e.quizID),i.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+1e3*Math.random()).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.trunc(1e8*Math.random())}`:""}`)()),i.append("qpages[0][hide_prevbtn]",0),i.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:i}).then((t=>{"success"==t.status&&j(e.quizID)}))}})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))))):(0,a.createElement)("div",{...$}))},save:e=>null})}},n={};function i(e){var a=n[e];if(void 0!==a)return a.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,i),s.exports}i.m=t,e=[],i.O=function(t,n,a,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,a,s]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var a,s,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(a in o)i.o(o,a)&&(i.m[a]=o[a]);if(u)var c=u(i)}for(t&&t(n);l array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '936a9892dc15806200a3'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'c85c9276e2e267087e68'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 996ca425c..ed776ef4a 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -1,5 +1,5 @@ -!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,r=window.wp.i18n,n=window.wp.apiFetch,i=e.n(n),o=window.wp.blockEditor,l=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,p=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=_(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],w=(0,r.__)("Featured image"),x=(0,r.__)("Set featured image"),E=(0,a.createElement)("p",null,(0,r.__)("To edit the featured image, you need permission to upload media."));var y=({featureImageID:e,onUpdateImage:t,onRemoveImage:n})=>{const{createNotice:i}=(0,s.useDispatch)(l.store),p=(0,a.useRef)(),[_,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:y,mediaUpload:b}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(o.store).getSettings().mediaUpload}}),[]);function k(e){b({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){i("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(y)||"object"!=typeof y||q({id:e,width:y.media_details.width,height:y.media_details.height,url:y.source_url,alt_text:y.alt_text,slug:y.slug})),()=>{t=!1}}),[y]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,r.sprintf)( +!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch,i=e.n(r),o=window.wp.blockEditor,l=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,_=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),p=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=p(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],x=(0,n.__)("Featured image"),E=(0,n.__)("Set featured image"),w=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media."));var y=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:i}=(0,s.useDispatch)(l.store),_=(0,a.useRef)(),[p,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:y,mediaUpload:b}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(o.store).getSettings().mediaUpload}}),[]);function k(e){b({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){i("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(y)||"object"!=typeof y||q({id:e,width:y.media_details.width,height:y.media_details.height,url:y.source_url,alt_text:y.alt_text,slug:y.slug})),()=>{t=!1}}),[y]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( // Translators: %s: The selected image alt text. -(0,r.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,r.sprintf)( +(0,n.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,n.sprintf)( // Translators: %s: The selected image filename. -(0,r.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(o.MediaUploadCheck,{fallback:E},(0,a.createElement)(o.MediaUpload,{title:w,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:p,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,r.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),_&&(0,a.createElement)(c.Spinner,null),!e&&!_&&x),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,r.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{n(),p.current.focus()}},(0,r.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:k})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[n,o]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[p,_]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,w]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0r.map((r=>(0,a.createElement)("div",{key:r.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:r.name,checked:e(r.id),onChange:()=>t(r.id,E)}),!!r.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},C(r.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,r.__)("Categories","quiz-master-next")},C(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>o(!n)},b)),n&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(l)||p||(_(!0),i()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;i()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(w(e.result),y(e.result),s(""),u(0),t(a,x(term.id)),_(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,r.__)("Category Name","quiz-master-next"),value:l,onChange:e=>((e,t)=>{t=I(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||p},b)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,r.__)("Category ","quiz-master-next")+g+(0,r.__)(" already exists.","quiz-master-next"))))))},k=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(k.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:m,isSelected:u,clientId:f,context:w}=e,x=(0,s.useSelect)((e=>u||e("core/block-editor").hasSelectedInnerBlock(f,!0))),E=w["quiz-master-next/quizID"],{quiz_name:k,post_id:I,rest_nonce:C}=w["quiz-master-next/quizAttr"],{createNotice:v}=(w["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{isChanged:B=!1,questionID:D,type:z,description:N,title:S,correctAnswerInfo:T,commentBox:F,category:P,multicategories:A,hint:O,featureImageID:R,featureImageSrc:U,answers:H,answerEditor:M,matchAnswer:L,required:Q}=n;(0,a.useEffect)((()=>{let e=!0;if(e&&(d(D)||"0"==D||!d(D)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:r}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&r===e}))})(D,f))){let e=h({id:null,rest_nonce:C,quizID:E,quiz_name:k,postID:I,answerEditor:q(M,"text"),type:q(z,"0"),name:_(q(N)),question_title:q(S),answerInfo:_(q(T)),comments:q(F,"1"),hint:q(O),category:q(P),multicategories:[],required:q(Q,1),answers:H,page:0,featureImageID:R,featureImageSrc:U,matchAnswer:null});i()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if(console.log("question created",e),"success"==e.status){let t=e.id;m({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&u&&!1===B&&m({isChanged:!0}),()=>{e=!1}}),[D,z,N,S,T,F,P,A,O,R,U,H,M,L,Q]);const j=(0,o.useBlockProps)({className:x?" in-editing-mode":""}),W=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let r=W(e,t);a=[...a,...r]}return p(a)},$=["12","7","3","5","14"].includes(z)?(0,r.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"";return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,r.__)("ID","quiz-master-next")+": "+D),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:z||qsmBlockData.question_type.default,onChange:e=>m({type:e}),help:d(qsmBlockData.question_type_description[z])?"":qsmBlockData.question_type_description[z]+" "+$,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),["0","4","1","10","13"].includes(z)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:M||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>m({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,r.__)("Required","quiz-master-next"),checked:!d(Q)&&"1"==Q,onChange:()=>m({required:d(Q)||"1"!=Q?1:0})})),(0,a.createElement)(b,{isCategorySelected:e=>A.includes(e),setUnsetCatgory:(e,t)=>{let a=d(A)||0===A.length?d(P)?[]:[P]:A;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((r=>{W(r,t).includes(e)&&(a=a.filter((e=>e!=r)))}));else{a.push(e);let r=W(e,t);a=[...a,...r]}a=p(a),m({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,r.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(y,{featureImageID:R,onUpdateImage:e=>{m({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{m({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:F||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>m({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...j},(0,a.createElement)(o.RichText,{tagName:"h4",title:(0,r.__)("Question title","quiz-master-next"),"aria-label":(0,r.__)("Question title","quiz-master-next"),placeholder:(0,r.__)("Type your question here","quiz-master-next"),value:S,onChange:e=>m({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),x&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.RichText,{tagName:"p",title:(0,r.__)("Question description","quiz-master-next"),"aria-label":(0,r.__)("Question description","quiz-master-next"),placeholder:(0,r.__)("Description goes here","quiz-master-next"),value:_(N),onChange:e=>m({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(z)&&(0,a.createElement)(o.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(o.RichText,{tagName:"p",title:(0,r.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,r.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,r.__)("Correct answer info goes here","quiz-master-next"),value:_(T),onChange:e=>m({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(o.RichText,{tagName:"p",title:(0,r.__)("Hint","quiz-master-next"),"aria-label":(0,r.__)("Hint","quiz-master-next"),placeholder:(0,r.__)("hint goes here","quiz-master-next"),value:O,onChange:e=>m({hint:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"}))))}})}(); \ No newline at end of file +(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(o.MediaUploadCheck,{fallback:w},(0,a.createElement)(o.MediaUpload,{title:x,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&E),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),_.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:k})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,o]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,x]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),E=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,w)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},v(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},v(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>o(!r)},b)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(l)||_||(p(!0),i()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;i()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(x(e.result),y(e.result),s(""),u(0),t(a,E(term.id)),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:l,onChange:e=>((e,t)=>{t=I(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||_},b)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},k=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(k.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:r,setAttributes:m,isSelected:u,clientId:f,context:x}=e,E=(0,s.useSelect)((e=>u||e("core/block-editor").hasSelectedInnerBlock(f,!0))),w=x["quiz-master-next/quizID"],{quiz_name:k,post_id:I,rest_nonce:v}=x["quiz-master-next/quizAttr"],{createNotice:B}=(x["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{isChanged:C=!1,questionID:D,type:z,description:N,title:S,correctAnswerInfo:T,commentBox:F,category:P,multicategories:A,hint:O,featureImageID:M,featureImageSrc:R,answers:U,answerEditor:H,matchAnswer:L,required:Q}=r,j="1"==qsmBlockData.is_pro_activated,W=e=>14{let e=!0;if(e&&(d(D)||"0"==D||!d(D)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(D,f))){let e=h({id:null,rest_nonce:v,quizID:w,quiz_name:k,postID:I,answerEditor:q(H,"text"),type:q(z,"0"),name:p(q(N)),question_title:q(S),answerInfo:p(q(T)),comments:q(F,"1"),hint:q(O),category:q(P),multicategories:[],required:q(Q,1),answers:U,page:0,featureImageID:M,featureImageSrc:R,matchAnswer:null});i()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;m({questionID:t})}})).catch((e=>{console.log("error",e),B("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&u&&!1===C&&m({isChanged:!0}),()=>{e=!1}}),[D,z,N,S,T,F,P,A,O,M,R,U,H,L,Q]);const $=(0,o.useBlockProps)({className:E?" in-editing-mode":""}),J=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=J(e,t);a=[...a,...n]}return _(a)},Z=["12","7","3","5","14"].includes(z)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"";return W(z)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+D),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...$},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+S))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+D),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:z||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||j||!["15","16","17"].includes(e))m({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[z])?"":qsmBlockData.question_type_description[z]+" "+Z,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug,disabled:j&&W(e.slug)},e.name))))))),["0","4","1","10","13"].includes(z)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:H||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>m({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d(Q)&&"1"==Q,onChange:()=>m({required:d(Q)||"1"!=Q?1:0})})),(0,a.createElement)(b,{isCategorySelected:e=>A.includes(e),setUnsetCatgory:(e,t)=>{let a=d(A)||0===A.length?d(P)?[]:[P]:A;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{J(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=J(e,t);a=[...a,...n]}a=_(a),m({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(y,{featureImageID:M,onUpdateImage:e=>{m({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{m({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:F||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>m({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...$},(0,a.createElement)(o.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:S,onChange:e=>m({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),E&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here","quiz-master-next"),value:p(N),onChange:e=>m({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(z)&&(0,a.createElement)(o.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(o.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:p(T),onChange:e=>m({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(o.RichText,{tagName:"p",title:(0,n.__)("Hint","quiz-master-next"),"aria-label":(0,n.__)("Hint","quiz-master-next"),placeholder:(0,n.__)("hint goes here","quiz-master-next"),value:O,onChange:e=>m({hint:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"}))))}})}(); \ No newline at end of file diff --git a/blocks/src/edit.js b/blocks/src/edit.js index 5cd8baf3f..85b63682b 100644 --- a/blocks/src/edit.js +++ b/blocks/src/edit.js @@ -72,8 +72,17 @@ export default function Edit( props ) { /**Initialize block from server */ useEffect( () => { let shouldSetQSMAttr = true; - if ( shouldSetQSMAttr && ! qsmIsEmpty( quizID ) && 0 < quizID ) { - initializeQuizAttributes( quizID ); + if ( shouldSetQSMAttr ) { + //add upgrade modal + if ( '0' == qsmBlockData.is_pro_activated ) { + setTimeout(() => { + addUpgradePopupHtml(); + }, 100); + } + //initialize QSM block + if ( ! qsmIsEmpty( quizID ) && 0 < quizID ) { + initializeQuizAttributes( quizID ); + } } //cleanup @@ -83,6 +92,26 @@ export default function Edit( props ) { }, [ ] ); + /**Add modal advanced-question-type */ + const addUpgradePopupHtml = () => { + let modalEl = document.getElementById('modal-advanced-question-type'); + if ( qsmIsEmpty( modalEl ) ) { + apiFetch( { + path: '/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup', + method: 'POST', + } ).then( ( res ) => { + let bodyEl = document.getElementById('wpbody-content'); + if ( ! qsmIsEmpty( bodyEl ) && 'success' == res.status ) { + bodyEl.insertAdjacentHTML('afterbegin', res.result ); + } + } ).catch( + ( error ) => { + console.log( 'error',error ); + } + ); + } + } + /**Initialize quiz attributes: first time render only */ const initializeQuizAttributes = ( quiz_id ) => { if ( ! qsmIsEmpty( quiz_id ) && 0 < quiz_id ) { @@ -91,7 +120,7 @@ export default function Edit( props ) { method: 'POST', data: { quizID: quiz_id }, } ).then( ( res ) => { - console.log( "quiz render data", res ); + //console.log( "quiz render data", res ); if ( 'success' == res.status ) { let result = res.result; setAttributes( { @@ -117,7 +146,8 @@ export default function Edit( props ) { optionID:aIndex, content:answer[0], points:answer[1], - isCorrect:answer[2] + isCorrect:answer[2], + caption: qsmValueOrDefault( answer[3] ) } ] ); @@ -175,7 +205,11 @@ export default function Edit( props ) { } else { console.log( "error "+ res.msg ); } - } ); + } ).catch( + ( error ) => { + console.log( 'error',error ); + } + ); } } @@ -464,7 +498,7 @@ export default function Edit( props ) { useEffect( () => { if ( isSavingPage ) { let quizData = getQuizDataToSave(); - console.log( "quizData", quizData); + //console.log( "quizData", quizData); //save quiz status setSaveQuiz( true ); @@ -534,7 +568,7 @@ export default function Edit( props ) { method: 'POST', body: quizData } ).then( ( res ) => { - console.log( res ); + //console.log( res ); //save quiz status setSaveQuiz( false ); if ( 'success' == res.status ) { @@ -560,7 +594,7 @@ export default function Edit( props ) { method: 'POST', body: newQuestion } ).then( ( response ) => { - console.log("question response", response); + //console.log("question response", response); if ( 'success' == response.status ) { let question_id = response.id; @@ -593,7 +627,7 @@ export default function Edit( props ) { method: 'POST', body: newPage } ).then( ( pageResponse ) => { - console.log("pageResponse", pageResponse); + //console.log("pageResponse", pageResponse); if ( 'success' == pageResponse.status ) { //set new quiz initializeQuizAttributes( res.quizID ); diff --git a/blocks/src/editor.scss b/blocks/src/editor.scss index ae64b8c28..46fb18d82 100644 --- a/blocks/src/editor.scss +++ b/blocks/src/editor.scss @@ -21,7 +21,7 @@ padding: 1rem 0; } -p.qsm-error-text{ +.qsm-error-text{ color: #FD3E3E; } diff --git a/blocks/src/question/edit.js b/blocks/src/question/edit.js index 19d9032a8..c7406a236 100644 --- a/blocks/src/question/edit.js +++ b/blocks/src/question/edit.js @@ -77,6 +77,8 @@ export default function Edit( props ) { required, } = attributes; + const proActivated = ( '1' == qsmBlockData.is_pro_activated ); + const isAdvanceQuestionType = ( qtype ) => 14 < parseInt( qtype ); /**Generate question id if not set or in case duplicate questionID ***/ useEffect( () => { @@ -115,7 +117,7 @@ export default function Edit( props ) { method: 'POST', body: newQuestion } ).then( ( response ) => { - console.log("question created", response); + //console.log("question created", response); if ( 'success' == response.status ) { let question_id = response.id; setAttributes( { questionID: question_id } ); @@ -247,7 +249,33 @@ export default function Edit( props ) { //Notes relation to question type const notes = ['12','7','3','5','14'].includes( type ) ? __( 'Note: Add only correct answer options with their respective points score.', 'quiz-master-next' ) : ''; + //set Question type + const setQuestionType = ( qtype ) => { + if ( ! qsmIsEmpty( MicroModal ) && ! proActivated && ['15', '16', '17'].includes( qtype ) ) { + //Show modal for advance question type + let modalEl = document.getElementById('modal-advanced-question-type'); + if ( ! qsmIsEmpty( modalEl ) ) { + MicroModal.show('modal-advanced-question-type'); + } + } else { + setAttributes( { type: qtype } ); + } + } + return ( + isAdvanceQuestionType( type ) ? ( + <> + + +

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

+

{ __( 'Advanced Question Type', 'quiz-master-next' ) }

+
+
+
+

{ __( 'Advanced Question Type : ', 'quiz-master-next' ) + title }

+
+ + ):( <> @@ -257,7 +285,7 @@ export default function Edit( props ) { label={ qsmBlockData.question_type.label } value={ type || qsmBlockData.question_type.default } onChange={ ( type ) => - setAttributes( { type } ) + setQuestionType( type ) } help={ qsmIsEmpty( qsmBlockData.question_type_description[ type ] ) ? '' : qsmBlockData.question_type_description[ type ]+' '+notes } __nextHasNoMarginBottom @@ -265,11 +293,11 @@ export default function Edit( props ) { { ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => ( - + { qtypes.types.map( qtype => ( - + ) ) } @@ -393,5 +421,6 @@ export default function Edit( props ) { }
+ ) ); } diff --git a/php/admin/functions.php b/php/admin/functions.php index c7843ac32..58800f716 100644 --- a/php/admin/functions.php +++ b/php/admin/functions.php @@ -1155,6 +1155,21 @@ function qsm_sanitize_rec_array( $array, $textarea = false ) { return $array; } +function qsm_advance_question_type_upgrade_popup() { + $qsm_pop_up_arguments = array( + "id" => 'modal-advanced-question-type', + "title" => __('Advanced Question Types', 'quiz-master-next'), + "description" => __('Create better quizzes and surveys with the Advanced Questions addon. Incorporate precise question types like Matching Pairs, Radio Grid, and Checkbox Grid questions in your quizzes and surveys.', 'quiz-master-next'), + "chart_image" => plugins_url('', dirname(__FILE__)) . '/images/advanced_question_type.png', + "information" => __('QSM Addon Bundle is the best way to get all our add-ons at a discount. Upgrade to save 95% today OR you can buy Advanced Question Addon separately.', 'quiz-master-next'), + "buy_btn_text" => __('Buy Advanced Questions Addon', 'quiz-master-next'), + "doc_link" => qsm_get_plugin_link( 'docs/question-types', 'qsm_list', 'advance-question_type', 'advance-question-upsell_read_documentation', 'qsm_plugin_upsell' ), + "upgrade_link" => qsm_get_plugin_link( 'pricing', 'qsm_list', 'advance-question_type', 'advance-question-upsell_upgrade', 'qsm_plugin_upsell' ), + "addon_link" => qsm_get_plugin_link( 'downloads/advanced-question-types', 'qsm_list', 'advance-question_type', 'advance-question-upsell_buy_addon', 'qsm_plugin_upsell' ), + ); + qsm_admin_upgrade_popup($qsm_pop_up_arguments); +} + function qsm_admin_upgrade_popup( $args = array() ) { ?> \r\n\t\t\t);\r\n\t\t} );\r\n\t};\r\n \r\n return(\r\n \r\n \r\n\t\t\t\t{ renderTerms( categories ) }\r\n\t\t\t
\r\n
\r\n \r\n
\r\n { showForm && (\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t checkSetNewCategory( formCatName, categories ) }\r\n\t\t\t\t\t\t\trequired\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t{ 0 < categories.length && (\r\n\t\t\t\t\t\t\t setFormCatParent( id ) }\r\n\t\t\t\t\t\t\t\tselectedId={ formCatParent }\r\n\t\t\t\t\t\t\t\ttree={ categories }\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t{ addNewCategoryLabel }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n \r\n

\r\n { false !== newCategoryError && __( 'Category ', 'quiz-master-next' ) + newCategoryError + __( ' already exists.', 'quiz-master-next' ) }\r\n

\r\n
\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t) }\r\n\t\t\r\n );\r\n}\r\n\r\nexport default SelectAddCategory;","import { Icon } from '@wordpress/components';\r\n//QSM Quiz Block\r\nexport const qsmBlockIcon = () => (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const sec = Date.now() * 1000 + Math.random() * 1000;\r\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\r\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tInspectorControls,\r\n\tRichText,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n\tstore as blockEditorStore,\r\n\tBlockControls,\r\n} from '@wordpress/block-editor';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect, select } from '@wordpress/data';\r\nimport { createBlock } from '@wordpress/blocks';\r\nimport {\r\n\tPanelBody,\r\n\tToggleControl,\r\n\tSelectControl,\r\n\tToolbarGroup, \r\n\tToolbarButton,\r\n} from '@wordpress/components';\r\nimport FeaturedImage from '../component/FeaturedImage';\r\nimport SelectAddCategory from '../component/SelectAddCategory';\r\nimport { qsmIsEmpty, qsmStripTags, qsmFormData, qsmValueOrDefault, qsmDecodeHtml, qsmUniqueArray } from '../helper';\r\n\r\n\r\n//check for duplicate questionID attr\r\nconst isQuestionIDReserved = ( questionIDCheck, clientIdCheck ) => {\r\n const blocksClientIds = select( 'core/block-editor' ).getClientIdsWithDescendants();\r\n return qsmIsEmpty( blocksClientIds ) ? false : blocksClientIds.some( ( blockClientId ) => {\r\n const { questionID } = select( 'core/block-editor' ).getBlockAttributes( blockClientId );\r\n\t\t//different Client Id but same questionID attribute means duplicate\r\n return clientIdCheck !== blockClientId && questionID === questionIDCheck;\r\n } );\r\n};\r\n\r\n/**\r\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\r\n * \r\n */\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\t\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\r\n\r\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\r\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\tconst {\r\n\t\tquiz_name,\r\n\t\tpost_id,\r\n\t\trest_nonce\r\n\t} = context['quiz-master-next/quizAttr'];\r\n\tconst pageID = context['quiz-master-next/pageID'];\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\tconst { \r\n\t\tgetBlockRootClientId, \r\n\t\tgetBlockIndex \r\n\t} = useSelect( blockEditorStore );\r\n\tconst {\r\n\t\tinsertBlock\r\n\t} = useDispatch( blockEditorStore );\r\n\r\n\tconst {\r\n\t\tisChanged = false,//use in editor only to detect if any change occur in this block\r\n\t\tquestionID,\r\n\t\ttype,\r\n\t\tdescription,\r\n\t\ttitle,\r\n\t\tcorrectAnswerInfo,\r\n\t\tcommentBox,\r\n\t\tcategory,\r\n\t\tmulticategories=[],\r\n\t\thint,\r\n\t\tfeatureImageID,\r\n\t\tfeatureImageSrc,\r\n\t\tanswers,\r\n\t\tanswerEditor,\r\n\t\tmatchAnswer,\r\n\t\trequired,\r\n\t} = attributes;\r\n\t\r\n\tconst proActivated = ( '1' == qsmBlockData.is_pro_activated );\r\n\tconst isAdvanceQuestionType = ( qtype ) => 14 < parseInt( qtype );\r\n\t\r\n\t/**Generate question id if not set or in case duplicate questionID ***/\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetID = true;\r\n\t\tif ( shouldSetID ) {\r\n\t\t\r\n\t\t\tif ( qsmIsEmpty( questionID ) || '0' == questionID || ( ! qsmIsEmpty( questionID ) && isQuestionIDReserved( questionID, clientId ) ) ) {\r\n\t\t\t\t\r\n\t\t\t\t//create a question\r\n\t\t\t\tlet newQuestion = qsmFormData( {\r\n\t\t\t\t\t\"id\": null,\r\n\t\t\t\t\t\"rest_nonce\": rest_nonce,\r\n\t\t\t\t\t\"quizID\": quizID,\r\n\t\t\t\t\t\"quiz_name\": quiz_name,\r\n\t\t\t\t\t\"postID\": post_id,\r\n\t\t\t\t\t\"answerEditor\": qsmValueOrDefault( answerEditor, 'text' ),\r\n\t\t\t\t\t\"type\": qsmValueOrDefault( type , '0' ),\r\n\t\t\t\t\t\"name\": qsmDecodeHtml( qsmValueOrDefault( description ) ),\r\n\t\t\t\t\t\"question_title\": qsmValueOrDefault( title ),\r\n\t\t\t\t\t\"answerInfo\": qsmDecodeHtml( qsmValueOrDefault( correctAnswerInfo ) ),\r\n\t\t\t\t\t\"comments\": qsmValueOrDefault( commentBox, '1' ),\r\n\t\t\t\t\t\"hint\": qsmValueOrDefault( hint ),\r\n\t\t\t\t\t\"category\": qsmValueOrDefault( category ),\r\n\t\t\t\t\t\"multicategories\": [],\r\n\t\t\t\t\t\"required\": qsmValueOrDefault( required, 0 ),\r\n\t\t\t\t\t\"answers\": answers,\r\n\t\t\t\t\t\"page\": 0,\r\n\t\t\t\t\t\"featureImageID\": featureImageID,\r\n\t\t\t\t\t\"featureImageSrc\": featureImageSrc,\r\n\t\t\t\t\t\"matchAnswer\": null,\r\n\t\t\t\t} );\r\n\r\n\t\t\t\t//AJAX call\r\n\t\t\t\tapiFetch( {\r\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\r\n\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\tbody: newQuestion\r\n\t\t\t\t} ).then( ( response ) => {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ( 'success' == response.status ) {\r\n\t\t\t\t\t\tlet question_id = response.id;\r\n\t\t\t\t\t\tsetAttributes( { questionID: question_id } );\r\n\t\t\t\t\t}\r\n\t\t\t\t}).catch(\r\n\t\t\t\t\t( error ) => {\r\n\t\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetID = false;\r\n\t\t};\r\n\t\t\r\n\t}, [] );\r\n\r\n\t//detect change in question\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetChanged = true;\r\n\t\tif ( shouldSetChanged && isSelected && false === isChanged ) {\r\n\t\t\t\r\n\t\t\tsetAttributes( { isChanged: true } );\r\n\t\t}\r\n\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetChanged = false;\r\n\t\t};\r\n\t}, [\r\n\t\tquestionID,\r\n\t\ttype,\r\n\t\tdescription,\r\n\t\ttitle,\r\n\t\tcorrectAnswerInfo,\r\n\t\tcommentBox,\r\n\t\tcategory,\r\n\t\tmulticategories,\r\n\t\thint,\r\n\t\tfeatureImageID,\r\n\t\tfeatureImageSrc,\r\n\t\tanswers,\r\n\t\tanswerEditor,\r\n\t\tmatchAnswer,\r\n\t\trequired,\r\n\t] )\r\n\r\n\t//add classes\r\n\tconst blockProps = useBlockProps( {\r\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\r\n\t} );\r\n\r\n\tconst QUESTION_TEMPLATE = [\r\n\t\t[\r\n\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t{\r\n\t\t\t\toptionID:'0'\r\n\t\t\t}\r\n\t\t],\r\n\t\t[\r\n\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t{\r\n\t\t\t\toptionID:'1'\r\n\t\t\t}\r\n\t\t]\r\n\r\n\t];\r\n\r\n\t//Get category ancestor\r\n\tconst getCategoryAncestors = ( termId, categories ) => {\r\n\t\tlet parents = [];\r\n\t\tif ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) {\r\n\t\t\ttermId = categories[ termId ]['parent'];\r\n\t\t\tparents.push( termId );\r\n\t\t\tif ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) {\r\n\t\t\t\tlet ancestor = getCategoryAncestors( termId, categories );\r\n\t\t\t\tparents = [ ...parents, ...ancestor ];\r\n\t\t\t}\r\n\t\t} \r\n\t\t\r\n\t\treturn qsmUniqueArray( parents );\r\n\t }\r\n\r\n\t//check if a category is selected\r\n\tconst isCategorySelected = ( termId ) => multicategories.includes( termId );\r\n\r\n\t//set or unset category\r\n\tconst setUnsetCatgory = ( termId, categories ) => {\r\n\t\tlet multiCat = ( qsmIsEmpty( multicategories ) || 0 === multicategories.length ) ? ( qsmIsEmpty( category ) ? [] : [ category ] ) : multicategories;\r\n\t\t\r\n\t\t//Case: category unselected\r\n\t\tif ( multiCat.includes( termId ) ) {\r\n\t\t\t//remove category if already set\r\n\t\t\tmultiCat = multiCat.filter( catID => catID != termId );\r\n\t\t\tlet children = [];\r\n\t\t\t//check for if any child is selcted \r\n\t\t\tmultiCat.forEach( childCatID => {\r\n\t\t\t\t//get ancestors of category\r\n\t\t\t\tlet ancestorIds = getCategoryAncestors( childCatID, categories );\r\n\t\t\t\t//given unselected category is an ancestor of selected category\r\n\t\t\t\tif ( ancestorIds.includes( termId ) ) {\r\n\t\t\t\t\t//remove category if already set\r\n\t\t\t\t\tmultiCat = multiCat.filter( catID => catID != childCatID );\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t//add category if not set\r\n\t\t\tmultiCat.push( termId );\r\n\t\t\t//get ancestors of category\r\n\t\t\tlet ancestorIds = getCategoryAncestors( termId, categories );\r\n\t\t\t//select all ancestor\r\n\t\t\tmultiCat = [ ...multiCat, ...ancestorIds ];\r\n\t\t}\r\n\r\n\t\tmultiCat = qsmUniqueArray( multiCat );\r\n\r\n\t\tsetAttributes({ \r\n\t\t\tcategory: '',\r\n\t\t\tmulticategories: [ ...multiCat ]\r\n\t\t});\r\n\t}\r\n\r\n\t//Notes relation to question type\r\n\tconst notes = ['12','7','3','5','14'].includes( type ) ? __( 'Note: Add only correct answer options with their respective points score.', 'quiz-master-next' ) : '';\r\n\r\n\t//set Question type\r\n\tconst setQuestionType = ( qtype ) => {\r\n\t\tif ( ! qsmIsEmpty( MicroModal ) && ! proActivated && ['15', '16', '17'].includes( qtype ) ) {\r\n\t\t\t//Show modal for advance question type\r\n\t\t\tlet modalEl = document.getElementById('modal-advanced-question-type');\r\n\t\t\tif ( ! qsmIsEmpty( modalEl ) ) {\r\n\t\t\t\tMicroModal.show('modal-advanced-question-type');\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tsetAttributes( { type: qtype } );\r\n\t\t}\r\n\t}\r\n\r\n\tconst insertNewQuestion = () => {\r\n\t\tif ( qsmIsEmpty( props?.name )) {\r\n\t\t\tconsole.log(\"block name not found\");\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tconst blockToInsert = createBlock( props.name );\r\n\t\tconst selectBlockOnInsert = true;\r\n\t\tinsertBlock(\r\n\t\t\tblockToInsert,\r\n\t\t\tgetBlockIndex( clientId ) + 1,\r\n\t\t\tgetBlockRootClientId( clientId ),\r\n\t\t\tselectBlockOnInsert\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t<>\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t insertNewQuestion() }\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t\r\n\t { isAdvanceQuestionType( type ) ? (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\r\n\t\t\t\t\t

{ __( 'Advanced Question Type', 'quiz-master-next' ) }

\r\n\t\t\t\t
\r\n\t\t\t
\t\r\n\t\t\t
\r\n\t\t\t

{ __( 'Advanced Question Type : ', 'quiz-master-next' ) + title }

\r\n\t\t\t
\r\n\t\t\r\n\t\t):(\r\n\t\t<>\r\n\t\t\r\n\t\t\t\r\n\t\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\r\n\t\t\t{ /** Question Type **/ }\r\n\t\t\t\r\n\t\t\t\t\tsetQuestionType( type )\r\n\t\t\t\t}\r\n\t\t\t\thelp={ qsmIsEmpty( qsmBlockData.question_type_description[ type ] ) ? '' : qsmBlockData.question_type_description[ type ]+' '+notes }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t>\r\n\t\t\t\t{\r\n\t\t\t\t! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \r\n\t\t\t\t\t(\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tqtypes.types.map( qtype => \r\n\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t)\r\n\t\t\t\t\t)\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t{/**Answer Type */}\r\n\t\t\t{\r\n\t\t\t\t['0','4','1','10','13'].includes( type ) && \r\n\t\t\t\t\r\n\t\t\t\t\t\tsetAttributes( { answerEditor } )\r\n\t\t\t\t\t}\r\n\t\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\t setAttributes( { required : ( ( ! qsmIsEmpty( required ) && '1' == required ) ? 0 : 1 ) } ) }\r\n\t\t\t/>\r\n\t\t\t
\r\n\t\t\t{/**Categories */}\r\n\t\t\t\r\n\t\t\t{/**Feature Image */}\r\n\t\t\t\r\n\t\t\t\t {\r\n\t\t\t\t\tsetAttributes({ \r\n\t\t\t\t\t\tfeatureImageID: mediaDetails.id,\r\n\t\t\t\t\t\tfeatureImageSrc: mediaDetails.url\r\n\t\t\t\t\t});\r\n\t\t\t\t} }\r\n\t\t\t\tonRemoveImage={ ( id ) => {\r\n\t\t\t\t\tsetAttributes({ \r\n\t\t\t\t\t\tfeatureImageID: undefined,\r\n\t\t\t\t\t\tfeatureImageSrc: undefined,\r\n\t\t\t\t\t});\r\n\t\t\t\t} }\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t\t{/**Comment Box */}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\tsetAttributes( { commentBox } )\r\n\t\t\t\t}\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t\t\r\n\t\t
\r\n\t\t
\r\n\t\t\t setAttributes( { title: qsmStripTags( title ) } ) }\r\n\t\t\t\tallowedFormats={ [ ] }\r\n\t\t\t\twithoutInteractiveFormatting\r\n\t\t\t\tclassName={ 'qsm-question-title' }\r\n\t\t\t/>\r\n\t\t\t{\r\n\t\t\t\tisParentOfSelectedBlock && \r\n\t\t\t\t<>\r\n\t\t\t\t setAttributes({ description }) }\r\n\t\t\t\t\tclassName={ 'qsm-question-description' }\r\n\t\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t\t/>\r\n\t\t\t\t{\r\n\t\t\t\t\t! ['8','11','6','9'].includes( type ) &&\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t setAttributes({ correctAnswerInfo }) }\r\n\t\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\r\n\t\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t\t/>\r\n\t\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\r\n\t\t\t\t\tallowedFormats={ [ ] }\r\n\t\t\t\t\twithoutInteractiveFormatting\r\n\t\t\t\t\tclassName={ 'qsm-question-hint' }\r\n\t\t\t\t/>\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t
\r\n\t\t\r\n\t\t)\r\n\t}\r\n\t\r\n\t);\r\n}\r\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blob\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"hooks\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { questionBlockIcon } from \"../component/icon\";\r\n\r\nregisterBlockType( metadata.name, {\r\n\ticon:questionBlockIcon,\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n} );\r\n"],"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","ResponsiveWrapper","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","useEffect","store","noticesStore","useDispatch","useSelect","select","withDispatch","withSelect","MediaUpload","MediaUploadCheck","blockEditorStore","coreStore","qsmIsEmpty","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","createElement","FeaturedImage","featureImageID","onUpdateImage","onRemoveImage","createNotice","toggleRef","isLoading","setIsLoading","media","setMedia","undefined","mediaFeature","mediaUpload","getMedia","getSettings","shouldSetQSMAttr","id","width","media_details","height","url","source_url","alt_text","slug","onDropFiles","filesList","allowedTypes","onFileChange","image","onError","message","isDismissible","type","className","fallback","title","onSelect","unstableFeaturedImageFlow","modalClass","render","open","ref","onClick","naturalWidth","naturalHeight","isInline","src","alt","current","focus","onFilesDrop","value","apiFetch","PanelBody","TreeSelect","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","CheckboxControl","Flex","FlexItem","qsmFormData","SelectAddCategory","isCategorySelected","setUnsetCatgory","showForm","setShowForm","formCatName","setFormCatName","formCatParent","setFormCatParent","addingNewCategory","setAddingNewCategory","newCategoryError","setNewCategoryError","categories","setCategories","qsmBlockData","hierarchicalCategoryList","getCategoryIdDetailsObject","catObj","forEach","cat","children","length","childCategory","categoryIdDetails","setCategoryIdDetails","addNewCategoryLabel","noParentOption","onAddCategory","event","preventDefault","ajax_url","method","body","then","res","term_id","path","status","result","term","getCategoryNameArray","cats","push","name","checkSetNewCategory","catName","console","log","includes","renderTerms","map","key","label","checked","onChange","initialOpen","tabIndex","role","variant","onSubmit","direction","gap","__nextHasNoMarginBottom","required","noOptionLabel","selectedId","tree","disabled","Icon","qsmBlockIcon","icon","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","data","qsmUniqueArray","arr","Array","isArray","filter","val","index","indexOf","qsmDecodeHtml","html","txt","document","innerHTML","qsmSanitizeName","toLowerCase","replace","qsmStripTags","text","div","innerText","obj","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmUniqid","prefix","random","sec","Date","now","Math","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","InspectorControls","RichText","InnerBlocks","useBlockProps","BlockControls","createBlock","ToolbarGroup","ToolbarButton","isQuestionIDReserved","questionIDCheck","clientIdCheck","blocksClientIds","getClientIdsWithDescendants","some","blockClientId","questionID","getBlockAttributes","Edit","props","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","hasSelectedInnerBlock","quizID","quiz_name","post_id","rest_nonce","pageID","getBlockRootClientId","getBlockIndex","insertBlock","isChanged","description","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageSrc","answers","answerEditor","matchAnswer","proActivated","is_pro_activated","isAdvanceQuestionType","qtype","parseInt","shouldSetID","newQuestion","response","question_id","catch","error","shouldSetChanged","blockProps","QUESTION_TEMPLATE","optionID","getCategoryAncestors","termId","parents","ancestor","multiCat","catID","childCatID","ancestorIds","notes","setQuestionType","MicroModal","modalEl","getElementById","show","insertNewQuestion","blockToInsert","selectBlockOnInsert","Fragment","question_type","default","help","question_type_description","options","qtypes","types","mediaDetails","heading","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/style-index.css b/blocks/build/style-index.css index 8b1378917..74830d632 100644 --- a/blocks/build/style-index.css +++ b/blocks/build/style-index.css @@ -1 +1,11 @@ +/*!***************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! + \***************************************************************************************************************************************************************************************************************************************/ +/** + * The following styles get applied both on the front of your site + * and in the editor. + * + * Replace them with your own styles or remove the file completely. + */ +/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/blocks/build/style-index.css.map b/blocks/build/style-index.css.map new file mode 100644 index 000000000..69cae5f30 --- /dev/null +++ b/blocks/build/style-index.css.map @@ -0,0 +1 @@ +{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA,C","sources":["webpack://qsm/./src/style.scss"],"sourcesContent":["/**\r\n * The following styles get applied both on the front of your site\r\n * and in the editor.\r\n *\r\n * Replace them with your own styles or remove the file completely.\r\n */\r\n\r\n// .wp-block-qsm-main-block {\r\n// \tbackground-color: #21759b;\r\n// \tcolor: #fff;\r\n// \tpadding: 2px;\r\n// }\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/src/answer-option/edit.js b/blocks/src/answer-option/edit.js index dfa01edd3..ddabad4c1 100644 --- a/blocks/src/answer-option/edit.js +++ b/blocks/src/answer-option/edit.js @@ -99,7 +99,7 @@ onRemove } = props; }, [ answerType ] ); const blockProps = useBlockProps( { - className: '', + className: isSelected ? ' is-highlighted ': '', } ); const inputType = ['4','10'].includes( questionType ) ? "checkbox":"radio"; diff --git a/blocks/src/block.json b/blocks/src/block.json index a2ac71a37..448069156 100644 --- a/blocks/src/block.json +++ b/blocks/src/block.json @@ -3,7 +3,7 @@ "apiVersion": 3, "name": "qsm/quiz", "version": "0.1.0", - "title": "Quiz", + "title": "QSM", "category": "widgets", "keywords": [ "Quiz", "QSM Quiz", "Survey", "form", "Quiz Block" ], "icon": "vault", @@ -13,6 +13,9 @@ "type": "number", "default": 0 }, + "postID": { + "type": "number" + }, "quizAttr": { "type": "object" } diff --git a/blocks/src/component/icon.js b/blocks/src/component/icon.js index 6a54b78b8..88266e4a3 100644 --- a/blocks/src/component/icon.js +++ b/blocks/src/component/icon.js @@ -3,12 +3,10 @@ import { Icon } from '@wordpress/components'; export const qsmBlockIcon = () => ( ( - - - - - - + + + + ) } /> ); @@ -17,10 +15,9 @@ export const qsmBlockIcon = () => ( export const questionBlockIcon = () => ( ( - - - - + + + ) } /> @@ -31,12 +28,9 @@ export const answerOptionBlockIcon = () => ( ( - - - - - - + + + ) } /> ); \ No newline at end of file diff --git a/blocks/src/edit.js b/blocks/src/edit.js index f4add6fc6..43415872a 100644 --- a/blocks/src/edit.js +++ b/blocks/src/edit.js @@ -15,18 +15,16 @@ import { store as editorStore } from '@wordpress/editor'; import { PanelBody, Button, - PanelRow, TextControl, ToggleControl, - RangeControl, - RadioControl, SelectControl, Placeholder, - Icon, + ExternalLink, __experimentalVStack as VStack, } from '@wordpress/components'; import './editor.scss'; import { qsmIsEmpty, qsmFormData, qsmUniqid, qsmValueOrDefault, qsmDecodeHtml } from './helper'; +import { qsmBlockIcon } from './component/icon'; export default function Edit( props ) { //check for QSM initialize data if ( 'undefined' === typeof qsmBlockData ) { @@ -39,6 +37,7 @@ export default function Edit( props ) { const globalQuizsetting = qsmBlockData.globalQuizsetting; const { quizID, + postID, quizAttr = globalQuizsetting } = attributes; @@ -81,7 +80,26 @@ export default function Edit( props ) { } //initialize QSM block if ( ! qsmIsEmpty( quizID ) && 0 < quizID ) { - initializeQuizAttributes( quizID ); + //Check if quiz exists + let hasQuiz = false; + quizList.forEach( quizElement => { + if ( quizID == quizElement.value ) { + hasQuiz = true; + return true; + } + }); + if ( hasQuiz ) { + initializeQuizAttributes( quizID ); + } else { + setAttributes({ + quizID : undefined + }); + setQuizMessage( { + error: true, + msg: __( 'Quiz not found. Please select an existing quiz or create a new one.', 'quiz-master-next' ) + } ); + } + } } @@ -120,11 +138,16 @@ export default function Edit( props ) { method: 'POST', data: { quizID: quiz_id }, } ).then( ( res ) => { - //console.log( "quiz render data", res ); + if ( 'success' == res.status ) { + setQuizMessage( { + error: false, + msg: '' + } ); let result = res.result; setAttributes( { quizID: parseInt( quiz_id ), + postID: result.post_id, quizAttr: { ...quizAttr, ...result } } ); if ( ! qsmIsEmpty( result.qpages ) ) { @@ -181,7 +204,7 @@ export default function Edit( props ) { } }); } - //console.log("page",page); + quizTemp.push( [ 'qsm/quiz-page', @@ -197,11 +220,7 @@ export default function Edit( props ) { }); setQuizTemplate( quizTemp ); } - // QSM_QUIZ = [ - // [ - - // ] - // ]; + } else { console.log( "error "+ res.msg ); } @@ -213,16 +232,6 @@ export default function Edit( props ) { } } - /** - * vault dash Icon - * @returns vault dash Icon - */ - const feedbackIcon = () => ( - - ); /** * @@ -231,7 +240,8 @@ export default function Edit( props ) { const quizPlaceholder = ( ) => { return ( @@ -339,6 +349,11 @@ export default function Edit( props ) { } + { + quizMessage.error && ( +

{ quizMessage.msg }

+ ) + } }
@@ -365,7 +380,7 @@ export default function Edit( props ) { if ( qsmIsEmpty( blocks ) ) { return false; } - //console.log( "blocks", blocks); + blocks = blocks.innerBlocks; let quizDataToSave = { quiz_id: quizAttr.quiz_id, @@ -435,11 +450,14 @@ export default function Edit( props ) { "hint": qsmValueOrDefault( questionAttr?.hint ), "category": qsmValueOrDefault( questionAttr?.category ), "multicategories": qsmValueOrDefault( questionAttr?.multicategories, [] ), - "required": qsmValueOrDefault( questionAttr?.required, 1 ), + "required": qsmValueOrDefault( questionAttr?.required, 0 ), "answers": answers, "featureImageID":qsmValueOrDefault( questionAttr?.featureImageID ), "featureImageSrc":qsmValueOrDefault( questionAttr?.featureImageSrc ), - "page": pageSNo + "page": pageSNo, + "other_settings": { + "required": qsmValueOrDefault( questionAttr?.required, 0 ) + } }); } @@ -498,7 +516,6 @@ export default function Edit( props ) { useEffect( () => { if ( isSavingPage ) { let quizData = getQuizDataToSave(); - //console.log( "quizData", quizData); //save quiz status setSaveQuiz( true ); @@ -568,7 +585,6 @@ export default function Edit( props ) { method: 'POST', body: quizData } ).then( ( res ) => { - //console.log( res ); //save quiz status setSaveQuiz( false ); if ( 'success' == res.status ) { @@ -594,7 +610,7 @@ export default function Edit( props ) { method: 'POST', body: newQuestion } ).then( ( response ) => { - //console.log("question response", response); + if ( 'success' == response.status ) { let question_id = response.id; @@ -627,7 +643,7 @@ export default function Edit( props ) { method: 'POST', body: newPage } ).then( ( pageResponse ) => { - //console.log("pageResponse", pageResponse); + if ( 'success' == pageResponse.status ) { //set new quiz initializeQuizAttributes( res.quizID ); @@ -681,12 +697,30 @@ export default function Edit( props ) { <> + + setQuizAttributes( val, 'quiz_name') } + className='qsm-no-mb' /> + { + ( ! qsmIsEmpty( quizID ) || '0' != quizID ) && +

+ +

+ }
{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? diff --git a/blocks/src/editor.scss b/blocks/src/editor.scss index 46fb18d82..eef81caa9 100644 --- a/blocks/src/editor.scss +++ b/blocks/src/editor.scss @@ -7,6 +7,28 @@ $qsm_primary_color: #666666; $qsm_wp_primary_color : #1f8cbe; +.block-editor-block-inspector{ + .qsm-inspector-label{ + font-size: 11px; + font-weight: 500; + line-height: 1.4; + text-transform: uppercase; + display: inline-block; + margin-bottom: 0.5rem; + padding: 0px; + .qsm-inspector-label-value{ + padding-left: 0.5rem; + } + } + .qsm-inspector-label-value{ + font-weight: 400; + text-transform: capitalize; + } + + .qsm-no-mb{ + margin-bottom: 0; + } +} .qsm-placeholder-select-create-quiz{ display: flex; gap: 1rem; @@ -25,6 +47,15 @@ color: #FD3E3E; } +//Create or select quiz placeholder +.editor-styles-wrapper { + .qsm-placeholder-wrapper{ + .components-placeholder__fieldset { + flex-direction: column; + } + } +} + .qsm-placeholder-quiz-create-form{ width: 50%; .components-button{ diff --git a/blocks/src/question/edit.js b/blocks/src/question/edit.js index b4def9fa8..6eb2458dd 100644 --- a/blocks/src/question/edit.js +++ b/blocks/src/question/edit.js @@ -6,18 +6,18 @@ import { RichText, InnerBlocks, useBlockProps, + store as blockEditorStore, + BlockControls, } from '@wordpress/block-editor'; import { store as noticesStore } from '@wordpress/notices'; import { useDispatch, useSelect, select } from '@wordpress/data'; +import { createBlock } from '@wordpress/blocks'; import { PanelBody, - PanelRow, - TextControl, ToggleControl, - RangeControl, - RadioControl, SelectControl, - CheckboxControl, + ToolbarGroup, + ToolbarButton, } from '@wordpress/components'; import FeaturedImage from '../component/FeaturedImage'; import SelectAddCategory from '../component/SelectAddCategory'; @@ -57,6 +57,13 @@ export default function Edit( props ) { } = context['quiz-master-next/quizAttr']; const pageID = context['quiz-master-next/pageID']; const { createNotice } = useDispatch( noticesStore ); + const { + getBlockRootClientId, + getBlockIndex + } = useSelect( blockEditorStore ); + const { + insertBlock + } = useDispatch( blockEditorStore ); const { isChanged = false,//use in editor only to detect if any change occur in this block @@ -103,7 +110,7 @@ export default function Edit( props ) { "hint": qsmValueOrDefault( hint ), "category": qsmValueOrDefault( category ), "multicategories": [], - "required": qsmValueOrDefault( required, 1 ), + "required": qsmValueOrDefault( required, 0 ), "answers": answers, "page": 0, "featureImageID": featureImageID, @@ -117,7 +124,7 @@ export default function Edit( props ) { method: 'POST', body: newQuestion } ).then( ( response ) => { - //console.log("question created", response); + if ( 'success' == response.status ) { let question_id = response.id; setAttributes( { questionID: question_id } ); @@ -145,7 +152,7 @@ export default function Edit( props ) { useEffect( () => { let shouldSetChanged = true; if ( shouldSetChanged && isSelected && false === isChanged ) { - //console.log("changed question", questionID ); + setAttributes( { isChanged: true } ); } @@ -262,165 +269,192 @@ export default function Edit( props ) { } } + const insertNewQuestion = () => { + if ( qsmIsEmpty( props?.name )) { + console.log("block name not found"); + return true; + } + const blockToInsert = createBlock( props.name ); + const selectBlockOnInsert = true; + insertBlock( + blockToInsert, + getBlockIndex( clientId ) + 1, + getBlockRootClientId( clientId ), + selectBlockOnInsert + ); + } + return ( - isAdvanceQuestionType( type ) ? ( <> - - -

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

-

{ __( 'Advanced Question Type', 'quiz-master-next' ) }

-
-
-
-

{ __( 'Advanced Question Type : ', 'quiz-master-next' ) + title }

-
- - ):( - <> - - -

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

- { /** Question Type **/ } - - setQuestionType( type ) - } - help={ qsmIsEmpty( qsmBlockData.question_type_description[ type ] ) ? '' : qsmBlockData.question_type_description[ type ]+' '+notes } - __nextHasNoMarginBottom - > - { - ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => - ( - - { - qtypes.types.map( qtype => - ( - + + + insertNewQuestion() } + /> + + + { isAdvanceQuestionType( type ) ? ( + <> + + +

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

+

{ __( 'Advanced Question Type', 'quiz-master-next' ) }

+
+
+
+

{ __( 'Advanced Question Type : ', 'quiz-master-next' ) + title }

+
+ + ):( + <> + + +

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

+ { /** Question Type **/ } + + setQuestionType( type ) + } + help={ qsmIsEmpty( qsmBlockData.question_type_description[ type ] ) ? '' : qsmBlockData.question_type_description[ type ]+' '+notes } + __nextHasNoMarginBottom + > + { + ! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => + ( + + { + qtypes.types.map( qtype => + ( + + ) ) - ) + } + + ) + ) + } + + {/**Answer Type */} + { + ['0','4','1','10','13'].includes( type ) && + + setAttributes( { answerEditor } ) } -
- ) - ) + __nextHasNoMarginBottom + /> } -
- {/**Answer Type */} - { - ['0','4','1','10','13'].includes( type ) && + setAttributes( { required : ( ( ! qsmIsEmpty( required ) && '1' == required ) ? 0 : 1 ) } ) } + /> +
+ {/**Categories */} + + {/**Feature Image */} + + { + setAttributes({ + featureImageID: mediaDetails.id, + featureImageSrc: mediaDetails.url + }); + } } + onRemoveImage={ ( id ) => { + setAttributes({ + featureImageID: undefined, + featureImageSrc: undefined, + }); + } } + /> + + {/**Comment Box */} + - setAttributes( { answerEditor } ) + label={ qsmBlockData.commentBox.label } + value={ commentBox || qsmBlockData.commentBox.default } + options={ qsmBlockData.commentBox.options } + onChange={ ( commentBox ) => + setAttributes( { commentBox } ) } __nextHasNoMarginBottom /> - } - setAttributes( { required : ( ( ! qsmIsEmpty( required ) && '1' == required ) ? 0 : 1 ) } ) } - /> - - {/**Categories */} - - {/**Feature Image */} - - { - setAttributes({ - featureImageID: mediaDetails.id, - featureImageSrc: mediaDetails.url - }); - } } - onRemoveImage={ ( id ) => { - setAttributes({ - featureImageID: undefined, - featureImageSrc: undefined, - }); - } } - /> - - {/**Comment Box */} - - - setAttributes( { commentBox } ) - } - __nextHasNoMarginBottom - /> - -
-
- setAttributes( { title: qsmStripTags( title ) } ) } - allowedFormats={ [ ] } - withoutInteractiveFormatting - className={ 'qsm-question-title' } - /> - { - isParentOfSelectedBlock && - <> + + +
setAttributes({ description }) } - className={ 'qsm-question-description' } - __unstableEmbedURLOnPaste - __unstableAllowPrefixTransformations + tagName='h4' + title={ __( 'Question title', 'quiz-master-next' ) } + aria-label={ __( 'Question title', 'quiz-master-next' ) } + placeholder={ __( 'Type your question here', 'quiz-master-next' ) } + value={ title } + onChange={ ( title ) => setAttributes( { title: qsmStripTags( title ) } ) } + allowedFormats={ [ ] } + withoutInteractiveFormatting + className={ 'qsm-question-title' } /> { - ! ['8','11','6','9'].includes( type ) && - + setAttributes({ description }) } + className={ 'qsm-question-description' } + __unstableEmbedURLOnPaste + __unstableAllowPrefixTransformations + /> + { + ! ['8','11','6','9'].includes( type ) && + + } + + setAttributes({ correctAnswerInfo }) } + className={ 'qsm-question-correct-answer-info' } + __unstableEmbedURLOnPaste + __unstableAllowPrefixTransformations + /> + setAttributes( { hint: qsmStripTags( hint ) } ) } + allowedFormats={ [ ] } + withoutInteractiveFormatting + className={ 'qsm-question-hint' } /> + } - - setAttributes({ correctAnswerInfo }) } - className={ 'qsm-question-correct-answer-info' } - __unstableEmbedURLOnPaste - __unstableAllowPrefixTransformations - /> - setAttributes( { hint: qsmStripTags( hint ) } ) } - allowedFormats={ [ ] } - withoutInteractiveFormatting - className={ 'qsm-question-hint' } - /> - - } -
+
+ + ) + } - ) ); } From d4373e65df28db67fae8d9d20be5812c82884958 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Fri, 8 Mar 2024 18:02:56 +0530 Subject: [PATCH 14/27] prepare block build --- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 880 +-------------- blocks/build/answer-option/index.js.map | 1 - blocks/build/index.asset.php | 2 +- blocks/build/index.css | 84 +- blocks/build/index.css.map | 1 - blocks/build/index.js | 1132 +------------------ blocks/build/index.js.map | 1 - blocks/build/page/index.asset.php | 2 +- blocks/build/page/index.js | 337 +----- blocks/build/page/index.js.map | 1 - blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 1181 +------------------- blocks/build/question/index.js.map | 1 - blocks/build/style-index.css | 10 - blocks/build/style-index.css.map | 1 - 16 files changed, 13 insertions(+), 3625 deletions(-) delete mode 100644 blocks/build/answer-option/index.js.map delete mode 100644 blocks/build/index.css.map delete mode 100644 blocks/build/index.js.map delete mode 100644 blocks/build/page/index.js.map delete mode 100644 blocks/build/question/index.js.map delete mode 100644 blocks/build/style-index.css.map diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index dc7e70c12..f36f05282 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'd41cf01389963657177f'); + array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => '2fa909fa636c97d43e0e'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index 1f18af893..ad95eb322 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -1,879 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./node_modules/@wordpress/icons/build-module/library/image.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@wordpress/icons/build-module/library/image.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/primitives */ "@wordpress/primitives"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - -/** - * WordPress dependencies - */ - -const image = (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.SVG, { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.Path, { - d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" -})); -/* harmony default export */ __webpack_exports__["default"] = (image); -//# sourceMappingURL=image.js.map - -/***/ }), - -/***/ "./src/answer-option/edit.js": -/*!***********************************!*\ - !*** ./src/answer-option/edit.js ***! - \***********************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); -/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/escape-html */ "@wordpress/escape-html"); -/* harmony import */ var _wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _component_ImageType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../component/ImageType */ "./src/component/ImageType.js"); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - - - - - - - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId, - context, - mergeBlocks, - onReplace, - onRemove - } = props; - const quizID = context['quiz-master-next/quizID']; - const pageID = context['quiz-master-next/pageID']; - const questionID = context['quiz-master-next/questionID']; - const questionType = context['quiz-master-next/questionType']; - const answerType = context['quiz-master-next/answerType']; - const questionChanged = context['quiz-master-next/questionChanged']; - const name = 'qsm/quiz-answer-option'; - const { - optionID, - content, - caption, - points, - isCorrect - } = attributes; - const { - selectBlock - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); - - //Use to to update block attributes using clientId - const { - updateBlockAttributes - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); - const questionClientID = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { - //get parent gutena form clientIds - let questionClientID = select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store).getBlockParentsByBlockName(clientId, 'qsm/quiz-question', true); - return (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionClientID) ? '' : questionClientID[0]; - }, [clientId]); - - //detect change in question - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetChanged = true; - if (shouldSetChanged && isSelected && !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionClientID) && false === questionChanged) { - updateBlockAttributes(questionClientID, { - isChanged: true - }); - } - - //cleanup - return () => { - shouldSetChanged = false; - }; - }, [content, caption, points, isCorrect]); - - /**Initialize block from server */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(content) && (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_6__.isURL)(content) && (-1 !== content.indexOf('https://') || -1 !== content.indexOf('http://')) && ['rich', 'text'].includes(answerType)) { - setAttributes({ - content: '', - caption: '' - }); - } - } - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, [answerType]); - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)({ - className: isSelected ? ' is-highlighted ' : '' - }); - const inputType = ['4', '10'].includes(questionType) ? "checkbox" : "radio"; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Settings', 'quiz-master-next'), - initialOpen: true - }, /**Image answer option */ - 'image' === answerType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - type: "text", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Caption', 'quiz-master-next'), - value: caption, - onChange: caption => setAttributes({ - caption: (0,_wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3__.escapeAttribute)(caption) - }) - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - type: "number", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Points', 'quiz-master-next'), - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer points', 'quiz-master-next'), - value: points, - onChange: points => setAttributes({ - points - }) - }), ['0', '4', '1', '10', '2'].includes(questionType) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct', 'quiz-master-next'), - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(isCorrect) && '1' == isCorrect, - onChange: () => setAttributes({ - isCorrect: !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(isCorrect) && '1' == isCorrect ? 0 : 1 - }) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.__experimentalHStack, { - className: "edit-post-document-actions__title", - spacing: 1, - justify: "left" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("input", { - type: inputType, - readOnly: true, - tabIndex: "-1" - }), /**Text answer option*/ - !['rich', 'image'].includes(answerType) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer options', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question answer', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Your Answer', 'quiz-master-next'), - value: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmStripTags)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(content)), - onChange: content => setAttributes({ - content: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmStripTags)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(content)) - }), - onSplit: (value, isOriginal) => { - let newAttributes; - if (isOriginal || value) { - newAttributes = { - ...attributes, - content: value - }; - } - const block = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__.createBlock)(name, newAttributes); - if (isOriginal) { - block.clientId = clientId; - } - return block; - }, - onMerge: mergeBlocks, - onReplace: onReplace, - onRemove: onRemove, - allowedFormats: [], - withoutInteractiveFormatting: true, - className: 'qsm-question-answer-option', - identifier: "text" - }), /**Rich Text answer option */ - 'rich' === answerType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer options', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question answer', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Your Answer', 'quiz-master-next'), - value: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(content)), - onChange: content => setAttributes({ - content - }), - onSplit: (value, isOriginal) => { - let newAttributes; - if (isOriginal || value) { - newAttributes = { - ...attributes, - content: value - }; - } - const block = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__.createBlock)(name, newAttributes); - if (isOriginal) { - block.clientId = clientId; - } - return block; - }, - onMerge: mergeBlocks, - onReplace: onReplace, - onRemove: onRemove, - className: 'qsm-question-answer-option', - identifier: "text", - __unstableEmbedURLOnPaste: true, - __unstableAllowPrefixTransformations: true - }), /**Image answer option */ - 'image' === answerType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_ImageType__WEBPACK_IMPORTED_MODULE_9__["default"], { - url: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_6__.isURL)(content) ? content : '', - caption: caption, - setURLCaption: (url, caption) => setAttributes({ - content: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_6__.isURL)(url) ? url : '', - caption: caption - }) - })))); -} - -/***/ }), - -/***/ "./src/component/ImageType.js": -/*!************************************!*\ - !*** ./src/component/ImageType.js ***! - \************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ ImageType: function() { return /* binding */ ImageType; }, -/* harmony export */ isExternalImage: function() { return /* binding */ isExternalImage; }, -/* harmony export */ pickRelevantMediaFiles: function() { return /* binding */ pickRelevantMediaFiles; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blob */ "@wordpress/blob"); -/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/@wordpress/icons/build-module/library/image.js"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - -/** - * Image Component: Upload, Use media, external image url - */ - - - - - - - - - - -const pickRelevantMediaFiles = (image, size) => { - const imageProps = Object.fromEntries(Object.entries(image !== null && image !== void 0 ? image : {}).filter(([key]) => ['alt', 'id', 'link', 'caption'].includes(key))); - imageProps.url = image?.sizes?.[size]?.url || image?.media_details?.sizes?.[size]?.source_url || image.url; - return imageProps; -}; - -/** - * Is the URL a temporary blob URL? A blob URL is one that is used temporarily - * while the image is being uploaded and will not have an id yet allocated. - * - * @param {number=} id The id of the image. - * @param {string=} url The url of the image. - * - * @return {boolean} Is the URL a Blob URL - */ -const isTemporaryImage = (id, url) => !id && (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.isBlobURL)(url); - -/** - * Is the url for the image hosted externally. An externally hosted image has no - * id and is not a blob url. - * - * @param {number=} id The id of the image. - * @param {string=} url The url of the image. - * - * @return {boolean} Is the url an externally hosted url? - */ -const isExternalImage = (id, url) => url && !id && !(0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.isBlobURL)(url); -function ImageType({ - url = '', - caption = '', - alt = '', - setURLCaption -}) { - const ALLOWED_MEDIA_TYPES = ['image']; - const [id, setId] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); - const [temporaryURL, setTemporaryURL] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(); - const ref = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(); - const { - imageDefaultSize, - mediaUpload - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useSelect)(select => { - const { - getSettings - } = select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); - const settings = getSettings(); - return { - imageDefaultSize: settings.imageDefaultSize, - mediaUpload: settings.mediaUpload - }; - }, []); - const { - createErrorNotice - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_6__.store); - function onUploadError(message) { - createErrorNotice(message, { - type: 'snackbar' - }); - setURLCaption(undefined, undefined); - setTemporaryURL(undefined); - } - function onSelectImage(media) { - if (!media || !media.url) { - setURLCaption(undefined, undefined); - return; - } - if ((0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.isBlobURL)(media.url)) { - setTemporaryURL(media.url); - return; - } - setTemporaryURL(); - let mediaAttributes = pickRelevantMediaFiles(media, imageDefaultSize); - setId(mediaAttributes.id); - setURLCaption(mediaAttributes.url, mediaAttributes.caption); - } - function onSelectURL(newURL) { - if (newURL !== url) { - setURLCaption(newURL, caption); - } - } - let isTemp = isTemporaryImage(id, url); - - // Upload a temporary image on mount. - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (!isTemp) { - return; - } - const file = (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.getBlobByURL)(url); - if (file) { - mediaUpload({ - filesList: [file], - onFileChange: ([img]) => { - onSelectImage(img); - }, - allowedTypes: ALLOWED_MEDIA_TYPES, - onError: message => { - isTemp = false; - onUploadError(message); - } - }); - } - }, []); - - // If an image is temporary, revoke the Blob url when it is uploaded (and is - // no longer temporary). - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (isTemp) { - setTemporaryURL(url); - return; - } - (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.revokeBlobURL)(temporaryURL); - }, [isTemp, url]); - const isExternal = isExternalImage(id, url); - const src = isExternal ? url : undefined; - const mediaPreview = !!url && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { - alt: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Edit image'), - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Edit image'), - className: 'edit-image-preview', - src: url - }); - let img = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { - src: temporaryURL || url, - alt: "", - className: "qsm-answer-option-image", - style: { - width: '200', - height: 'auto' - } - }), temporaryURL && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Spinner, null)); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figure", null, (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(url) ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaPlaceholder, { - icon: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.BlockIcon, { - icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__["default"] - }), - onSelect: onSelectImage, - onSelectURL: onSelectURL, - onError: onUploadError, - accept: "image/*", - allowedTypes: ALLOWED_MEDIA_TYPES, - value: { - id, - src - }, - mediaPreview: mediaPreview, - disableMediaButtons: temporaryURL || url - }) : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.BlockControls, { - group: "other" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaReplaceFlow, { - mediaId: id, - mediaURL: url, - allowedTypes: ALLOWED_MEDIA_TYPES, - accept: "image/*", - onSelect: onSelectImage, - onSelectURL: onSelectURL, - onError: onUploadError - })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", null, img))); -} -/* harmony default export */ __webpack_exports__["default"] = (ImageType); - -/***/ }), - -/***/ "./src/component/icon.js": -/*!*******************************!*\ - !*** ./src/component/icon.js ***! - \*******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ answerOptionBlockIcon: function() { return /* binding */ answerOptionBlockIcon; }, -/* harmony export */ qsmBlockIcon: function() { return /* binding */ qsmBlockIcon; }, -/* harmony export */ questionBlockIcon: function() { return /* binding */ questionBlockIcon; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); - - -//QSM Quiz Block -const qsmBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "3", - fill: "black" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z", - fill: "white" - })) -}); - -//Question Block -const questionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "25", - height: "25", - viewBox: "0 0 25 25", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "0.102539", - y: "0.101562", - width: "24", - height: "24", - rx: "4.68852", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z", - fill: "white" - })) -}); - -//Answer option Block -const answerOptionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "4.21657", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z", - fill: "white" - })) -}); - -/***/ }), - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, -/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; - -//Get Unique array values -const qsmUniqueArray = arr => { - if (qsmIsEmpty(arr) || !Array.isArray(arr)) { - return arr; - } - return arr.filter((val, index, arr) => arr.indexOf(val) === index); -}; - -//Decode htmlspecialchars -const qsmDecodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; -}; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from text content. -const qsmStripTags = text => { - let div = document.createElement("div"); - div.innerHTML = qsmDecodeHtml(text); - return div.innerText; -}; - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - //add to check if api call from editor - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//add objecyt to form data -const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { - if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { - return data; - } - for (let key in valueObj) { - if (valueObj.hasOwnProperty(key)) { - let value = valueObj[key]; - if ('object' === value) { - qsmAddObjToFormData(formKey + '[' + key + ']', value, data); - } else { - data.append(formKey + '[' + key + ']', valueObj[key]); - } - } - } - return data; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const sec = Date.now() * 1000 + Math.random() * 1000; - const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "react": -/*!************************!*\ - !*** external "React" ***! - \************************/ -/***/ (function(module) { - -module.exports = window["React"]; - -/***/ }), - -/***/ "@wordpress/blob": -/*!******************************!*\ - !*** external ["wp","blob"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blob"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/escape-html": -/*!************************************!*\ - !*** external ["wp","escapeHtml"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["escapeHtml"]; - -/***/ }), - -/***/ "@wordpress/html-entities": -/*!**************************************!*\ - !*** external ["wp","htmlEntities"] ***! - \**************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["htmlEntities"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "@wordpress/notices": -/*!*********************************!*\ - !*** external ["wp","notices"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["notices"]; - -/***/ }), - -/***/ "@wordpress/primitives": -/*!************************************!*\ - !*** external ["wp","primitives"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["primitives"]; - -/***/ }), - -/***/ "@wordpress/url": -/*!*****************************!*\ - !*** external ["wp","url"] ***! - \*****************************/ -/***/ (function(module) { - -module.exports = window["wp"]["url"]; - -/***/ }), - -/***/ "./src/answer-option/block.json": -/*!**************************************!*\ - !*** ./src/answer-option/block.json ***! - \**************************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-answer-option","version":"0.1.0","title":"Answer Option","category":"widgets","parent":["qsm/quiz-question"],"icon":"remove","description":"QSM Quiz answer option","attributes":{"optionID":{"type":"string","default":"0"},"content":{"type":"string","default":""},"caption":{"type":"string","default":""},"points":{"type":"string","default":"0"},"isCorrect":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/quizAttr","quiz-master-next/questionID","quiz-master-next/questionType","quiz-master-next/answerType","quiz-master-next/questionChanged"],"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!************************************!*\ - !*** ./src/answer-option/index.js ***! - \************************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/answer-option/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/answer-option/block.json"); -/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../component/icon */ "./src/component/icon.js"); - - - - -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { - icon: _component_icon__WEBPACK_IMPORTED_MODULE_3__.answerOptionBlockIcon, - merge(attributes, attributesToMerge) { - return { - content: (attributes.content || '') + (attributesToMerge.content || '') - }; - }, - edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] -}); -}(); -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,i=window.wp.htmlEntities,o=window.wp.escapeHtml,a=window.wp.blockEditor,l=window.wp.data,r=window.wp.url,c=window.wp.components,s=window.wp.blob,u=window.React,m=window.wp.primitives,d=(0,u.createElement)(m.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,u.createElement)(m.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),p=window.wp.notices;const w=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},E=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText};var h=function({url:e="",caption:i="",alt:o="",setURLCaption:r}){const u=["image"],[m,g]=(0,t.useState)(null),[E,h]=(0,t.useState)(),{imageDefaultSize:f,mediaUpload:x}=((0,t.useRef)(),(0,l.useSelect)((e=>{const{getSettings:t}=e(a.store),n=t();return{imageDefaultSize:n.imageDefaultSize,mediaUpload:n.mediaUpload}}),[])),{createErrorNotice:v}=(0,l.useDispatch)(p.store);function _(e){v(e,{type:"snackbar"}),r(void 0,void 0),h(void 0)}function q(e){if(!e||!e.url)return void r(void 0,void 0);if((0,s.isBlobURL)(e.url))return void h(e.url);h();let t=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));return n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e.url,n})(e,f);g(t.id),r(t.url,t.caption)}function z(t){t!==e&&r(t,i)}let b=((e,t)=>!e&&(0,s.isBlobURL)(t))(m,e);(0,t.useEffect)((()=>{if(!b)return;const t=(0,s.getBlobByURL)(e);t&&x({filesList:[t],onFileChange:([e])=>{q(e)},allowedTypes:u,onError:e=>{b=!1,_(e)}})}),[]),(0,t.useEffect)((()=>{b?h(e):(0,s.revokeBlobURL)(E)}),[b,e]);const R=((e,t)=>t&&!e&&!(0,s.isBlobURL)(t))(m,e)?e:void 0,B=!!e&&(0,t.createElement)("img",{alt:(0,n.__)("Edit image"),title:(0,n.__)("Edit image"),className:"edit-image-preview",src:e});let L=(0,t.createElement)(t.Fragment,null,(0,t.createElement)("img",{src:E||e,alt:"",className:"qsm-answer-option-image",style:{width:"200",height:"auto"}}),E&&(0,t.createElement)(c.Spinner,null));return(0,t.createElement)("figure",null,w(e)?(0,t.createElement)(a.MediaPlaceholder,{icon:(0,t.createElement)(a.BlockIcon,{icon:d}),onSelect:q,onSelectURL:z,onError:_,accept:"image/*",allowedTypes:u,value:{id:m,src:R},mediaPreview:B,disableMediaButtons:E||e}):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.BlockControls,{group:"other"},(0,t.createElement)(a.MediaReplaceFlow,{mediaId:m,mediaURL:e,allowedTypes:u,accept:"image/*",onSelect:q,onSelectURL:z,onError:_})),(0,t.createElement)("div",null,L)))},f=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(f.u2,{icon:()=>(0,t.createElement)(c.Icon,{icon:()=>(0,t.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("rect",{width:"24",height:"24",rx:"4.21657",fill:"#ADADAD"}),(0,t.createElement)("path",{d:"M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z",fill:"white"}))}),merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(s){if("undefined"==typeof qsmBlockData)return null;const{className:u,attributes:m,setAttributes:d,isSelected:p,clientId:f,context:x,mergeBlocks:v,onReplace:_,onRemove:q}=s,z=(x["quiz-master-next/quizID"],x["quiz-master-next/pageID"],x["quiz-master-next/questionID"],x["quiz-master-next/questionType"]),b=x["quiz-master-next/answerType"],R=x["quiz-master-next/questionChanged"],B="qsm/quiz-answer-option",{optionID:L,content:k,caption:S,points:C,isCorrect:y}=m,{selectBlock:U}=(0,l.useDispatch)(a.store),{updateBlockAttributes:T}=(0,l.useDispatch)(a.store),D=(0,l.useSelect)((e=>{let t=e(a.store).getBlockParentsByBlockName(f,"qsm/quiz-question",!0);return w(t)?"":t[0]}),[f]);(0,t.useEffect)((()=>{let e=!0;return e&&p&&!w(D)&&!1===R&&T(D,{isChanged:!0}),()=>{e=!1}}),[k,S,C,y]),(0,t.useEffect)((()=>{let e=!0;return e&&(w(k)||!(0,r.isURL)(k)||-1===k.indexOf("https://")&&-1===k.indexOf("http://")||!["rich","text"].includes(b)||d({content:"",caption:""})),()=>{e=!1}}),[b]);const I=(0,a.useBlockProps)({className:p?" is-highlighted ":""}),A=["4","10"].includes(z)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.InspectorControls,null,(0,t.createElement)(c.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},"image"===b&&(0,t.createElement)(c.TextControl,{type:"text",label:(0,n.__)("Caption","quiz-master-next"),value:S,onChange:e=>d({caption:(0,o.escapeAttribute)(e)})}),(0,t.createElement)(c.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:C,onChange:e=>d({points:e})}),["0","4","1","10","2"].includes(z)&&(0,t.createElement)(c.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!w(y)&&"1"==y,onChange:()=>d({isCorrect:w(y)||"1"!=y?1:0})}))),(0,t.createElement)("div",{...I},(0,t.createElement)(c.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:A,readOnly:!0,tabIndex:"-1"}),!["rich","image"].includes(b)&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:E((0,i.decodeEntities)(k)),onChange:e=>d({content:E((0,i.decodeEntities)(e))}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=f),o},onMerge:v,onReplace:_,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}),"rich"===b&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:g((0,i.decodeEntities)(k)),onChange:e=>d({content:e}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=f),o},onMerge:v,onReplace:_,onRemove:q,className:"qsm-question-answer-option",identifier:"text",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),"image"===b&&(0,t.createElement)(h,{url:(0,r.isURL)(k)?k:"",caption:S,setURLCaption:(e,t)=>d({content:(0,r.isURL)(e)?e:"",caption:t})}))))}})}(); \ No newline at end of file diff --git a/blocks/build/answer-option/index.js.map b/blocks/build/answer-option/index.js.map deleted file mode 100644 index 7254c214f..000000000 --- a/blocks/build/answer-option/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"answer-option/index.js","mappings":";;;;;;;;;;;;;;;AAAsC;AACtC;AACA;AACA;AACkD;AAClD,cAAc,oDAAa,CAAC,sDAAG;AAC/B;AACA;AACA,CAAC,EAAE,oDAAa,CAAC,uDAAI;AACrB;AACA,CAAC;AACD,+DAAe,KAAK,EAAC;AACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACZqC;AACoB;AACC;AACD;AAMxB;AACgC;AAC1B;AAMR;AACiB;AACD;AACqB;AACrD,SAASwB,IAAIA,CAAEC,KAAK,EAAG;EAErC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,WAAW;IAAEC,SAAS;IACpGC;EAAS,CAAC,GAAGV,KAAK;EAEjB,MAAMW,MAAM,GAAGJ,OAAO,CAAC,yBAAyB,CAAC;EACjD,MAAMK,MAAM,GAAGL,OAAO,CAAC,yBAAyB,CAAC;EACjD,MAAMM,UAAU,GAAGN,OAAO,CAAC,6BAA6B,CAAC;EACzD,MAAMO,YAAY,GAAGP,OAAO,CAA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EAAE;EACjCzG,IAAI,EAAEgE,kEAAqB;EAC3B0C,KAAKA,CAAEhL,UAAU,EAAEiL,iBAAiB,EAAG;IACtC,OAAO;MACNjK,OAAO,EACN,CAAEhB,UAAU,CAACgB,OAAO,IAAI,EAAE,KACxBiK,iBAAiB,CAACjK,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACDkK,IAAI,EAAEtL,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./node_modules/@wordpress/icons/build-module/library/image.js","webpack://qsm/./src/answer-option/edit.js","webpack://qsm/./src/component/ImageType.js","webpack://qsm/./src/component/icon.js","webpack://qsm/./src/helper.js","webpack://qsm/external window \"React\"","webpack://qsm/external window [\"wp\",\"blob\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"escapeHtml\"]","webpack://qsm/external window [\"wp\",\"htmlEntities\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/external window [\"wp\",\"primitives\"]","webpack://qsm/external window [\"wp\",\"url\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/answer-option/index.js"],"sourcesContent":["import { createElement } from \"react\";\n/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\nconst image = createElement(SVG, {\n viewBox: \"0 0 24 24\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, createElement(Path, {\n d: \"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z\"\n}));\nexport default image;\n//# sourceMappingURL=image.js.map","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport { decodeEntities } from '@wordpress/html-entities';\r\nimport { escapeAttribute } from \"@wordpress/escape-html\";\r\nimport {\r\n\tInspectorControls,\r\n\tstore as blockEditorStore,\r\n\tRichText,\r\n\tuseBlockProps,\r\n} from '@wordpress/block-editor';\r\nimport { useDispatch, useSelect, select } from '@wordpress/data';\r\nimport { isURL } from '@wordpress/url';\r\nimport {\r\n\tPanelBody,\r\n\tTextControl,\r\n\tToggleControl,\r\n\t__experimentalHStack as HStack,\r\n} from '@wordpress/components';\r\nimport { createBlock } from '@wordpress/blocks';\r\nimport ImageType from '../component/ImageType';\r\nimport { qsmIsEmpty, qsmStripTags, qsmDecodeHtml } from '../helper';\r\nexport default function Edit( props ) {\r\n\t\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace,\r\nonRemove } = props;\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\tconst pageID = context['quiz-master-next/pageID'];\r\n\tconst questionID = context['quiz-master-next/questionID'];\r\n\tconst questionType = context['quiz-master-next/questionType'];\r\n\tconst answerType = context['quiz-master-next/answerType'];\r\n\tconst questionChanged = context['quiz-master-next/questionChanged'];\r\n\r\n\tconst name = 'qsm/quiz-answer-option';\r\n\tconst {\r\n\t\toptionID,\r\n\t\tcontent,\r\n\t\tcaption,\r\n\t\tpoints,\r\n\t\tisCorrect\r\n\t} = attributes;\r\n\r\n\tconst {\r\n\t\tselectBlock,\r\n\t} = useDispatch( blockEditorStore );\r\n\r\n\t//Use to to update block attributes using clientId\r\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\r\n\r\n\tconst questionClientID = useSelect(\r\n\t\t( select ) => {\r\n\t\t\t//get parent gutena form clientIds\r\n\t\t\tlet questionClientID = select( blockEditorStore ).getBlockParentsByBlockName( clientId,'qsm/quiz-question', true );\r\n\t\t\treturn qsmIsEmpty( questionClientID ) ? '': questionClientID[0];\r\n\t\t},\r\n\t\t[ clientId ]\r\n\t);\r\n\r\n\t//detect change in question\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetChanged = true;\r\n\t\tif ( shouldSetChanged && isSelected && ! qsmIsEmpty( questionClientID ) && false === questionChanged ) {\r\n\t\t\tupdateBlockAttributes( questionClientID, { isChanged: true } );\r\n\t\t}\r\n\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetChanged = false;\r\n\t\t};\r\n\t}, [\r\n\t\tcontent,\r\n\t\tcaption,\r\n\t\tpoints,\r\n\t\tisCorrect\r\n\t] )\r\n\r\n\t/**Initialize block from server */\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetQSMAttr = true;\r\n\t\tif ( shouldSetQSMAttr ) {\r\n\t\t\tif ( ! qsmIsEmpty( content ) && isURL( content ) && ( -1 !== content.indexOf('https://') || -1 !== content.indexOf('http://') ) && ['rich','text'].includes( answerType ) ) {\r\n\t\t\t\tsetAttributes({\r\n\t\t\t\t\tcontent:'',\r\n\t\t\t\t\tcaption:''\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetQSMAttr = false;\r\n\t\t};\r\n\t\t\r\n\t}, [ answerType ] );\r\n\r\n\tconst blockProps = useBlockProps( {\r\n\t\tclassName: isSelected ? ' is-highlighted ': '',\r\n\t} );\r\n\r\n\tconst inputType = ['4','10'].includes( questionType ) ? \"checkbox\":\"radio\";\r\n\t\r\n\treturn (\r\n\t<>\r\n\t\r\n\t\t\r\n\t\t\t{ /**Image answer option */\r\n\t\t\t\t'image' === answerType &&\r\n\t\t\t\t setAttributes( { caption: escapeAttribute( caption ) } ) }\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\t setAttributes( { points } ) }\r\n\t\t\t/>\r\n\t\t\t{\r\n\t\t\t\t['0','4','1','10', '2'].includes( questionType ) &&\r\n\t\t\t\t setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) }\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\r\n\t\r\n\t
\r\n\t\t\r\n \t\t\r\n\t\t{ /**Text answer option*/\r\n\t\t\t! ['rich','image'].includes( answerType ) && \r\n\t\t\t setAttributes( { content: qsmStripTags( decodeEntities( content ) ) } ) }\r\n\t\t\t\tonSplit={ ( value, isOriginal ) => {\r\n\t\t\t\t\tlet newAttributes;\r\n\r\n\t\t\t\t\tif ( isOriginal || value ) {\r\n\t\t\t\t\t\tnewAttributes = {\r\n\t\t\t\t\t\t\t...attributes,\r\n\t\t\t\t\t\t\tcontent: value,\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst block = createBlock( name, newAttributes );\r\n\r\n\t\t\t\t\tif ( isOriginal ) {\r\n\t\t\t\t\t\tblock.clientId = clientId;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn block;\r\n\t\t\t\t} }\r\n\t\t\t\tonMerge={ mergeBlocks }\r\n\t\t\t\tonReplace={ onReplace }\r\n\t\t\t\tonRemove={ onRemove }\r\n\t\t\t\tallowedFormats={ [ ] }\r\n\t\t\t\twithoutInteractiveFormatting\r\n\t\t\t\tclassName={ 'qsm-question-answer-option' }\r\n\t\t\t\tidentifier='text'\r\n\t\t\t/>\r\n\t\t}\r\n\t\t{ /**Rich Text answer option */\r\n\t\t 'rich' === answerType && \r\n\t\t\t setAttributes( { content } ) }\r\n\t\t\t\tonSplit={ ( value, isOriginal ) => {\r\n\t\t\t\t\tlet newAttributes;\r\n\r\n\t\t\t\t\tif ( isOriginal || value ) {\r\n\t\t\t\t\t\tnewAttributes = {\r\n\t\t\t\t\t\t\t...attributes,\r\n\t\t\t\t\t\t\tcontent: value,\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst block = createBlock( name, newAttributes );\r\n\r\n\t\t\t\t\tif ( isOriginal ) {\r\n\t\t\t\t\t\tblock.clientId = clientId;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn block;\r\n\t\t\t\t} }\r\n\t\t\t\tonMerge={ mergeBlocks }\r\n\t\t\t\tonReplace={ onReplace }\r\n\t\t\t\tonRemove={ onRemove }\r\n\t\t\t\tclassName={ 'qsm-question-answer-option' }\r\n\t\t\t\tidentifier='text'\r\n\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t/>\r\n\t\t}\r\n\t\t{ /**Image answer option */\r\n\t\t\t'image' === answerType &&\r\n\t\t\t setAttributes({\r\n\t\t\t\tcontent: isURL( url ) ? url: '',\r\n\t\t\t\tcaption: caption\r\n\t\t\t}) }\r\n\t\t\t/>\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t
\r\n\t\r\n\t);\r\n}\r\n","/**\r\n * Image Component: Upload, Use media, external image url\r\n */\r\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\r\nimport {\r\n\tButton,\r\n\tSpinner,\r\n} from '@wordpress/components';\r\nimport { useDispatch, useSelect } from '@wordpress/data';\r\nimport {\r\n\tBlockControls,\r\n\tBlockIcon,\r\n\tMediaReplaceFlow,\r\n\tMediaPlaceholder,\r\n\tstore as blockEditorStore,\r\n} from '@wordpress/block-editor';\r\nimport { useEffect, useRef, useState } from '@wordpress/element';\r\nimport { __ } from '@wordpress/i18n';\r\nimport { image as icon } from '@wordpress/icons';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { isURL } from '@wordpress/url';\r\nimport { qsmIsEmpty } from '../helper';\r\n\r\nexport const pickRelevantMediaFiles = ( image, size ) => {\r\n\tconst imageProps = Object.fromEntries(\r\n\t\tObject.entries( image ?? {} ).filter( ( [ key ] ) =>\r\n\t\t\t[ 'alt', 'id', 'link', 'caption' ].includes( key )\r\n\t\t)\r\n\t);\r\n\r\n\timageProps.url =\r\n\t\timage?.sizes?.[ size ]?.url ||\r\n\t\timage?.media_details?.sizes?.[ size ]?.source_url ||\r\n\t\timage.url;\r\n\treturn imageProps;\r\n};\r\n\r\n/**\r\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\r\n * while the image is being uploaded and will not have an id yet allocated.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the URL a Blob URL\r\n */\r\nconst isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );\r\n\r\n/**\r\n * Is the url for the image hosted externally. An externally hosted image has no\r\n * id and is not a blob url.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the url an externally hosted url?\r\n */\r\nexport const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\r\n\r\n\r\nexport function ImageType( {\r\n\turl = '',\r\n\tcaption = '',\r\n\talt = '',\r\n\tsetURLCaption,\r\n} ) {\r\n\t\r\n\tconst ALLOWED_MEDIA_TYPES = [ 'image' ];\r\n\tconst [ id, setId ] = useState( null );\r\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\r\n\r\n\tconst ref = useRef();\r\n\tconst { imageDefaultSize, mediaUpload } = useSelect( ( select ) => {\r\n\t\tconst { getSettings } = select( blockEditorStore );\r\n\t\tconst settings = getSettings();\r\n\t\treturn {\r\n\t\t\timageDefaultSize: settings.imageDefaultSize,\r\n\t\t\tmediaUpload: settings.mediaUpload,\r\n\t\t};\r\n\t}, [] );\r\n\r\n\tconst { createErrorNotice } = useDispatch( noticesStore );\r\n\tfunction onUploadError( message ) {\r\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\r\n\t\tsetURLCaption( undefined, undefined );\r\n\t\tsetTemporaryURL( undefined );\r\n\t}\r\n\r\n\tfunction onSelectImage( media ) {\r\n\t\tif ( ! media || ! media.url ) {\r\n\t\t\tsetURLCaption( undefined, undefined );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif ( isBlobURL( media.url ) ) {\r\n\t\t\tsetTemporaryURL( media.url );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tsetTemporaryURL();\r\n\r\n\t\tlet mediaAttributes = pickRelevantMediaFiles( media, imageDefaultSize );\r\n\t\tsetId( mediaAttributes.id );\r\n\t\tsetURLCaption( mediaAttributes.url, mediaAttributes.caption );\r\n\t}\r\n\r\n\tfunction onSelectURL( newURL ) {\r\n\t\tif ( newURL !== url ) {\r\n\t\t\tsetURLCaption( newURL, caption );\r\n\t\t}\r\n\t}\r\n\r\n\tlet isTemp = isTemporaryImage( id, url );\r\n\r\n\t// Upload a temporary image on mount.\r\n\tuseEffect( () => {\r\n\t\tif ( ! isTemp ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst file = getBlobByURL( url );\r\n\r\n\t\tif ( file ) {\r\n\t\t\tmediaUpload( {\r\n\t\t\t\tfilesList: [ file ],\r\n\t\t\t\tonFileChange: ( [ img ] ) => {\r\n\t\t\t\t\tonSelectImage( img );\r\n\t\t\t\t},\r\n\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\r\n\t\t\t\tonError: ( message ) => {\r\n\t\t\t\t\tisTemp = false;\r\n\t\t\t\t\tonUploadError( message );\r\n\t\t\t\t},\r\n\t\t\t} );\r\n\t\t}\r\n\t}, [] );\r\n\r\n\t// If an image is temporary, revoke the Blob url when it is uploaded (and is\r\n\t// no longer temporary).\r\n\tuseEffect( () => {\r\n\t\tif ( isTemp ) {\r\n\t\t\tsetTemporaryURL( url );\r\n\t\t\treturn;\r\n\t\t}\r\n\t\trevokeBlobURL( temporaryURL );\r\n\t}, [ isTemp, url ] );\r\n\r\n\tconst isExternal = isExternalImage( id, url );\r\n\tconst src = isExternal ? url : undefined;\r\n\tconst mediaPreview = !! url && (\r\n\t\t\r\n\t);\r\n\r\n\tlet img = (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t{ temporaryURL && }\r\n\t\t\r\n\t);\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t{ qsmIsEmpty( url ) ? (\r\n\t\t\t\t }\r\n\t\t\t\t\tonSelect={ onSelectImage }\r\n\t\t\t\t\tonSelectURL={ onSelectURL }\r\n\t\t\t\t\tonError={ onUploadError }\r\n\t\t\t\t\taccept=\"image/*\"\r\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\r\n\t\t\t\t\tvalue={ { id, src } }\r\n\t\t\t\t\tmediaPreview={ mediaPreview }\r\n\t\t\t\t\tdisableMediaButtons={ temporaryURL || url }\r\n\t\t\t\t/>\r\n\t\t\t) : (\r\n\t\t\t<>\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t
{ img }
\r\n\t\t\t\r\n\t\t\t) }\r\n\t\t
\r\n\t);\r\n}\r\n\r\nexport default ImageType;\r\n","import { Icon } from '@wordpress/components';\r\n//QSM Quiz Block\r\nexport const qsmBlockIcon = () => (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const sec = Date.now() * 1000 + Math.random() * 1000;\r\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\r\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blob\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"escapeHtml\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","module.exports = window[\"wp\"][\"primitives\"];","module.exports = window[\"wp\"][\"url\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { answerOptionBlockIcon } from \"../component/icon\";\r\n\r\nregisterBlockType( metadata.name, {\r\n\ticon: answerOptionBlockIcon,\r\n\tmerge( attributes, attributesToMerge ) {\r\n\t\treturn {\r\n\t\t\tcontent:\r\n\t\t\t\t( attributes.content || '' ) +\r\n\t\t\t\t( attributesToMerge.content || '' ),\r\n\t\t};\r\n\t},\r\n\tedit: Edit,\r\n} );\r\n"],"names":["__","useState","useEffect","decodeEntities","escapeAttribute","InspectorControls","store","blockEditorStore","RichText","useBlockProps","useDispatch","useSelect","select","isURL","PanelBody","TextControl","ToggleControl","__experimentalHStack","HStack","createBlock","ImageType","qsmIsEmpty","qsmStripTags","qsmDecodeHtml","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","mergeBlocks","onReplace","onRemove","quizID","pageID","questionID","questionType","answerType","questionChanged","name","optionID","content","caption","points","isCorrect","selectBlock","updateBlockAttributes","questionClientID","getBlockParentsByBlockName","shouldSetChanged","isChanged","shouldSetQSMAttr","indexOf","includes","blockProps","inputType","createElement","Fragment","title","initialOpen","type","label","value","onChange","help","checked","spacing","justify","readOnly","tabIndex","tagName","placeholder","onSplit","isOriginal","newAttributes","block","onMerge","allowedFormats","withoutInteractiveFormatting","identifier","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","url","setURLCaption","getBlobByURL","isBlobURL","revokeBlobURL","Button","Spinner","BlockControls","BlockIcon","MediaReplaceFlow","MediaPlaceholder","useRef","image","icon","noticesStore","pickRelevantMediaFiles","size","imageProps","Object","fromEntries","entries","filter","key","sizes","media_details","source_url","isTemporaryImage","id","isExternalImage","alt","ALLOWED_MEDIA_TYPES","setId","temporaryURL","setTemporaryURL","ref","imageDefaultSize","mediaUpload","getSettings","settings","createErrorNotice","onUploadError","message","undefined","onSelectImage","media","mediaAttributes","onSelectURL","newURL","isTemp","file","filesList","onFileChange","img","allowedTypes","onError","isExternal","src","mediaPreview","style","width","height","onSelect","accept","disableMediaButtons","group","mediaId","mediaURL","Icon","qsmBlockIcon","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","data","qsmUniqueArray","arr","Array","isArray","val","index","html","txt","document","innerHTML","qsmSanitizeName","toLowerCase","replace","text","div","innerText","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmUniqid","prefix","random","sec","Date","now","Math","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","registerBlockType","metadata","merge","attributesToMerge","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 0f44addf1..ada096ff6 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => 'dc5d101f1a5e4804631c'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '2817ba1a37bfb0793cda'); diff --git a/blocks/build/index.css b/blocks/build/index.css index 91662cc08..979537d3c 100644 --- a/blocks/build/index.css +++ b/blocks/build/index.css @@ -1,83 +1 @@ -/*!****************************************************************************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! - \****************************************************************************************************************************************************************************************************************************************/ -/** - * The following styles get applied inside the editor only. - * - * Replace them with your own styles or remove the file completely. - */ -.block-editor-block-inspector .qsm-inspector-label { - font-size: 11px; - font-weight: 500; - line-height: 1.4; - text-transform: uppercase; - display: inline-block; - margin-bottom: 0.5rem; - padding: 0px; -} -.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value { - padding-left: 0.5rem; -} -.block-editor-block-inspector .qsm-inspector-label-value { - font-weight: 400; - text-transform: capitalize; -} -.block-editor-block-inspector .qsm-no-mb { - margin-bottom: 0; -} - -.qsm-placeholder-select-create-quiz { - display: flex; - gap: 1rem; - align-items: center; - margin-bottom: 1rem; -} -.qsm-placeholder-select-create-quiz .components-base-control { - max-width: 50%; -} - -.qsm-ptb-1 { - padding: 1rem 0; -} - -.qsm-error-text { - color: #FD3E3E; -} - -.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset { - flex-direction: column; -} - -.qsm-placeholder-quiz-create-form { - width: 50%; -} -.qsm-placeholder-quiz-create-form .components-button { - width: -moz-fit-content; - width: fit-content; -} - -.wp-block-qsm-quiz-question { - /*Question Title*/ - /*Question description*/ - /*Question options*/ - /*Question block in editing mode*/ -} -.wp-block-qsm-quiz-question .qsm-question-title { - color: #1f8cbe; - font-size: 1.38rem; -} -.wp-block-qsm-quiz-question .qsm-question-description, -.wp-block-qsm-quiz-question .qsm-question-correct-answer-info, -.wp-block-qsm-quiz-question .qsm-question-hint { - font-size: 1rem; -} -.wp-block-qsm-quiz-question .qsm-question-answer-option { - color: #666666; - font-size: 0.9rem; - margin-left: 1rem; -} -.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title { - color: #666666; -} - -/*# sourceMappingURL=index.css.map*/ \ No newline at end of file +.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.qsm-placeholder-quiz-create-form{width:50%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{font-size:1rem}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666} diff --git a/blocks/build/index.css.map b/blocks/build/index.css.map deleted file mode 100644 index 12840c6db..000000000 --- a/blocks/build/index.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAUI;EACI;EACA;EACA;EACA;EACA;EACA;EACA;AAJR;AAKQ;EACI;AAHZ;AAMI;EACI;EACA;AAJR;AAOI;EACI;AALR;;AAQA;EACI;EACA;EACA;EACA;AALJ;AAMI;EACI;AAJR;;AAQA;EACI;AALJ;;AAQA;EACI;AALJ;;AAWQ;EACI;AARZ;;AAaA;EACI;AAVJ;AAWI;EACI;EAAA;AATR;;AAaA;EACI;EAMA;EAOA;EAOA;AA3BJ;AAQI;EACI,cA7DiB;EA8DjB;AANR;AAUI;;;EAGI;AARR;AAYI;EACI,cA3Ea;EA4Eb;EACA;AAVR;AAeQ;EACI,cAnFS;AAsErB,C","sources":["webpack://qsm/./src/editor.scss"],"sourcesContent":["/**\r\n * The following styles get applied inside the editor only.\r\n *\r\n * Replace them with your own styles or remove the file completely.\r\n */\r\n\r\n $qsm_primary_color: #666666;\r\n $qsm_wp_primary_color : #1f8cbe;\r\n\r\n.block-editor-block-inspector{\r\n .qsm-inspector-label{\r\n font-size: 11px;\r\n font-weight: 500;\r\n line-height: 1.4;\r\n text-transform: uppercase;\r\n display: inline-block;\r\n margin-bottom: 0.5rem;\r\n padding: 0px;\r\n .qsm-inspector-label-value{\r\n padding-left: 0.5rem;\r\n }\r\n }\r\n .qsm-inspector-label-value{\r\n font-weight: 400; \r\n text-transform: capitalize;\r\n }\r\n\r\n .qsm-no-mb{\r\n margin-bottom: 0;\r\n }\r\n}\r\n.qsm-placeholder-select-create-quiz{\r\n display: flex;\r\n gap: 1rem;\r\n align-items: center;\r\n margin-bottom: 1rem;\r\n .components-base-control{\r\n max-width: 50%;\r\n }\r\n}\r\n\r\n.qsm-ptb-1{\r\n padding: 1rem 0;\r\n}\r\n\r\n.qsm-error-text{\r\n color: #FD3E3E;\r\n}\r\n\r\n//Create or select quiz placeholder\r\n.editor-styles-wrapper {\r\n .qsm-placeholder-wrapper{\r\n .components-placeholder__fieldset {\r\n flex-direction: column;\r\n }\r\n }\r\n}\r\n\r\n.qsm-placeholder-quiz-create-form{\r\n width: 50%;\r\n .components-button{\r\n width: fit-content;\r\n }\r\n}\r\n\r\n.wp-block-qsm-quiz-question {\r\n /*Question Title*/\r\n .qsm-question-title {\r\n color: $qsm_wp_primary_color;\r\n font-size: 1.38rem;\r\n }\r\n\r\n /*Question description*/\r\n .qsm-question-description, \r\n .qsm-question-correct-answer-info,\r\n .qsm-question-hint {\r\n font-size: 1rem;\r\n }\r\n\r\n /*Question options*/\r\n .qsm-question-answer-option{\r\n color: $qsm_primary_color;\r\n font-size: 0.9rem;\r\n margin-left: 1rem;\r\n }\r\n\r\n /*Question block in editing mode*/\r\n &.in-editing-mode{\r\n .qsm-question-title{\r\n color: $qsm_primary_color;\r\n }\r\n }\r\n \r\n}\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/index.js b/blocks/build/index.js index 67f614ef9..c8e1222cc 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1,1131 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/component/icon.js": -/*!*******************************!*\ - !*** ./src/component/icon.js ***! - \*******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ answerOptionBlockIcon: function() { return /* binding */ answerOptionBlockIcon; }, -/* harmony export */ qsmBlockIcon: function() { return /* binding */ qsmBlockIcon; }, -/* harmony export */ questionBlockIcon: function() { return /* binding */ questionBlockIcon; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); - - -//QSM Quiz Block -const qsmBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "3", - fill: "black" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z", - fill: "white" - })) -}); - -//Question Block -const questionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "25", - height: "25", - viewBox: "0 0 25 25", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "0.102539", - y: "0.101562", - width: "24", - height: "24", - rx: "4.68852", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z", - fill: "white" - })) -}); - -//Answer option Block -const answerOptionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "4.21657", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z", - fill: "white" - })) -}); - -/***/ }), - -/***/ "./src/edit.js": -/*!*********************!*\ - !*** ./src/edit.js ***! - \*********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); -/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./helper */ "./src/helper.js"); -/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./component/icon */ "./src/component/icon.js"); - - - - - - - - - - - - - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId - } = props; - const { - createNotice - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__.store); - //quiz attribute - const globalQuizsetting = qsmBlockData.globalQuizsetting; - const { - quizID, - postID, - quizAttr = globalQuizsetting - } = attributes; - - //quiz list - const [quizList, setQuizList] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.QSMQuizList); - //quiz list - const [quizMessage, setQuizMessage] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)({ - error: false, - msg: '' - }); - //whether creating a new quiz - const [createQuiz, setCreateQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //whether saving quiz - const [saveQuiz, setSaveQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //whether to show advance option - const [showAdvanceOption, setShowAdvanceOption] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //Quiz template on set Quiz ID - const [quizTemplate, setQuizTemplate] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)([]); - //Quiz Options to create attributes label, description and layout - const quizOptions = qsmBlockData.quizOptions; - - //check if page is saving - const isSavingPage = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(select => { - const { - isAutosavingPost, - isSavingPost - } = select(_wordpress_editor__WEBPACK_IMPORTED_MODULE_7__.store); - return isSavingPost() && !isAutosavingPost(); - }, []); - const { - getBlock - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); - - /**Initialize block from server */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) { - //add upgrade modal - if ('0' == qsmBlockData.is_pro_activated) { - setTimeout(() => { - addUpgradePopupHtml(); - }, 100); - } - //initialize QSM block - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizID) && 0 < quizID) { - //Check if quiz exists - let hasQuiz = false; - quizList.forEach(quizElement => { - if (quizID == quizElement.value) { - hasQuiz = true; - return true; - } - }); - if (hasQuiz) { - initializeQuizAttributes(quizID); - } else { - setAttributes({ - quizID: undefined - }); - setQuizMessage({ - error: true, - msg: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz not found. Please select an existing quiz or create a new one.', 'quiz-master-next') - }); - } - } - } - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, []); - - /**Add modal advanced-question-type */ - const addUpgradePopupHtml = () => { - let modalEl = document.getElementById('modal-advanced-question-type'); - if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(modalEl)) { - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup', - method: 'POST' - }).then(res => { - let bodyEl = document.getElementById('wpbody-content'); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(bodyEl) && 'success' == res.status) { - bodyEl.insertAdjacentHTML('afterbegin', res.result); - } - }).catch(error => { - console.log('error', error); - }); - } - }; - - /**Initialize quiz attributes: first time render only */ - const initializeQuizAttributes = quiz_id => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quiz_id) && 0 < quiz_id) { - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/structure', - method: 'POST', - data: { - quizID: quiz_id - } - }).then(res => { - if ('success' == res.status) { - setQuizMessage({ - error: false, - msg: '' - }); - let result = res.result; - setAttributes({ - quizID: parseInt(quiz_id), - postID: result.post_id, - quizAttr: { - ...quizAttr, - ...result - } - }); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(result.qpages)) { - let quizTemp = []; - result.qpages.forEach(page => { - let questions = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(page.question_arr)) { - page.question_arr.forEach(question => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(question)) { - let answers = []; - //answers options blocks - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(question.answers) && 0 < question.answers.length) { - question.answers.forEach((answer, aIndex) => { - answers.push(['qsm/quiz-answer-option', { - optionID: aIndex, - content: answer[0], - points: answer[1], - isCorrect: answer[2], - caption: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answer[3]) - }]); - }); - } - //question blocks - questions.push(['qsm/quiz-question', { - questionID: question.question_id, - type: question.question_type_new, - answerEditor: question.settings.answerEditor, - title: question.settings.question_title, - description: question.question_name, - required: question.settings.required, - hint: question.hints, - answers: question.answers, - correctAnswerInfo: question.question_answer_info, - category: question.category, - multicategories: question.multicategories, - commentBox: question.comments, - matchAnswer: question.settings.matchAnswer, - featureImageID: question.settings.featureImageID, - featureImageSrc: question.settings.featureImageSrc, - settings: question.settings - }, answers]); - } - }); - } - quizTemp.push(['qsm/quiz-page', { - pageID: page.id, - pageKey: page.pagekey, - hidePrevBtn: page.hide_prevbtn, - quizID: page.quizID - }, questions]); - }); - setQuizTemplate(quizTemp); - } - } else { - console.log("error " + res.msg); - } - }).catch(error => { - console.log('error', error); - }); - } - }; - - /** - * - * @returns Placeholder for quiz in case quiz ID is not set - */ - const quizPlaceholder = () => { - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Placeholder, { - className: "qsm-placeholder-wrapper", - icon: _component_icon__WEBPACK_IMPORTED_MODULE_11__.qsmBlockIcon, - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz And Survey Master', 'quiz-master-next'), - instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Easily and quickly add quizzes and surveys inside the block editor.', 'quiz-master-next') - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizList) && 0 < quizList.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "qsm-placeholder-select-create-quiz" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.SelectControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('', 'quiz-master-next'), - value: quizID, - options: quizList, - onChange: quizID => initializeQuizAttributes(quizID), - disabled: createQuiz, - __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('OR', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, { - variant: "link", - onClick: () => setCreateQuiz(!createQuiz) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New', 'quiz-master-next'))), ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizList) || createQuiz) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.__experimentalVStack, { - spacing: "3", - className: "qsm-placeholder-quiz-create-form" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.TextControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), - value: quizAttr?.quiz_name || '', - onChange: val => setQuizAttributes(val, 'quiz_name') - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, { - variant: "link", - onClick: () => setShowAdvanceOption(!showAdvanceOption) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance options', 'quiz-master-next')), showAdvanceOption && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.SelectControl, { - label: quizOptions?.form_type?.label, - value: quizAttr?.form_type, - options: quizOptions?.form_type?.options, - onChange: val => setQuizAttributes(val, 'form_type'), - __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.SelectControl, { - label: quizOptions?.system?.label, - value: quizAttr?.system, - options: quizOptions?.system?.options, - onChange: val => setQuizAttributes(val, 'system'), - help: quizOptions?.system?.help, - __nextHasNoMarginBottom: true - }), ['timer_limit', 'pagination'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.TextControl, { - key: 'quiz-create-text-' + item, - type: "number", - label: quizOptions?.[item]?.label, - help: quizOptions?.[item]?.help, - value: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizAttr[item]) ? 0 : quizAttr[item], - onChange: val => setQuizAttributes(val, item) - })), ['enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].map(item => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToggleControl, { - key: 'quiz-create-toggle-' + item, - label: quizOptions?.[item]?.label, - help: quizOptions?.[item]?.help, - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item], - onChange: () => setQuizAttributes(!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizAttr[item]) && '1' == quizAttr[item] ? 0 : 1, item) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, { - variant: "primary", - disabled: saveQuiz || (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizAttr.quiz_name), - onClick: () => createNewQuiz() - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Create Quiz', 'quiz-master-next'))), quizMessage.error && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { - className: "qsm-error-text" - }, quizMessage.msg))); - }; - - /** - * Set attribute value - * @param { any } value attribute value to set - * @param { string } attr_name attribute name - */ - const setQuizAttributes = (value, attr_name) => { - let newAttr = quizAttr; - newAttr[attr_name] = value; - setAttributes({ - quizAttr: { - ...newAttr - } - }); - }; - - /** - * Prepare quiz data e.g. quiz details, questions, answers etc to save - * @returns quiz data - */ - const getQuizDataToSave = () => { - let blocks = getBlock(clientId); - if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(blocks)) { - return false; - } - blocks = blocks.innerBlocks; - let quizDataToSave = { - quiz_id: quizAttr.quiz_id, - post_id: quizAttr.post_id, - quiz: {}, - pages: [], - qpages: [], - questions: [] - }; - let pageSNo = 0; - //loop through inner blocks - blocks.forEach(block => { - if ('qsm/quiz-page' === block.name) { - let pageID = block.attributes.pageID; - let questions = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(block.innerBlocks) && 0 < block.innerBlocks.length) { - let questionBlocks = block.innerBlocks; - //Question Blocks - questionBlocks.forEach(questionBlock => { - if ('qsm/quiz-question' !== questionBlock.name) { - return true; - } - let questionAttr = questionBlock.attributes; - let answerEditor = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.answerEditor, 'text'); - let answers = []; - //Answer option blocks - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionBlock.innerBlocks) && 0 < questionBlock.innerBlocks.length) { - let answerOptionBlocks = questionBlock.innerBlocks; - answerOptionBlocks.forEach(answerOptionBlock => { - if ('qsm/quiz-answer-option' !== answerOptionBlock.name) { - return true; - } - let answerAttr = answerOptionBlock.attributes; - let answerContent = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerAttr?.content); - //if rich text - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionAttr?.answerEditor) && 'rich' === questionAttr.answerEditor) { - answerContent = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__.decodeEntities)(answerContent)); - } - let ans = [answerContent, (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerAttr?.points), (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerAttr?.isCorrect)]; - //answer options are image type - if ('image' === answerEditor && !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(answerAttr?.caption)) { - ans.push(answerAttr?.caption); - } - answers.push(ans); - }); - } - - //questions Data - questions.push(questionAttr.questionID); - //update question only if changes occured - if (questionAttr.isChanged) { - quizDataToSave.questions.push({ - "id": questionAttr.questionID, - "quizID": quizAttr.quiz_id, - "postID": quizAttr.post_id, - "answerEditor": answerEditor, - "type": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.type, '0'), - "name": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.description)), - "question_title": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.title), - "answerInfo": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.correctAnswerInfo)), - "comments": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.commentBox, '1'), - "hint": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.hint), - "category": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.category), - "multicategories": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.multicategories, []), - "required": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.required, 0), - "answers": answers, - "featureImageID": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.featureImageID), - "featureImageSrc": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.featureImageSrc), - "page": pageSNo, - "other_settings": { - "required": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.required, 0) - } - }); - } - }); - } - - // pages[0][]: 2512 - // qpages[0][id]: 2 - // qpages[0][quizID]: 76 - // qpages[0][pagekey]: Ipj90nNT - // qpages[0][hide_prevbtn]: 0 - // qpages[0][questions][]: 2512 - // post_id: 111 - //page data - quizDataToSave.pages.push(questions); - quizDataToSave.qpages.push({ - 'id': pageID, - 'quizID': quizAttr.quiz_id, - 'pagekey': block.attributes.pageKey, - 'hide_prevbtn': block.attributes.hidePrevBtn, - 'questions': questions - }); - pageSNo++; - } - }); - - //Quiz details - quizDataToSave.quiz = { - 'quiz_name': quizAttr.quiz_name, - 'quiz_id': quizAttr.quiz_id, - 'post_id': quizAttr.post_id - }; - if (showAdvanceOption) { - ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => { - if ('undefined' !== typeof quizAttr[item] && null !== quizAttr[item]) { - quizDataToSave.quiz[item] = quizAttr[item]; - } - }); - } - return quizDataToSave; - }; - - //saving Quiz on save page - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (isSavingPage) { - let quizData = getQuizDataToSave(); - //save quiz status - setSaveQuiz(true); - quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ - 'save_entire_quiz': '1', - 'quizData': JSON.stringify(quizData), - 'qsm_block_quiz_nonce': qsmBlockData.nonce, - "nonce": qsmBlockData.saveNonce //save pages nonce - }); - - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/save_quiz', - method: 'POST', - body: quizData - }).then(res => { - //create notice - createNotice(res.status, res.msg, { - isDismissible: true, - type: 'snackbar' - }); - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - } - }, [isSavingPage]); - - /** - * Create new quiz and set quiz ID - * - */ - const createNewQuiz = () => { - if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizAttr.quiz_name)) { - console.log("empty quiz_name"); - return; - } - //save quiz status - setSaveQuiz(true); - let quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ - 'quiz_name': quizAttr.quiz_name, - 'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce - }); - ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => 'undefined' === typeof quizAttr[item] || null === quizAttr[item] ? '' : quizData.append(item, quizAttr[item])); - - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/create_quiz', - method: 'POST', - body: quizData - }).then(res => { - //save quiz status - setSaveQuiz(false); - if ('success' == res.status) { - //create a question - let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ - "id": null, - "quizID": res.quizID, - "answerEditor": "text", - "type": "0", - "name": "", - "question_title": "", - "answerInfo": "", - "comments": "1", - "hint": "", - "category": "", - "required": 1, - "answers": [], - "page": 0 - }); - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/questions', - method: 'POST', - body: newQuestion - }).then(response => { - if ('success' == response.status) { - let question_id = response.id; - - /**Page attributes required format */ - // pages[0][]: 2512 - // qpages[0][id]: 2 - // qpages[0][quizID]: 76 - // qpages[0][pagekey]: Ipj90nNT - // qpages[0][hide_prevbtn]: 0 - // qpages[0][questions][]: 2512 - // post_id: 111 - - let newPage = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ - "action": qsmBlockData.save_pages_action, - "quiz_id": res.quizID, - "nonce": qsmBlockData.saveNonce, - "post_id": res.quizPostID - }); - newPage.append('pages[0][]', question_id); - newPage.append('qpages[0][id]', 1); - newPage.append('qpages[0][quizID]', res.quizID); - newPage.append('qpages[0][pagekey]', (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmUniqid)()); - newPage.append('qpages[0][hide_prevbtn]', 0); - newPage.append('qpages[0][questions][]', question_id); - - //create a page - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - url: qsmBlockData.ajax_url, - method: 'POST', - body: newPage - }).then(pageResponse => { - if ('success' == pageResponse.status) { - //set new quiz - initializeQuizAttributes(res.quizID); - } - }); - } - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - } - - //create notice - createNotice(res.status, res.msg, { - isDismissible: true, - type: 'snackbar' - }); - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - }; - - /** - * Inner Blocks - */ - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)(); - const innerBlocksProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useInnerBlocksProps)(blockProps, { - template: quizTemplate, - allowedBlocks: ['qsm/quiz-page'] - }); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", { - className: "qsm-inspector-label" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Status', 'quiz-master-next') + ':', (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { - className: "qsm-inspector-label-value" - }, quizAttr.post_status)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.TextControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), - value: quizAttr?.quiz_name || '', - onChange: val => setQuizAttributes(val, 'quiz_name'), - className: "qsm-no-mb" - }), (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizID) || '0' != quizID) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ExternalLink, { - href: qsmBlockData.quiz_settings_url + '&quiz_id=' + quizID - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance Quiz Settings', 'quiz-master-next'))))), (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizID) || '0' == quizID ? quizPlaceholder() : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...innerBlocksProps - })); -} - -/***/ }), - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, -/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; - -//Get Unique array values -const qsmUniqueArray = arr => { - if (qsmIsEmpty(arr) || !Array.isArray(arr)) { - return arr; - } - return arr.filter((val, index, arr) => arr.indexOf(val) === index); -}; - -//Decode htmlspecialchars -const qsmDecodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; -}; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from text content. -const qsmStripTags = text => { - let div = document.createElement("div"); - div.innerHTML = qsmDecodeHtml(text); - return div.innerText; -}; - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - //add to check if api call from editor - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//add objecyt to form data -const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { - if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { - return data; - } - for (let key in valueObj) { - if (valueObj.hasOwnProperty(key)) { - let value = valueObj[key]; - if ('object' === value) { - qsmAddObjToFormData(formKey + '[' + key + ']', value, data); - } else { - data.append(formKey + '[' + key + ']', valueObj[key]); - } - } - } - return data; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const sec = Date.now() * 1000 + Math.random() * 1000; - const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "./src/index.js": -/*!**********************!*\ - !*** ./src/index.js ***! - \**********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss"); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/block.json"); -/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./component/icon */ "./src/component/icon.js"); - - - - - -const save = props => null; -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, { - icon: _component_icon__WEBPACK_IMPORTED_MODULE_4__.qsmBlockIcon, - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"], - save: save -}); - -/***/ }), - -/***/ "./src/editor.scss": -/*!*************************!*\ - !*** ./src/editor.scss ***! - \*************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "./src/style.scss": -/*!************************!*\ - !*** ./src/style.scss ***! - \************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/editor": -/*!********************************!*\ - !*** external ["wp","editor"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["editor"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/html-entities": -/*!**************************************!*\ - !*** external ["wp","htmlEntities"] ***! - \**************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["htmlEntities"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "@wordpress/notices": -/*!*********************************!*\ - !*** external ["wp","notices"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["notices"]; - -/***/ }), - -/***/ "./src/block.json": -/*!************************!*\ - !*** ./src/block.json ***! - \************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz","version":"0.1.0","title":"QSM","category":"widgets","keywords":["Quiz","QSM Quiz","Survey","form","Quiz Block"],"icon":"vault","description":"Easily and quickly add quizzes and surveys inside the block editor.","attributes":{"quizID":{"type":"number","default":0},"postID":{"type":"number"},"quizAttr":{"type":"object"}},"providesContext":{"quiz-master-next/quizID":"quizID","quiz-master-next/quizAttr":"quizAttr"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = __webpack_modules__; -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/chunk loaded */ -/******/ !function() { -/******/ var deferred = []; -/******/ __webpack_require__.O = function(result, chunkIds, fn, priority) { -/******/ if(chunkIds) { -/******/ priority = priority || 0; -/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; -/******/ deferred[i] = [chunkIds, fn, priority]; -/******/ return; -/******/ } -/******/ var notFulfilled = Infinity; -/******/ for (var i = 0; i < deferred.length; i++) { -/******/ var chunkIds = deferred[i][0]; -/******/ var fn = deferred[i][1]; -/******/ var priority = deferred[i][2]; -/******/ var fulfilled = true; -/******/ for (var j = 0; j < chunkIds.length; j++) { -/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) { -/******/ chunkIds.splice(j--, 1); -/******/ } else { -/******/ fulfilled = false; -/******/ if(priority < notFulfilled) notFulfilled = priority; -/******/ } -/******/ } -/******/ if(fulfilled) { -/******/ deferred.splice(i--, 1) -/******/ var r = fn(); -/******/ if (r !== undefined) result = r; -/******/ } -/******/ } -/******/ return result; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/jsonp chunk loading */ -/******/ !function() { -/******/ // no baseURI -/******/ -/******/ // object to store loaded and loading chunks -/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded -/******/ var installedChunks = { -/******/ "index": 0, -/******/ "./style-index": 0 -/******/ }; -/******/ -/******/ // no chunk on demand loading -/******/ -/******/ // no prefetching -/******/ -/******/ // no preloaded -/******/ -/******/ // no HMR -/******/ -/******/ // no HMR manifest -/******/ -/******/ __webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; }; -/******/ -/******/ // install a JSONP callback for chunk loading -/******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) { -/******/ var chunkIds = data[0]; -/******/ var moreModules = data[1]; -/******/ var runtime = data[2]; -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0; -/******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) { -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) var result = runtime(__webpack_require__); -/******/ } -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ installedChunks[chunkId][0](); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ return __webpack_require__.O(result); -/******/ } -/******/ -/******/ var chunkLoadingGlobal = self["webpackChunkqsm"] = self["webpackChunkqsm"] || []; -/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); -/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ }(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module depends on other loaded chunks and execution need to be delayed -/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], function() { return __webpack_require__("./src/index.js"); }) -/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); -/******/ -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e,t={775:function(e,t,n){var a=window.wp.blocks,i=window.wp.element,s=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),u=window.wp.htmlEntities,l=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,q=window.wp.components;const _=e=>null==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=(e,t="")=>_(e)?t:e,z=()=>(0,i.createElement)(q.Icon,{icon:()=>(0,i.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,i.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,a.registerBlockType)("qsm/quiz",{icon:z,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:a,isSelected:r,clientId:f}=e,{createNotice:w}=(0,m.useDispatch)(c.store),b=qsmBlockData.globalQuizsetting,{quizID:v,postID:y,quizAttr:E=b}=n,[k,D]=(0,i.useState)(qsmBlockData.QSMQuizList),[I,x]=(0,i.useState)({error:!1,msg:""}),[B,C]=(0,i.useState)(!1),[S,O]=(0,i.useState)(!1),[P,N]=(0,i.useState)(!1),[A,T]=(0,i.useState)([]),M=qsmBlockData.quizOptions,Q=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(l.store);(0,i.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{H()}),100),!_(v)&&0{if(v==t.value)return e=!0,!0})),e?F(v):(a({quizID:void 0}),x({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const H=()=>{let e=document.getElementById("modal-advanced-question-type");_(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");_(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},F=e=>{!_(e)&&0{if("success"==t.status){x({error:!1,msg:""});let n=t.result;if(a({quizID:parseInt(e),postID:n.post_id,quizAttr:{...E,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:h(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),T(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},L=(e,t)=>{let n=E;n[t]=e,a({quizAttr:{...n}})};(0,i.useEffect)((()=>{if(Q){let e=(()=>{let e=j(f);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:E.quiz_id,post_id:E.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,i=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,s=h(a?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=h(t?.content);_(a?.answerEditor)||"rich"!==a.answerEditor||(n=d((0,u.decodeEntities)(n)));let i=[n,h(t?.points),h(t?.isCorrect)];"image"!==s||_(t?.caption)||i.push(t?.caption),r.push(i)})),i.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:E.quiz_id,postID:E.post_id,answerEditor:s,type:h(a?.type,"0"),name:d(h(a?.description)),question_title:h(a?.title),answerInfo:d(h(a?.correctAnswerInfo)),comments:h(a?.commentBox,"1"),hint:h(a?.hint),category:h(a?.category),multicategories:h(a?.multicategories,[]),required:h(a?.required,0),answers:r,featureImageID:h(a?.featureImageID),featureImageSrc:h(a?.featureImageSrc),page:n,other_settings:{required:h(a?.required,0)}})})),t.pages.push(i),t.qpages.push({id:a,quizID:E.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:i}),n++}})),t.quiz={quiz_name:E.quiz_name,quiz_id:E.quiz_id,post_id:E.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==E[e]&&null!==E[e]&&(t.quiz[e]=E[e])})),t})();O(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{w(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[Q]);const $=(0,l.useBlockProps)(),K=(0,l.useInnerBlocksProps)($,{template:A,allowedBlocks:["qsm/quiz-page"]});return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(l.InspectorControls,null,(0,i.createElement)(q.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,i.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,i.createElement)("span",{className:"qsm-inspector-label-value"},E.post_status)),(0,i.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:E?.quiz_name||"",onChange:e=>L(e,"quiz_name"),className:"qsm-no-mb"}),(!_(v)||"0"!=v)&&(0,i.createElement)("p",null,(0,i.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),_(v)||"0"==v?(0,i.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:z,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,i.createElement)(i.Fragment,null,!_(k)&&0F(e),disabled:B,__nextHasNoMarginBottom:!0}),(0,i.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,i.createElement)(q.Button,{variant:"link",onClick:()=>C(!B)},(0,s.__)("Add New","quiz-master-next"))),(_(k)||B)&&(0,i.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,i.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:E?.quiz_name||"",onChange:e=>L(e,"quiz_name")}),(0,i.createElement)(q.Button,{variant:"link",onClick:()=>N(!P)},(0,s.__)("Advance options","quiz-master-next")),P&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(q.SelectControl,{label:M?.form_type?.label,value:E?.form_type,options:M?.form_type?.options,onChange:e=>L(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,i.createElement)(q.SelectControl,{label:M?.system?.label,value:E?.system,options:M?.system?.options,onChange:e=>L(e,"system"),help:M?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,i.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:M?.[e]?.label,help:M?.[e]?.help,value:_(E[e])?0:E[e],onChange:t=>L(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,i.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:M?.[e]?.label,help:M?.[e]?.help,checked:!_(E[e])&&"1"==E[e],onChange:()=>L(_(E[e])||"1"!=E[e]?1:0,e)})))),(0,i.createElement)(q.Button,{variant:"primary",disabled:S||_(E.quiz_name),onClick:()=>(()=>{if(_(E.quiz_name))return void console.log("empty quiz_name");O(!0);let e=g({quiz_name:E.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===E[t]||null===E[t]?"":e.append(t,E[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(O(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+1e3*Math.random()).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.trunc(1e8*Math.random())}`:""}`)()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&F(e.quizID)}))}})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))}w(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),I.error&&(0,i.createElement)("p",{className:"qsm-error-text"},I.msg))):(0,i.createElement)("div",{...K}))},save:e=>null})}},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,a),s.exports}a.m=t,e=[],a.O=function(t,n,i,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(a.O).every((function(e){return a.O[e](n[u])}))?n.splice(u--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,i,s]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var i,s,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(u)var c=u(a)}for(t&&t(n);l (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport { decodeEntities } from '@wordpress/html-entities';\r\nimport {\r\n\tInspectorControls,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n\tstore as blockEditorStore,\r\n\tuseInnerBlocksProps,\r\n} from '@wordpress/block-editor';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect } from '@wordpress/data';\r\nimport { store as editorStore } from '@wordpress/editor';\r\nimport {\r\n\tPanelBody,\r\n\tButton,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tSelectControl,\r\n\tPlaceholder,\r\n\tExternalLink,\r\n\t__experimentalVStack as VStack,\r\n} from '@wordpress/components';\r\nimport './editor.scss';\r\nimport { qsmIsEmpty, qsmFormData, qsmUniqid, qsmValueOrDefault, qsmDecodeHtml } from './helper';\r\nimport { qsmBlockIcon } from './component/icon';\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst { className, attributes, setAttributes, isSelected, clientId } = props;\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\t//quiz attribute\r\n\tconst globalQuizsetting = qsmBlockData.globalQuizsetting;\r\n\tconst {\r\n\t\tquizID,\r\n\t\tpostID,\r\n\t\tquizAttr = globalQuizsetting\r\n\t} = attributes;\r\n\r\n\r\n\t//quiz list\r\n\tconst [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList );\r\n\t//quiz list\r\n\tconst [ quizMessage, setQuizMessage ] = useState( {\r\n\t\terror: false,\r\n\t\tmsg: ''\r\n\t} );\r\n\t//whether creating a new quiz\r\n\tconst [ createQuiz, setCreateQuiz ] = useState( false );\r\n\t//whether saving quiz\r\n\tconst [ saveQuiz, setSaveQuiz ] = useState( false );\r\n\t//whether to show advance option\r\n\tconst [ showAdvanceOption, setShowAdvanceOption ] = useState( false );\r\n\t//Quiz template on set Quiz ID\r\n\tconst [ quizTemplate, setQuizTemplate ] = useState( [] );\r\n\t//Quiz Options to create attributes label, description and layout\r\n\tconst quizOptions = qsmBlockData.quizOptions;\r\n\r\n\t//check if page is saving\r\n\tconst isSavingPage = useSelect( ( select ) => {\r\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\r\n\t\treturn isSavingPost() && ! isAutosavingPost();\r\n\t}, [] );\r\n\r\n\tconst { getBlock } = useSelect( blockEditorStore );\r\n\r\n\t/**Initialize block from server */\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetQSMAttr = true;\r\n\t\tif ( shouldSetQSMAttr ) {\r\n\t\t\t//add upgrade modal\r\n\t\t\tif ( '0' == qsmBlockData.is_pro_activated ) {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\taddUpgradePopupHtml();\r\n\t\t\t\t}, 100);\r\n\t\t\t}\r\n\t\t\t//initialize QSM block\r\n\t\t\tif ( ! qsmIsEmpty( quizID ) && 0 < quizID ) {\r\n\t\t\t\t//Check if quiz exists\r\n\t\t\t\tlet hasQuiz = false;\r\n\t\t\t\tquizList.forEach( quizElement => {\r\n\t\t\t\t\tif ( quizID == quizElement.value ) {\r\n\t\t\t\t\t\thasQuiz = true;\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tif ( hasQuiz ) {\r\n\t\t\t\t\tinitializeQuizAttributes( quizID );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsetAttributes({\r\n\t\t\t\t\t\tquizID : undefined\r\n\t\t\t\t\t});\r\n\t\t\t\t\tsetQuizMessage( {\r\n\t\t\t\t\t\terror: true,\r\n\t\t\t\t\t\tmsg: __( 'Quiz not found. Please select an existing quiz or create a new one.', 'quiz-master-next' )\r\n\t\t\t\t\t} );\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetQSMAttr = false;\r\n\t\t};\r\n\t\t\r\n\t}, [ ] );\r\n\r\n\t/**Add modal advanced-question-type */\r\n\tconst addUpgradePopupHtml = () => {\r\n\t\tlet modalEl = document.getElementById('modal-advanced-question-type');\r\n\t\tif ( qsmIsEmpty( modalEl ) ) {\r\n\t\t\tapiFetch( {\r\n\t\t\t\tpath: '/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t} ).then( ( res ) => {\r\n\t\t\t\tlet bodyEl = document.getElementById('wpbody-content');\r\n\t\t\t\tif ( ! qsmIsEmpty( bodyEl ) && 'success' == res.status ) { \r\n\t\t\t\t\tbodyEl.insertAdjacentHTML('afterbegin', res.result );\r\n\t\t\t\t}\r\n\t\t\t} ).catch(\r\n\t\t\t\t( error ) => {\r\n\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**Initialize quiz attributes: first time render only */\r\n\tconst initializeQuizAttributes = ( quiz_id ) => {\r\n\t\tif ( ! qsmIsEmpty( quiz_id ) && 0 < quiz_id ) {\r\n\t\t\tapiFetch( {\r\n\t\t\t\tpath: '/quiz-survey-master/v1/quiz/structure',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t\tdata: { quizID: quiz_id },\r\n\t\t\t} ).then( ( res ) => {\r\n\t\t\t\t\r\n\t\t\t\tif ( 'success' == res.status ) {\r\n\t\t\t\t\tsetQuizMessage( {\r\n\t\t\t\t\t\terror: false,\r\n\t\t\t\t\t\tmsg: ''\r\n\t\t\t\t\t} );\r\n\t\t\t\t\tlet result = res.result;\r\n\t\t\t\t\tsetAttributes( { \r\n\t\t\t\t\t\tquizID: parseInt( quiz_id ),\r\n\t\t\t\t\t\tpostID: result.post_id,\r\n\t\t\t\t\t\tquizAttr: { ...quizAttr, ...result }\r\n\t\t\t\t\t} );\r\n\t\t\t\t\tif ( ! qsmIsEmpty( result.qpages ) ) {\r\n\t\t\t\t\t\tlet quizTemp = [];\r\n\t\t\t\t\t\tresult.qpages.forEach( page => {\r\n\t\t\t\t\t\t\tlet questions = [];\r\n\t\t\t\t\t\t\tif ( ! qsmIsEmpty( page.question_arr ) ) {\r\n\t\t\t\t\t\t\t\tpage.question_arr.forEach( question => {\r\n\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question ) ) {\r\n\t\t\t\t\t\t\t\t\t\tlet answers = [];\r\n\t\t\t\t\t\t\t\t\t\t//answers options blocks\r\n\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) {\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tquestion.answers.forEach( ( answer, aIndex ) => {\r\n\t\t\t\t\t\t\t\t\t\t\t\tanswers.push(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptionID:aIndex,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontent:answer[0],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoints:answer[1],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect:answer[2],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcaption: qsmValueOrDefault( answer[3] )\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t//question blocks\r\n\t\t\t\t\t\t\t\t\t\tquestions.push(\r\n\t\t\t\t\t\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-question',\r\n\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tquestionID: question.question_id,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: question.question_type_new,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswerEditor: question.settings.answerEditor,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: question.settings.question_title,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: question.question_name,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\trequired: question.settings.required,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\thint:question.hints,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers: question.answers,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcorrectAnswerInfo:question.question_answer_info,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcategory:question.category,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tmulticategories:question.multicategories,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcommentBox: question.comments,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tmatchAnswer: question.settings.matchAnswer,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageID: question.settings.featureImageID,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageSrc: question.settings.featureImageSrc,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsettings: question.settings\r\n\t\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t\tanswers\r\n\t\t\t\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tquizTemp.push(\r\n\t\t\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t\t\t'qsm/quiz-page',\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tpageID:page.id,\r\n\t\t\t\t\t\t\t\t\t\tpageKey: page.pagekey,\r\n\t\t\t\t\t\t\t\t\t\thidePrevBtn: page.hide_prevbtn,\r\n\t\t\t\t\t\t\t\t\t\tquizID: page.quizID\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\tquestions\r\n\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tsetQuizTemplate( quizTemp );\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconsole.log( \"error \"+ res.msg );\r\n\t\t\t\t}\r\n\t\t\t} ).catch(\r\n\t\t\t\t( error ) => {\r\n\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * \r\n\t * @returns Placeholder for quiz in case quiz ID is not set\r\n\t */\r\n\tconst quizPlaceholder = ( ) => {\r\n\t\treturn (\r\n\t\t\t\r\n\t\t\t\t{\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t{ ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& \r\n\t\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tinitializeQuizAttributes( quizID )\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdisabled={ createQuiz }\r\n\t\t\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t{ __( 'OR', 'quiz-master-next' ) }\r\n\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t\t}\r\n\t\t\t\t\t{ ( qsmIsEmpty( quizList ) || createQuiz ) &&\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t setQuizAttributes( val, 'quiz_name') }\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t{ showAdvanceOption && (<>\r\n\t\t\t\t\t\t\t{/**Form Type */}\r\n\t\t\t\t\t\t\t setQuizAttributes( val, 'form_type') }\r\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t{/**Grading Type */}\r\n\t\t\t\t\t\t\t setQuizAttributes( val, 'system') }\r\n\t\t\t\t\t\t\t\thelp={ quizOptions?.system?.help }\r\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t[ \r\n\t\t\t\t\t\t\t\t\t'timer_limit', \r\n\t\t\t\t\t\t\t\t\t'pagination',\r\n\t\t\t\t\t\t\t\t].map( ( item ) => (\r\n\t\t\t\t\t\t\t\t\t setQuizAttributes( val, item) }\r\n\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t) )\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t[ \r\n\t\t\t\t\t\t\t\t\t'enable_contact_form', \r\n\t\t\t\t\t\t\t\t\t'enable_pagination_quiz', \r\n\t\t\t\t\t\t\t\t\t'show_question_featured_image_in_result',\r\n\t\t\t\t\t\t\t\t\t'progress_bar',\r\n\t\t\t\t\t\t\t\t\t'require_log_in',\r\n\t\t\t\t\t\t\t\t\t'disable_first_page',\r\n\t\t\t\t\t\t\t\t\t'comment_section'\r\n\t\t\t\t\t\t\t\t].map( ( item ) => (\r\n\t\t\t\t\t\t\t\t setQuizAttributes( ( ( ! qsmIsEmpty( quizAttr[item] ) && '1' == quizAttr[item] ) ? 0 : 1 ), item ) }\r\n\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t) )\r\n\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t }\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tquizMessage.error && (\r\n\t\t\t\t\t\t\t

{ quizMessage.msg }

\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t);\r\n\t};\r\n\r\n\t/**\r\n\t * Set attribute value\r\n\t * @param { any } value attribute value to set\r\n\t * @param { string } attr_name attribute name\r\n\t */\r\n\tconst setQuizAttributes = ( value , attr_name ) => {\r\n\t\tlet newAttr = quizAttr;\r\n\t\tnewAttr[ attr_name ] = value;\r\n\t\tsetAttributes( { quizAttr: { ...newAttr } } );\r\n\t}\r\n\r\n\t/**\r\n\t * Prepare quiz data e.g. quiz details, questions, answers etc to save \r\n\t * @returns quiz data\r\n\t */\r\n\tconst getQuizDataToSave = ( ) => {\t\r\n\t\tlet blocks = getBlock( clientId ); \r\n\t\tif ( qsmIsEmpty( blocks ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tblocks = blocks.innerBlocks;\r\n\t\tlet quizDataToSave = {\r\n\t\t\tquiz_id: quizAttr.quiz_id,\r\n\t\t\tpost_id: quizAttr.post_id,\r\n\t\t\tquiz:{},\r\n\t\t\tpages:[],\r\n\t\t\tqpages:[],\r\n\t\t\tquestions:[]\r\n\t\t};\r\n\t\tlet pageSNo = 0;\r\n\t\t//loop through inner blocks\r\n\t\tblocks.forEach( (block) => {\r\n\t\t\tif ( 'qsm/quiz-page' === block.name ) {\r\n\t\t\t\tlet pageID = block.attributes.pageID;\r\n\t\t\t\tlet questions = [];\r\n\t\t\t\tif ( ! qsmIsEmpty( block.innerBlocks ) && 0 < block.innerBlocks.length ) { \r\n\t\t\t\t\tlet questionBlocks = block.innerBlocks;\r\n\t\t\t\t\t//Question Blocks\r\n\t\t\t\t\tquestionBlocks.forEach( ( questionBlock ) => {\r\n\t\t\t\t\t\tif ( 'qsm/quiz-question' !== questionBlock.name ) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlet questionAttr = questionBlock.attributes;\r\n\t\t\t\t\t\tlet answerEditor = qsmValueOrDefault( questionAttr?.answerEditor, 'text' );\r\n\t\t\t\t\t\tlet answers = [];\r\n\t\t\t\t\t\t//Answer option blocks\r\n\t\t\t\t\t\tif ( ! qsmIsEmpty( questionBlock.innerBlocks ) && 0 < questionBlock.innerBlocks.length ) { \r\n\t\t\t\t\t\t\tlet answerOptionBlocks = questionBlock.innerBlocks;\r\n\t\t\t\t\t\t\tanswerOptionBlocks.forEach( ( answerOptionBlock ) => {\r\n\t\t\t\t\t\t\t\tif ( 'qsm/quiz-answer-option' !== answerOptionBlock.name ) {\r\n\t\t\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tlet answerAttr = answerOptionBlock.attributes;\r\n\t\t\t\t\t\t\t\tlet answerContent = qsmValueOrDefault( answerAttr?.content );\r\n\t\t\t\t\t\t\t\t//if rich text\r\n\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( questionAttr?.answerEditor ) && 'rich' === questionAttr.answerEditor ) {\r\n\t\t\t\t\t\t\t\t\tanswerContent = qsmDecodeHtml( decodeEntities( answerContent ) );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tlet ans = [\r\n\t\t\t\t\t\t\t\t\tanswerContent,\r\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.points ),\r\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.isCorrect ),\r\n\t\t\t\t\t\t\t\t];\r\n\t\t\t\t\t\t\t\t//answer options are image type\r\n\t\t\t\t\t\t\t\tif ( 'image' === answerEditor && ! qsmIsEmpty( answerAttr?.caption ) ) {\r\n\t\t\t\t\t\t\t\t\tans.push( answerAttr?.caption );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tanswers.push( ans );\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//questions Data\r\n\t\t\t\t\t\tquestions.push( questionAttr.questionID );\r\n\t\t\t\t\t\t//update question only if changes occured\r\n\t\t\t\t\t\tif ( questionAttr.isChanged ) {\r\n\t\t\t\t\t\t\tquizDataToSave.questions.push({\r\n\t\t\t\t\t\t\t\t\"id\": questionAttr.questionID,\r\n\t\t\t\t\t\t\t\t\"quizID\": quizAttr.quiz_id,\r\n\t\t\t\t\t\t\t\t\"postID\": quizAttr.post_id,\r\n\t\t\t\t\t\t\t\t\"answerEditor\": answerEditor,\r\n\t\t\t\t\t\t\t\t\"type\": qsmValueOrDefault( questionAttr?.type , '0' ),\r\n\t\t\t\t\t\t\t\t\"name\": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.description ) ),\r\n\t\t\t\t\t\t\t\t\"question_title\": qsmValueOrDefault( questionAttr?.title ),\r\n\t\t\t\t\t\t\t\t\"answerInfo\": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.correctAnswerInfo ) ),\r\n\t\t\t\t\t\t\t\t\"comments\": qsmValueOrDefault( questionAttr?.commentBox, '1' ),\r\n\t\t\t\t\t\t\t\t\"hint\": qsmValueOrDefault( questionAttr?.hint ),\r\n\t\t\t\t\t\t\t\t\"category\": qsmValueOrDefault( questionAttr?.category ),\r\n\t\t\t\t\t\t\t\t\"multicategories\": qsmValueOrDefault( questionAttr?.multicategories, [] ),\r\n\t\t\t\t\t\t\t\t\"required\": qsmValueOrDefault( questionAttr?.required, 0 ),\r\n\t\t\t\t\t\t\t\t\"answers\": answers,\r\n\t\t\t\t\t\t\t\t\"featureImageID\":qsmValueOrDefault( questionAttr?.featureImageID ),\r\n\t\t\t\t\t\t\t\t\"featureImageSrc\":qsmValueOrDefault( questionAttr?.featureImageSrc ),\r\n\t\t\t\t\t\t\t\t\"page\": pageSNo,\r\n\t\t\t\t\t\t\t\t\"other_settings\": {\r\n\t\t\t\t\t\t\t\t\t\"required\": qsmValueOrDefault( questionAttr?.required, 0 )\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// pages[0][]: 2512\r\n\t\t\t\t// \tqpages[0][id]: 2\r\n\t\t\t\t// \tqpages[0][quizID]: 76\r\n\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\r\n\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\r\n\t\t\t\t// \tqpages[0][questions][]: 2512\r\n\t\t\t\t// \tpost_id: 111\r\n\t\t\t\t//page data\r\n\t\t\t\tquizDataToSave.pages.push( questions );\r\n\t\t\t\tquizDataToSave.qpages.push( {\r\n\t\t\t\t\t'id': pageID,\r\n\t\t\t\t\t'quizID': quizAttr.quiz_id,\r\n\t\t\t\t\t'pagekey': block.attributes.pageKey,\r\n\t\t\t\t\t'hide_prevbtn':block.attributes.hidePrevBtn,\r\n\t\t\t\t\t'questions': questions\r\n\t\t\t\t} );\r\n\t\t\t\tpageSNo++;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t//Quiz details\r\n\t\tquizDataToSave.quiz = { \r\n\t\t\t'quiz_name': quizAttr.quiz_name,\r\n\t\t\t'quiz_id': quizAttr.quiz_id,\r\n\t\t\t'post_id': quizAttr.post_id,\r\n\t\t};\r\n\t\tif ( showAdvanceOption ) {\r\n\t\t\t[\r\n\t\t\t'form_type', \r\n\t\t\t'system', \r\n\t\t\t'timer_limit', \r\n\t\t\t'pagination',\r\n\t\t\t'enable_contact_form', \r\n\t\t\t'enable_pagination_quiz', \r\n\t\t\t'show_question_featured_image_in_result',\r\n\t\t\t'progress_bar',\r\n\t\t\t'require_log_in',\r\n\t\t\t'disable_first_page',\r\n\t\t\t'comment_section'\r\n\t\t\t].forEach( ( item ) => { \r\n\t\t\t\tif ( 'undefined' !== typeof quizAttr[ item ] && null !== quizAttr[ item ] ) {\r\n\t\t\t\t\tquizDataToSave.quiz[ item ] = quizAttr[ item ];\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn quizDataToSave;\r\n\t}\r\n\r\n\t//saving Quiz on save page\r\n\tuseEffect( () => {\r\n\t\tif ( isSavingPage ) {\r\n\t\t\tlet quizData = getQuizDataToSave();\r\n\t\t\t//save quiz status\r\n\t\t\tsetSaveQuiz( true );\r\n\t\t\t\r\n\t\t\tquizData = qsmFormData({\r\n\t\t\t\t'save_entire_quiz': '1',\r\n\t\t\t\t'quizData': JSON.stringify( quizData ),\r\n\t\t\t\t'qsm_block_quiz_nonce' : qsmBlockData.nonce,\r\n\t\t\t\t\"nonce\": qsmBlockData.saveNonce,//save pages nonce\r\n\t\t\t});\r\n\r\n\t\t\t//AJAX call\r\n\t\t\tapiFetch( {\r\n\t\t\t\tpath: '/quiz-survey-master/v1/quiz/save_quiz',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t\tbody: quizData\r\n\t\t\t} ).then( ( res ) => {\r\n\t\t\t\t//create notice\r\n\t\t\t\tcreateNotice( res.status, res.msg, {\r\n\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t} );\r\n\t\t\t} ).catch(\r\n\t\t\t\t( error ) => {\r\n\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t} );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}, [ isSavingPage ] );\r\n\r\n\t/**\r\n\t * Create new quiz and set quiz ID\r\n\t * \r\n\t */\r\n\tconst createNewQuiz = () => {\r\n\t\tif ( qsmIsEmpty( quizAttr.quiz_name ) ) {\r\n\t\t\tconsole.log(\"empty quiz_name\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t//save quiz status\r\n\t\tsetSaveQuiz( true );\r\n\t\t\r\n\t\tlet quizData = qsmFormData({\r\n\t\t\t'quiz_name': quizAttr.quiz_name,\r\n\t\t\t'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce\r\n\t\t});\r\n\t\t\r\n\t\t['form_type', \r\n\t\t'system', \r\n\t\t'timer_limit', \r\n\t\t'pagination',\r\n\t\t'enable_contact_form', \r\n\t\t'enable_pagination_quiz', \r\n\t\t'show_question_featured_image_in_result',\r\n\t\t'progress_bar',\r\n\t\t'require_log_in',\r\n\t\t'disable_first_page',\r\n\t\t'comment_section'\r\n\t\t].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) );\r\n\r\n\t\t//AJAX call\r\n\t\tapiFetch( {\r\n\t\t\tpath: '/quiz-survey-master/v1/quiz/create_quiz',\r\n\t\t\tmethod: 'POST',\r\n\t\t\tbody: quizData\r\n\t\t} ).then( ( res ) => {\r\n\t\t\t//save quiz status\r\n\t\t\tsetSaveQuiz( false );\r\n\t\t\tif ( 'success' == res.status ) {\r\n\t\t\t\t//create a question\r\n\t\t\t\tlet newQuestion = qsmFormData( {\r\n\t\t\t\t\t\"id\": null,\r\n\t\t\t\t\t\"quizID\": res.quizID,\r\n\t\t\t\t\t\"answerEditor\": \"text\",\r\n\t\t\t\t\t\"type\": \"0\",\r\n\t\t\t\t\t\"name\": \"\",\r\n\t\t\t\t\t\"question_title\": \"\",\r\n\t\t\t\t\t\"answerInfo\": \"\",\r\n\t\t\t\t\t\"comments\": \"1\",\r\n\t\t\t\t\t\"hint\": \"\",\r\n\t\t\t\t\t\"category\": \"\",\r\n\t\t\t\t\t\"required\": 1,\r\n\t\t\t\t\t\"answers\": [],\r\n\t\t\t\t\t\"page\": 0\r\n\t\t\t\t} );\r\n\t\t\t\t//AJAX call\r\n\t\t\t\tapiFetch( {\r\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\r\n\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\tbody: newQuestion\r\n\t\t\t\t} ).then( ( response ) => {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ( 'success' == response.status ) {\r\n\t\t\t\t\t\tlet question_id = response.id;\r\n\r\n\t\t\t\t\t\t/**Page attributes required format */\r\n\t\t\t\t\t\t// pages[0][]: 2512\r\n\t\t\t\t\t\t// \tqpages[0][id]: 2\r\n\t\t\t\t\t\t// \tqpages[0][quizID]: 76\r\n\t\t\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\r\n\t\t\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\r\n\t\t\t\t\t\t// \tqpages[0][questions][]: 2512\r\n\t\t\t\t\t\t// \tpost_id: 111\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlet newPage = qsmFormData( {\r\n\t\t\t\t\t\t\t\"action\": qsmBlockData.save_pages_action,\r\n\t\t\t\t\t\t\t\"quiz_id\": res.quizID,\r\n\t\t\t\t\t\t\t\"nonce\": qsmBlockData.saveNonce,\r\n\t\t\t\t\t\t\t\"post_id\": res.quizPostID,\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t\tnewPage.append( 'pages[0][]', question_id );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][id]', 1 );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][quizID]', res.quizID );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][pagekey]', qsmUniqid() );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][hide_prevbtn]', 0 );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][questions][]', question_id );\r\n\r\n\r\n\t\t\t\t\t\t//create a page\r\n\t\t\t\t\t\tapiFetch( {\r\n\t\t\t\t\t\t\turl: qsmBlockData.ajax_url,\r\n\t\t\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\t\t\tbody: newPage\r\n\t\t\t\t\t\t} ).then( ( pageResponse ) => {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ( 'success' == pageResponse.status ) {\r\n\t\t\t\t\t\t\t\t//set new quiz\r\n\t\t\t\t\t\t\t\tinitializeQuizAttributes( res.quizID );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}).catch(\r\n\t\t\t\t\t( error ) => {\r\n\t\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t\t\r\n\t\t\t} \r\n\r\n\t\t\t//create notice\r\n\t\t\tcreateNotice( res.status, res.msg, {\r\n\t\t\t\tisDismissible: true,\r\n\t\t\t\ttype: 'snackbar',\r\n\t\t\t} );\r\n\t\t} ).catch(\r\n\t\t\t( error ) => {\r\n\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t} );\r\n\t\t\t}\r\n\t\t);\r\n\t \r\n\t}\r\n\r\n\t/**\r\n\t * Inner Blocks\r\n\t */\r\n\tconst blockProps = useBlockProps();\r\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\r\n\t\ttemplate: quizTemplate,\r\n\t\tallowedBlocks : [\r\n\t\t\t'qsm/quiz-page'\r\n\t\t]\r\n\t} );\r\n\t\r\n\r\n\treturn (\r\n\t<>\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t setQuizAttributes( val, 'quiz_name') }\r\n\t\t\tclassName='qsm-no-mb'\r\n\t\t/>\r\n\t\t{\r\n\t\t\t( ! qsmIsEmpty( quizID ) || '0' != quizID ) && \r\n\t\t\t

\r\n\t\t\t\t\r\n\t\t\t

\r\n\t\t}\r\n\t\t
\r\n\t
\r\n\t{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? \r\n quizPlaceholder() \r\n\t:\r\n\t
\r\n\t}\r\n\t\r\n\t\r\n\t);\r\n}\r\n","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const sec = Date.now() * 1000 + Math.random() * 1000;\r\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\r\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { registerBlockType } from '@wordpress/blocks';\r\nimport './style.scss';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { qsmBlockIcon } from './component/icon';\r\n\r\nconst save = ( props ) => null;\r\nregisterBlockType( metadata.name, {\r\n\ticon: qsmBlockIcon,\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n\tsave: save,\r\n} );\r\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkqsm\"] = self[\"webpackChunkqsm\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], function() { return __webpack_require__(\"./src/index.js\"); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["Icon","qsmBlockIcon","createElement","icon","width","height","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","__","useState","useEffect","apiFetch","decodeEntities","InspectorControls","InnerBlocks","useBlockProps","store","blockEditorStore","useInnerBlocksProps","noticesStore","useDispatch","useSelect","editorStore","PanelBody","Button","TextControl","ToggleControl","SelectControl","Placeholder","ExternalLink","__experimentalVStack","VStack","qsmIsEmpty","qsmFormData","qsmUniqid","qsmValueOrDefault","qsmDecodeHtml","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","createNotice","globalQuizsetting","quizID","postID","quizAttr","quizList","setQuizList","QSMQuizList","quizMessage","setQuizMessage","error","msg","createQuiz","setCreateQuiz","saveQuiz","setSaveQuiz","showAdvanceOption","setShowAdvanceOption","quizTemplate","setQuizTemplate","quizOptions","isSavingPage","select","isAutosavingPost","isSavingPost","getBlock","shouldSetQSMAttr","is_pro_activated","setTimeout","addUpgradePopupHtml","hasQuiz","forEach","quizElement","value","initializeQuizAttributes","undefined","modalEl","document","getElementById","path","method","then","res","bodyEl","status","insertAdjacentHTML","result","catch","console","log","quiz_id","data","parseInt","post_id","qpages","quizTemp","page","questions","question_arr","question","answers","length","answer","aIndex","push","optionID","content","points","isCorrect","caption","questionID","question_id","type","question_type_new","answerEditor","settings","title","question_title","description","question_name","required","hint","hints","correctAnswerInfo","question_answer_info","category","multicategories","commentBox","comments","matchAnswer","featureImageID","featureImageSrc","pageID","id","pageKey","pagekey","hidePrevBtn","hide_prevbtn","quizPlaceholder","label","instructions","Fragment","options","onChange","disabled","__nextHasNoMarginBottom","variant","onClick","spacing","help","quiz_name","val","setQuizAttributes","form_type","system","map","item","key","checked","createNewQuiz","attr_name","newAttr","getQuizDataToSave","blocks","innerBlocks","quizDataToSave","quiz","pages","pageSNo","block","name","questionBlocks","questionBlock","questionAttr","answerOptionBlocks","answerOptionBlock","answerAttr","answerContent","ans","isChanged","quizData","JSON","stringify","nonce","saveNonce","body","isDismissible","message","qsm_new_quiz_nonce","append","newQuestion","response","newPage","save_pages_action","quizPostID","url","ajax_url","pageResponse","blockProps","innerBlocksProps","template","allowedBlocks","initialOpen","post_status","href","quiz_settings_url","qsmUniqueArray","arr","Array","isArray","filter","index","indexOf","html","txt","innerHTML","qsmSanitizeName","toLowerCase","replace","qsmStripTags","text","div","innerText","obj","newData","FormData","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","prefix","random","sec","Date","now","Math","toString","padEnd","trunc","defaultValue","registerBlockType","metadata","save","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/page/index.asset.php b/blocks/build/page/index.asset.php index cfc04ac6f..5a2b29b90 100644 --- a/blocks/build/page/index.asset.php +++ b/blocks/build/page/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '952529dea87fdab5a721'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'a6a7c8c48015f8b1bc61'); diff --git a/blocks/build/page/index.js b/blocks/build/page/index.js index ae07d85d7..035c9ecdf 100644 --- a/blocks/build/page/index.js +++ b/blocks/build/page/index.js @@ -1,336 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, -/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; - -//Get Unique array values -const qsmUniqueArray = arr => { - if (qsmIsEmpty(arr) || !Array.isArray(arr)) { - return arr; - } - return arr.filter((val, index, arr) => arr.indexOf(val) === index); -}; - -//Decode htmlspecialchars -const qsmDecodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; -}; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from text content. -const qsmStripTags = text => { - let div = document.createElement("div"); - div.innerHTML = qsmDecodeHtml(text); - return div.innerText; -}; - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - //add to check if api call from editor - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//add objecyt to form data -const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { - if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { - return data; - } - for (let key in valueObj) { - if (valueObj.hasOwnProperty(key)) { - let value = valueObj[key]; - if ('object' === value) { - qsmAddObjToFormData(formKey + '[' + key + ']', value, data); - } else { - data.append(formKey + '[' + key + ']', valueObj[key]); - } - } - } - return data; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const sec = Date.now() * 1000 + Math.random() * 1000; - const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "./src/page/edit.js": -/*!**************************!*\ - !*** ./src/page/edit.js ***! - \**************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId, - context - } = props; - const quizID = context['quiz-master-next/quizID']; - const { - pageID, - pageKey, - hidePrevBtn - } = attributes; - const [qsmPageAttr, setQsmPageAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.globalQuizsetting); - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page Name', 'quiz-master-next'), - value: pageKey, - onChange: pageKey => setAttributes({ - pageKey - }) - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hide Previous Button?', 'quiz-master-next'), - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn, - onChange: () => setAttributes({ - hidePrevBtn: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn ? 0 : 1 - }) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { - allowedBlocks: ['qsm/quiz-question'] - }))); -} - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "./src/page/block.json": -/*!*****************************!*\ - !*** ./src/page/block.json ***! - \*****************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-page","version":"0.1.0","title":"Page","category":"widgets","parent":["qsm/quiz"],"icon":"text-page","description":"QSM Quiz Page","attributes":{"pageID":{"type":"string","default":"0"},"pageKey":{"type":"string","default":""},"hidePrevBtn":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/quizAttr"],"providesContext":{"quiz-master-next/pageID":"pageID"},"example":{},"supports":{"html":false,"multiple":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!***************************!*\ - !*** ./src/page/index.js ***! - \***************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/page/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/page/block.json"); - - - -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] -}); -}(); -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,l=(window.wp.apiFetch,window.wp.blockEditor),a=window.wp.components;const i=e=>null==e||""===e;var o=JSON.parse('{"u2":"qsm/quiz-page"}');(0,e.registerBlockType)(o.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:o,attributes:r,setAttributes:s,isSelected:c,clientId:u,context:m}=e,{pageID:d,pageKey:w,hidePrevBtn:p}=(m["quiz-master-next/quizID"],r),[g,q]=(0,t.useState)(qsmBlockData.globalQuizsetting),B=(0,l.useBlockProps)();return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(l.InspectorControls,null,(0,t.createElement)(a.PanelBody,{title:(0,n.__)("Page settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(a.TextControl,{label:(0,n.__)("Page Name","quiz-master-next"),value:w,onChange:e=>s({pageKey:e})}),(0,t.createElement)(a.ToggleControl,{label:(0,n.__)("Hide Previous Button?","quiz-master-next"),checked:!i(p)&&"1"==p,onChange:()=>s({hidePrevBtn:i(p)||"1"!=p?1:0})}))),(0,t.createElement)("div",{...B},(0,t.createElement)(l.InnerBlocks,{allowedBlocks:["qsm/quiz-question"]})))}})}(); \ No newline at end of file diff --git a/blocks/build/page/index.js.map b/blocks/build/page/index.js.map deleted file mode 100644 index 463208657..000000000 --- a/blocks/build/page/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"page/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;;AAErG;AACO,MAAMC,cAAc,GAAKC,GAAG,IAAM;EACxC,IAAKH,UAAU,CAAEG,GAAI,CAAC,IAAI,CAAEC,KAAK,CAACC,OAAO,CAAEF,GAAI,CAAC,EAAG;IAClD,OAAOA,GAAG;EACX;EACA,OAAOA,GAAG,CAACG,MAAM,CAAE,CAAEC,GAAG,EAAEC,KAAK,EAAEL,GAAG,KAAMA,GAAG,CAACM,OAAO,CAAEF,GAAI,CAAC,KAAKC,KAAM,CAAC;AACzE,CAAC;;AAGD;AACO,MAAME,aAAa,GAAKC,IAAI,IAAM;EACxC,IAAIC,GAAG,GAAGC,QAAQ,CAACC,aAAa,CAAC,UAAU,CAAC;EAC5CF,GAAG,CAACG,SAAS,GAAGJ,IAAI;EACpB,OAAOC,GAAG,CAACI,KAAK;AACjB,CAAC;AAEM,MAAMC,eAAe,GAAKC,IAAI,IAAM;EAC1C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EAAA,CAACwC,gEAAW;IACXgC,aAAa,EAAG,CAAC,mBAAmB;EAAG,CACvC,CACG,CACH,CAAC;AAEJ;;;;;;;;;;AC9DA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCC,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAE1B,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/page/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/page/index.js"],"sourcesContent":["//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const sec = Date.now() * 1000 + Math.random() * 1000;\r\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\r\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tInspectorControls,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n} from '@wordpress/block-editor';\r\nimport {\r\n\tPanelBody,\r\n\tPanelRow,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tRangeControl,\r\n\tRadioControl,\r\n\tSelectControl,\r\n} from '@wordpress/components';\r\nimport { qsmIsEmpty } from '../helper';\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\t\r\n\tconst {\r\n\t\tpageID,\r\n\t\tpageKey,\r\n\t\thidePrevBtn,\r\n\t} = attributes;\r\n\r\n\tconst [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting );\r\n\t\r\n\tconst blockProps = useBlockProps();\r\n\r\n\treturn (\r\n\t<>\r\n\t\r\n\t\t\r\n\t\t\t setAttributes( { pageKey } ) }\r\n\t\t\t/>\r\n\t\t\t setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) }\r\n\t\t\t/>\r\n\t\t\r\n\t\t\r\n\t\r\n\t
\r\n\t\t\r\n\t
\r\n\t\r\n\t);\r\n}\r\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\n\r\nregisterBlockType( metadata.name, {\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n} );\r\n"],"names":["qsmIsEmpty","data","qsmUniqueArray","arr","Array","isArray","filter","val","index","indexOf","qsmDecodeHtml","html","txt","document","createElement","innerHTML","value","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","div","innerText","qsmFormData","obj","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","key","qsmUniqid","prefix","random","sec","Date","now","Math","id","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","quizID","pageID","pageKey","hidePrevBtn","qsmPageAttr","setQsmPageAttr","globalQuizsetting","blockProps","Fragment","title","initialOpen","label","onChange","checked","allowedBlocks","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php index a7c8f44d8..db5936275 100644 --- a/blocks/build/question/index.asset.php +++ b/blocks/build/question/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'a305cd502df35d62e682'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '805ffac9a63872af04cf'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index b68abc284..e640ad15a 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -1,1176 +1,5 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/component/FeaturedImage.js": -/*!****************************************!*\ - !*** ./src/component/FeaturedImage.js ***! - \****************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks"); -/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/blob */ "@wordpress/blob"); -/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blob__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - -/** - * WordPress dependencies - */ - - - - - - - - - - -const ALLOWED_MEDIA_TYPES = ['image']; - -// Used when labels from post type were not yet loaded or when they are not present. -const DEFAULT_FEATURE_IMAGE_LABEL = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Featured image'); -const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Set featured image'); -const instructions = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('To edit the featured image, you need permission to upload media.')); -const FeaturedImage = ({ - featureImageID, - onUpdateImage, - onRemoveImage -}) => { - const { - createNotice - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__.store); - const toggleRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(); - const [isLoading, setIsLoading] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - const [media, setMedia] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(undefined); - const { - mediaFeature, - mediaUpload - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(select => { - const { - getMedia - } = select(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_8__.store); - return { - mediaFeature: (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(media) && !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(featureImageID) && getMedia(featureImageID), - mediaUpload: select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.store).getSettings().mediaUpload - }; - }, []); - - /**Set media data */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(mediaFeature) && 'object' === typeof mediaFeature) { - setMedia({ - id: featureImageID, - width: mediaFeature.media_details.width, - height: mediaFeature.media_details.height, - url: mediaFeature.source_url, - alt_text: mediaFeature.alt_text, - slug: mediaFeature.slug - }); - } - } - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, [mediaFeature]); - function onDropFiles(filesList) { - mediaUpload({ - allowedTypes: ['image'], - filesList, - onFileChange([image]) { - if ((0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_4__.isBlobURL)(image?.url)) { - setIsLoading(true); - return; - } - onUpdateImage(image); - setIsLoading(false); - }, - onError(message) { - createNotice('error', message, { - isDismissible: true, - type: 'snackbar' - }); - } - }); - } - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "editor-post-featured-image" - }, media && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - id: `editor-post-featured-image-${featureImageID}-describedby`, - className: "hidden" - }, media.alt_text && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)( - // Translators: %s: The selected image alt text. - (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)( - // Translators: %s: The selected image filename. - (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('The current image has no alternative text. The file name is: %s'), media.slug)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.MediaUploadCheck, { - fallback: instructions - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.MediaUpload, { - title: DEFAULT_FEATURE_IMAGE_LABEL, - onSelect: media => { - setMedia(media); - onUpdateImage(media); - }, - unstableFeaturedImageFlow: true, - allowedTypes: ALLOWED_MEDIA_TYPES, - modalClass: "editor-post-featured-image__media-modal", - render: ({ - open - }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "editor-post-featured-image__container" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - ref: toggleRef, - className: !featureImageID ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', - onClick: open, - "aria-label": !featureImageID ? null : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Edit or replace the image'), - "aria-describedby": !featureImageID ? null : `editor-post-featured-image-${featureImageID}-describedby` - }, !!featureImageID && media && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ResponsiveWrapper, { - naturalWidth: media.width, - naturalHeight: media.height, - isInline: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { - src: media.url, - alt: media.alt_text - })), isLoading && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Spinner, null), !featureImageID && !isLoading && DEFAULT_SET_FEATURE_IMAGE_LABEL), !!featureImageID && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.__experimentalHStack, { - className: "editor-post-featured-image__actions" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - className: "editor-post-featured-image__action", - onClick: open - // Prefer that screen readers use the .editor-post-featured-image__preview button. - , - "aria-hidden": "true" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Replace')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - className: "editor-post-featured-image__action", - onClick: () => { - onRemoveImage(); - toggleRef.current.focus(); - } - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Remove'))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.DropZone, { - onFilesDrop: onDropFiles - })), - value: featureImageID - }))); -}; -/* harmony default export */ __webpack_exports__["default"] = (FeaturedImage); - -/***/ }), - -/***/ "./src/component/SelectAddCategory.js": -/*!********************************************!*\ - !*** ./src/component/SelectAddCategory.js ***! - \********************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - -/** - * Select or add a category - */ - - - - - -const SelectAddCategory = ({ - isCategorySelected, - setUnsetCatgory -}) => { - //whether showing add category form - const [showForm, setShowForm] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //new category name - const [formCatName, setFormCatName] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(''); - //new category prent id - const [formCatParent, setFormCatParent] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(0); - //new category adding start status - const [addingNewCategory, setAddingNewCategory] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //error - const [newCategoryError, setNewCategoryError] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //category list - const [categories, setCategories] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData?.hierarchicalCategoryList); - - //get category id-details object - const getCategoryIdDetailsObject = categories => { - let catObj = {}; - categories.forEach(cat => { - catObj[cat.id] = cat; - if (0 < cat.children.length) { - let childCategory = getCategoryIdDetailsObject(cat.children); - catObj = { - ...catObj, - ...childCategory - }; - } - }); - return catObj; - }; - - //category id wise details - const [categoryIdDetails, setCategoryIdDetails] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)((0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmIsEmpty)(qsmBlockData?.hierarchicalCategoryList) ? {} : getCategoryIdDetailsObject(qsmBlockData.hierarchicalCategoryList)); - const addNewCategoryLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Category ', 'quiz-master-next'); - const noParentOption = `— ${(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Parent Category ', 'quiz-master-next')} —`; - - //Add new category - const onAddCategory = async event => { - event.preventDefault(); - if (newCategoryError || (0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmIsEmpty)(formCatName) || addingNewCategory) { - return; - } - setAddingNewCategory(true); - - //create a page - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - url: qsmBlockData.ajax_url, - method: 'POST', - body: (0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmFormData)({ - 'action': 'save_new_category', - 'name': formCatName, - 'parent': formCatParent - }) - }).then(res => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmIsEmpty)(res.term_id)) { - let term_id = res.term_id; - //console.log("save_new_category",res); - //set category list - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/hierarchical-category-list', - method: 'POST' - }).then(res => { - // console.log("new categorieslist", res); - if ('success' == res.status) { - setCategories(res.result); - setCategoryIdDetails(res.result); - //set form - setFormCatName(''); - setFormCatParent(0); - //set category selected - setUnsetCatgory(term_id, getCategoryIdDetailsObject(term.id)); - setAddingNewCategory(false); - } - }); - } - }); - }; - - //get category name array - const getCategoryNameArray = categories => { - let cats = []; - categories.forEach(cat => { - cats.push(cat.name); - if (0 < cat.children.length) { - let childCategory = getCategoryNameArray(cat.children); - cats = [...cats, ...childCategory]; - } - }); - return cats; - }; - - //check if category name already exists and set new category name - const checkSetNewCategory = (catName, categories) => { - categories = getCategoryNameArray(categories); - console.log("categories", categories); - if (categories.includes(catName)) { - setNewCategoryError(catName); - } else { - setNewCategoryError(false); - setFormCatName(catName); - } - // categories.forEach( cat => { - // if ( cat.name == catName ) { - // matchName = true; - // return false; - // } else if ( 0 < cat.children.length ) { - // checkSetNewCategory( catName, cat.children ) - // } - // }); - - // if ( matchName ) { - // setNewCategoryError( matchName ); - // } else { - // setNewCategoryError( matchName ); - // setFormCatName( catName ); - // } - }; - - const renderTerms = categories => { - return categories.map(term => { - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - key: term.id, - className: "editor-post-taxonomies__hierarchical-terms-choice" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.CheckboxControl, { - label: term.name, - checked: isCategorySelected(term.id), - onChange: () => setUnsetCatgory(term.id, categoryIdDetails) - }), !!term.children.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "editor-post-taxonomies__hierarchical-terms-subchoices" - }, renderTerms(term.children))); - }); - }; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Categories', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "editor-post-taxonomies__hierarchical-terms-list", - tabIndex: "0", - role: "group", - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Categories', 'quiz-master-next') - }, renderTerms(categories)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "qsm-ptb-1" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - variant: "link", - onClick: () => setShowForm(!showForm) - }, addNewCategoryLabel)), showForm && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("form", { - onSubmit: onAddCategory - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Flex, { - direction: "column", - gap: "1" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.TextControl, { - __nextHasNoMarginBottom: true, - className: "editor-post-taxonomies__hierarchical-terms-input", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Category Name', 'quiz-master-next'), - value: formCatName, - onChange: formCatName => checkSetNewCategory(formCatName, categories), - required: true - }), 0 < categories.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.TreeSelect, { - __nextHasNoMarginBottom: true, - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Parent Category', 'quiz-master-next'), - noOptionLabel: noParentOption, - onChange: id => setFormCatParent(id), - selectedId: formCatParent, - tree: categories - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FlexItem, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - variant: "secondary", - type: "submit", - className: "editor-post-taxonomies__hierarchical-terms-submit", - disabled: newCategoryError || addingNewCategory - }, addNewCategoryLabel)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FlexItem, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { - className: "qsm-error-text" - }, false !== newCategoryError && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Category ', 'quiz-master-next') + newCategoryError + (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)(' already exists.', 'quiz-master-next')))))); -}; -/* harmony default export */ __webpack_exports__["default"] = (SelectAddCategory); - -/***/ }), - -/***/ "./src/component/icon.js": -/*!*******************************!*\ - !*** ./src/component/icon.js ***! - \*******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ answerOptionBlockIcon: function() { return /* binding */ answerOptionBlockIcon; }, -/* harmony export */ qsmBlockIcon: function() { return /* binding */ qsmBlockIcon; }, -/* harmony export */ questionBlockIcon: function() { return /* binding */ questionBlockIcon; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); - - -//QSM Quiz Block -const qsmBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "3", - fill: "black" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z", - fill: "white" - })) -}); - -//Question Block -const questionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "25", - height: "25", - viewBox: "0 0 25 25", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "0.102539", - y: "0.101562", - width: "24", - height: "24", - rx: "4.68852", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z", - fill: "white" - })) -}); - -//Answer option Block -const answerOptionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "4.21657", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z", - fill: "white" - })) -}); - -/***/ }), - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, -/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; - -//Get Unique array values -const qsmUniqueArray = arr => { - if (qsmIsEmpty(arr) || !Array.isArray(arr)) { - return arr; - } - return arr.filter((val, index, arr) => arr.indexOf(val) === index); -}; - -//Decode htmlspecialchars -const qsmDecodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; -}; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from text content. -const qsmStripTags = text => { - let div = document.createElement("div"); - div.innerHTML = qsmDecodeHtml(text); - return div.innerText; -}; - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - //add to check if api call from editor - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//add objecyt to form data -const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { - if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { - return data; - } - for (let key in valueObj) { - if (valueObj.hasOwnProperty(key)) { - let value = valueObj[key]; - if ('object' === value) { - qsmAddObjToFormData(formKey + '[' + key + ']', value, data); - } else { - data.append(formKey + '[' + key + ']', valueObj[key]); - } - } - } - return data; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const sec = Date.now() * 1000 + Math.random() * 1000; - const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "./src/question/edit.js": -/*!******************************!*\ - !*** ./src/question/edit.js ***! - \******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _component_FeaturedImage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../component/FeaturedImage */ "./src/component/FeaturedImage.js"); -/* harmony import */ var _component_SelectAddCategory__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../component/SelectAddCategory */ "./src/component/SelectAddCategory.js"); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - - - - - - - - -//check for duplicate questionID attr -const isQuestionIDReserved = (questionIDCheck, clientIdCheck) => { - const blocksClientIds = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.select)('core/block-editor').getClientIdsWithDescendants(); - return (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(blocksClientIds) ? false : blocksClientIds.some(blockClientId => { - const { - questionID - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.select)('core/block-editor').getBlockAttributes(blockClientId); - //different Client Id but same questionID attribute means duplicate - return clientIdCheck !== blockClientId && questionID === questionIDCheck; - }); -}; - -/** - * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array - * - */ -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId, - context - } = props; - - /** https://github.com/WordPress/gutenberg/issues/22282 */ - const isParentOfSelectedBlock = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => isSelected || select('core/block-editor').hasSelectedInnerBlock(clientId, true)); - const quizID = context['quiz-master-next/quizID']; - const { - quiz_name, - post_id, - rest_nonce - } = context['quiz-master-next/quizAttr']; - const pageID = context['quiz-master-next/pageID']; - const { - createNotice - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__.store); - const { - getBlockRootClientId, - getBlockIndex - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.store); - const { - insertBlock - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.store); - const { - isChanged = false, - //use in editor only to detect if any change occur in this block - questionID, - type, - description, - title, - correctAnswerInfo, - commentBox, - category, - multicategories = [], - hint, - featureImageID, - featureImageSrc, - answers, - answerEditor, - matchAnswer, - required - } = attributes; - const proActivated = '1' == qsmBlockData.is_pro_activated; - const isAdvanceQuestionType = qtype => 14 < parseInt(qtype); - - /**Generate question id if not set or in case duplicate questionID ***/ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetID = true; - if (shouldSetID) { - if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionID) || '0' == questionID || !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionID) && isQuestionIDReserved(questionID, clientId)) { - //create a question - let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ - "id": null, - "rest_nonce": rest_nonce, - "quizID": quizID, - "quiz_name": quiz_name, - "postID": post_id, - "answerEditor": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerEditor, 'text'), - "type": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(type, '0'), - "name": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(description)), - "question_title": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(title), - "answerInfo": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(correctAnswerInfo)), - "comments": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(commentBox, '1'), - "hint": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(hint), - "category": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(category), - "multicategories": [], - "required": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(required, 0), - "answers": answers, - "page": 0, - "featureImageID": featureImageID, - "featureImageSrc": featureImageSrc, - "matchAnswer": null - }); - - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/questions', - method: 'POST', - body: newQuestion - }).then(response => { - if ('success' == response.status) { - let question_id = response.id; - setAttributes({ - questionID: question_id - }); - } - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - } - } - - //cleanup - return () => { - shouldSetID = false; - }; - }, []); - - //detect change in question - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetChanged = true; - if (shouldSetChanged && isSelected && false === isChanged) { - setAttributes({ - isChanged: true - }); - } - - //cleanup - return () => { - shouldSetChanged = false; - }; - }, [questionID, type, description, title, correctAnswerInfo, commentBox, category, multicategories, hint, featureImageID, featureImageSrc, answers, answerEditor, matchAnswer, required]); - - //add classes - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({ - className: isParentOfSelectedBlock ? ' in-editing-mode' : '' - }); - const QUESTION_TEMPLATE = [['qsm/quiz-answer-option', { - optionID: '0' - }], ['qsm/quiz-answer-option', { - optionID: '1' - }]]; - - //Get category ancestor - const getCategoryAncestors = (termId, categories) => { - let parents = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(categories[termId]) && '0' != categories[termId]['parent']) { - termId = categories[termId]['parent']; - parents.push(termId); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(categories[termId]) && '0' != categories[termId]['parent']) { - let ancestor = getCategoryAncestors(termId, categories); - parents = [...parents, ...ancestor]; - } - } - return (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmUniqueArray)(parents); - }; - - //check if a category is selected - const isCategorySelected = termId => multicategories.includes(termId); - - //set or unset category - const setUnsetCatgory = (termId, categories) => { - let multiCat = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(multicategories) || 0 === multicategories.length ? (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(category) ? [] : [category] : multicategories; - - //Case: category unselected - if (multiCat.includes(termId)) { - //remove category if already set - multiCat = multiCat.filter(catID => catID != termId); - let children = []; - //check for if any child is selcted - multiCat.forEach(childCatID => { - //get ancestors of category - let ancestorIds = getCategoryAncestors(childCatID, categories); - //given unselected category is an ancestor of selected category - if (ancestorIds.includes(termId)) { - //remove category if already set - multiCat = multiCat.filter(catID => catID != childCatID); - } - }); - } else { - //add category if not set - multiCat.push(termId); - //get ancestors of category - let ancestorIds = getCategoryAncestors(termId, categories); - //select all ancestor - multiCat = [...multiCat, ...ancestorIds]; - } - multiCat = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmUniqueArray)(multiCat); - setAttributes({ - category: '', - multicategories: [...multiCat] - }); - }; - - //Notes relation to question type - const notes = ['12', '7', '3', '5', '14'].includes(type) ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Note: Add only correct answer options with their respective points score.', 'quiz-master-next') : ''; - - //set Question type - const setQuestionType = qtype => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(MicroModal) && !proActivated && ['15', '16', '17'].includes(qtype)) { - //Show modal for advance question type - let modalEl = document.getElementById('modal-advanced-question-type'); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(modalEl)) { - MicroModal.show('modal-advanced-question-type'); - } - } else { - setAttributes({ - type: qtype - }); - } - }; - const insertNewQuestion = () => { - if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(props?.name)) { - console.log("block name not found"); - return true; - } - const blockToInsert = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__.createBlock)(props.name); - const selectBlockOnInsert = true; - insertBlock(blockToInsert, getBlockIndex(clientId) + 1, getBlockRootClientId(clientId), selectBlockOnInsert); - }; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToolbarGroup, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToolbarButton, { - icon: "plus-alt2", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Question', 'quiz-master-next'), - onClick: () => insertNewQuestion() - }))), isAdvanceQuestionType(type) ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", { - className: "block-editor-block-card__title" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('ID', 'quiz-master-next') + ': ' + questionID), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advanced Question Type', 'quiz-master-next')))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h4", { - className: 'qsm-question-title qsm-error-text' - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advanced Question Type : ', 'quiz-master-next') + title))) : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", { - className: "block-editor-block-card__title" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('ID', 'quiz-master-next') + ': ' + questionID), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: qsmBlockData.question_type.label, - value: type || qsmBlockData.question_type.default, - onChange: type => setQuestionType(type), - help: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(qsmBlockData.question_type_description[type]) ? '' : qsmBlockData.question_type_description[type] + ' ' + notes, - __nextHasNoMarginBottom: true - }, !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(qsmBlockData.question_type.options) && qsmBlockData.question_type.options.map(qtypes => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("optgroup", { - label: qtypes.category, - key: "qtypes" + qtypes.category - }, qtypes.types.map(qtype => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("option", { - value: qtype.slug, - key: "qtype" + qtype.slug, - disabled: proActivated && isAdvanceQuestionType(qtype.slug) - }, qtype.name))))), ['0', '4', '1', '10', '13'].includes(type) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: qsmBlockData.answerEditor.label, - value: answerEditor || qsmBlockData.answerEditor.default, - options: qsmBlockData.answerEditor.options, - onChange: answerEditor => setAttributes({ - answerEditor - }), - __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Required', 'quiz-master-next'), - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(required) && '1' == required, - onChange: () => setAttributes({ - required: !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(required) && '1' == required ? 0 : 1 - }) - })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_SelectAddCategory__WEBPACK_IMPORTED_MODULE_9__["default"], { - isCategorySelected: isCategorySelected, - setUnsetCatgory: setUnsetCatgory - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Featured image', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_FeaturedImage__WEBPACK_IMPORTED_MODULE_8__["default"], { - featureImageID: featureImageID, - onUpdateImage: mediaDetails => { - setAttributes({ - featureImageID: mediaDetails.id, - featureImageSrc: mediaDetails.url - }); - }, - onRemoveImage: id => { - setAttributes({ - featureImageID: undefined, - featureImageSrc: undefined - }); - } - })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: qsmBlockData.commentBox.heading - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: qsmBlockData.commentBox.label, - value: commentBox || qsmBlockData.commentBox.default, - options: qsmBlockData.commentBox.options, - onChange: commentBox => setAttributes({ - commentBox - }), - __nextHasNoMarginBottom: true - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "h4", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Type your question here', 'quiz-master-next'), - value: title, - onChange: title => setAttributes({ - title: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmStripTags)(title) - }), - allowedFormats: [], - withoutInteractiveFormatting: true, - className: 'qsm-question-title' - }), isParentOfSelectedBlock && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Description goes here', 'quiz-master-next'), - value: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)(description), - onChange: description => setAttributes({ - description - }), - className: 'qsm-question-description', - __unstableEmbedURLOnPaste: true, - __unstableAllowPrefixTransformations: true - }), !['8', '11', '6', '9'].includes(type) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { - allowedBlocks: ['qsm/quiz-answer-option'], - template: QUESTION_TEMPLATE - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct answer info goes here', 'quiz-master-next'), - value: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)(correctAnswerInfo), - onChange: correctAnswerInfo => setAttributes({ - correctAnswerInfo - }), - className: 'qsm-question-correct-answer-info', - __unstableEmbedURLOnPaste: true, - __unstableAllowPrefixTransformations: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hint', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hint', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('hint goes here', 'quiz-master-next'), - value: hint, - onChange: hint => setAttributes({ - hint: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmStripTags)(hint) - }), - allowedFormats: [], - withoutInteractiveFormatting: true, - className: 'qsm-question-hint' - }))))); -} - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/blob": -/*!******************************!*\ - !*** external ["wp","blob"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blob"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/core-data": -/*!**********************************!*\ - !*** external ["wp","coreData"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["coreData"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/hooks": -/*!*******************************!*\ - !*** external ["wp","hooks"] ***! - \*******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["hooks"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "@wordpress/notices": -/*!*********************************!*\ - !*** external ["wp","notices"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["notices"]; - -/***/ }), - -/***/ "./src/question/block.json": -/*!*********************************!*\ - !*** ./src/question/block.json ***! - \*********************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-question","version":"0.1.0","title":"Question","category":"widgets","parent":["qsm/quiz-page"],"icon":"move","description":"QSM Quiz Question","attributes":{"isChanged":{"type":"string","default":false},"questionID":{"type":"string","default":"0"},"type":{"type":"string","default":"0"},"description":{"type":"string","source":"html","selector":"p","default":""},"title":{"type":"string","default":""},"correctAnswerInfo":{"type":"string","source":"html","selector":"p","default":""},"commentBox":{"type":"string","default":"0"},"category":{"type":"number"},"multicategories":{"type":"array"},"hint":{"type":"string"},"featureImageID":{"type":"number"},"featureImageSrc":{"type":"string"},"answers":{"type":"array"},"answerEditor":{"type":"string","default":"text"},"matchAnswer":{"type":"string","default":"random"},"required":{"type":"string","default":"0"},"media":{"type":"object"},"settings":{"type":"object"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/quizAttr"],"providesContext":{"quiz-master-next/questionID":"questionID","quiz-master-next/questionType":"type","quiz-master-next/answerType":"answerEditor","quiz-master-next/questionChanged":"isChanged"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!*******************************!*\ - !*** ./src/question/index.js ***! - \*******************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/question/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/question/block.json"); -/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../component/icon */ "./src/component/icon.js"); - - - - -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { - icon: _component_icon__WEBPACK_IMPORTED_MODULE_3__.questionBlockIcon, - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] -}); -}(); -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch,o=e.n(r),i=window.wp.blockEditor,l=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,p=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=_(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],E=(0,n.__)("Featured image"),w=(0,n.__)("Set featured image"),x=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media."));var C=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:o}=(0,s.useDispatch)(l.store),p=(0,a.useRef)(),[_,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:C,mediaUpload:y}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function b(e){y({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){o("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(C)||"object"!=typeof C||q({id:e,width:C.media_details.width,height:C.media_details.height,url:C.source_url,alt_text:C.alt_text,slug:C.slug})),()=>{t=!1}}),[C]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( +// Translators: %s: The selected image alt text. +(0,n.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,n.sprintf)( +// Translators: %s: The selected image filename. +(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:E,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:p,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),_&&(0,a.createElement)(c.Spinner,null),!e&&!_&&w),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),p.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:b})),value:e})))},y=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[p,_]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,E]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),w=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,x)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},B(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},B(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},y)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(l)||p||(_(!0),o()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;o()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(E(e.result),C(e.result),s(""),u(0),t(a,w(term.id)),_(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:l,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||p},y)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},b=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(b.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:r,attributes:m,setAttributes:u,isSelected:f,clientId:E,context:w}=e,x=(0,s.useSelect)((e=>f||e("core/block-editor").hasSelectedInnerBlock(E,!0))),b=w["quiz-master-next/quizID"],{quiz_name:k,post_id:B,rest_nonce:I}=w["quiz-master-next/quizAttr"],{createNotice:v}=(w["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{getBlockRootClientId:D,getBlockIndex:z}=(0,s.useSelect)(i.store),{insertBlock:N}=(0,s.useDispatch)(i.store),{isChanged:S=!1,questionID:T,type:A,description:F,title:P,correctAnswerInfo:M,commentBox:O,category:R,multicategories:L=[],hint:U,featureImageID:H,featureImageSrc:Q,answers:j,answerEditor:W,matchAnswer:Z,required:$}=m,G="1"==qsmBlockData.is_pro_activated,J=e=>14{let e=!0;if(e&&(d(T)||"0"==T||!d(T)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(T,E))){let e=h({id:null,rest_nonce:I,quizID:b,quiz_name:k,postID:B,answerEditor:q(W,"text"),type:q(A,"0"),name:_(q(F)),question_title:q(P),answerInfo:_(q(M)),comments:q(O,"1"),hint:q(U),category:q(R),multicategories:[],required:q($,0),answers:j,page:0,featureImageID:H,featureImageSrc:Q,matchAnswer:null});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;u({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&f&&!1===S&&u({isChanged:!0}),()=>{e=!1}}),[T,A,F,P,M,O,R,L,U,H,Q,j,W,Z,$]);const K=(0,i.useBlockProps)({className:x?" in-editing-mode":""}),V=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=V(e,t);a=[...a,...n]}return p(a)},X=["12","7","3","5","14"].includes(A)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"";return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>(()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);N(a,z(E)+1,D(E),!0)})()}))),J(A)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+T),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...K},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+P))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+T),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:A||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||G||!["15","16","17"].includes(e))u({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[A])?"":qsmBlockData.question_type_description[A]+" "+X,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug,disabled:G&&J(e.slug)},e.name))))))),["0","4","1","10","13"].includes(A)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:W||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>u({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d($)&&"1"==$,onChange:()=>u({required:d($)||"1"!=$?1:0})})),(0,a.createElement)(y,{isCategorySelected:e=>L.includes(e),setUnsetCatgory:(e,t)=>{let a=d(L)||0===L.length?d(R)?[]:[R]:L;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{V(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=V(e,t);a=[...a,...n]}a=p(a),u({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(C,{featureImageID:H,onUpdateImage:e=>{u({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{u({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:O||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>u({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...K},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:P,onChange:e=>u({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),x&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here","quiz-master-next"),value:_(F),onChange:e=>u({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(A)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:_(M),onChange:e=>u({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Hint","quiz-master-next"),"aria-label":(0,n.__)("Hint","quiz-master-next"),placeholder:(0,n.__)("hint goes here","quiz-master-next"),value:U,onChange:e=>u({hint:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"})))))}})}(); \ No newline at end of file diff --git a/blocks/build/question/index.js.map b/blocks/build/question/index.js.map deleted file mode 100644 index f4f0f3ea9..000000000 --- a/blocks/build/question/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"question/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAC8C;AACE;AASjB;AACa;AACqB;AACN;AACgC;AAK1D;AACyB;AACnB;AAEvC,MAAM2B,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG5B,mDAAE,CAAE,gBAAiB,CAAC;AAC1D,MAAM6B,+BAA+B,GAAG7B,mDAAE,CAAE,oBAAqB,CAAC;AAElE,MAAM8B,YAAY,GACjBC,iEAAA,YACG/B,mDAAE,CACH,kEACD,CACE,CACH;AAED,MAAMgC,aAAa,GAAGA,CAAE;EACvBC,cAAc;EACdC,aAAa;EACbC;AACD,CAAC,KAAM;EACN,MAAM;IAAEC;EAAa,CAAC,GAAGnB,4DAAW,CAAED,qDAAa,CAAC;EACpD,MAAMqB,SAAS,GAAGxB,0DAAM,CAAC,CAAC;EAC1B,MAAM,CAAEyB,S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ACM,8DAAiB;EACtB;AACD;AACA;EACC+I,IAAI,EAAEhF,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/component/FeaturedImage.js","webpack://qsm/./src/component/SelectAddCategory.js","webpack://qsm/./src/component/icon.js","webpack://qsm/./src/helper.js","webpack://qsm/./src/question/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blob\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"hooks\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/question/index.js"],"sourcesContent":["/**\r\n * WordPress dependencies\r\n */\r\nimport { __, sprintf } from '@wordpress/i18n';\r\nimport { applyFilters } from '@wordpress/hooks';\r\nimport {\r\n\tDropZone,\r\n\tButton,\r\n\tSpinner,\r\n\tResponsiveWrapper,\r\n\twithNotices,\r\n\twithFilters,\r\n\t__experimentalHStack as HStack,\r\n} from '@wordpress/components';\r\nimport { isBlobURL } from '@wordpress/blob';\r\nimport { useState, useRef, useEffect } from '@wordpress/element';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect, select, withDispatch, withSelect } from '@wordpress/data';\r\nimport {\r\n\tMediaUpload,\r\n\tMediaUploadCheck,\r\n\tstore as blockEditorStore,\r\n} from '@wordpress/block-editor';\r\nimport { store as coreStore } from '@wordpress/core-data';\r\nimport { qsmIsEmpty } from '../helper';\r\n\r\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\r\n\r\n// Used when labels from post type were not yet loaded or when they are not present.\r\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\r\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\r\n\r\nconst instructions = (\r\n\t

\r\n\t\t{ __(\r\n\t\t\t'To edit the featured image, you need permission to upload media.'\r\n\t\t) }\r\n\t

\r\n);\r\n\r\nconst FeaturedImage = ( {\r\n\tfeatureImageID,\r\n\tonUpdateImage,\r\n\tonRemoveImage\r\n} ) => {\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\tconst toggleRef = useRef();\r\n\tconst [ isLoading, setIsLoading ] = useState( false );\r\n\tconst [ media, setMedia ] = useState( undefined );\r\n\tconst { mediaFeature, mediaUpload } = useSelect( ( select ) => {\r\n\t\tconst { getMedia } = select( coreStore );\r\n\t\t\treturn {\r\n\t\t\t\tmediaFeature: qsmIsEmpty( media ) && ! qsmIsEmpty( featureImageID ) && getMedia( featureImageID ),\r\n\t\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload \r\n\t\t\t};\r\n\t}, [] );\r\n\r\n\t/**Set media data */\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetQSMAttr = true;\r\n\t\tif ( shouldSetQSMAttr ) {\r\n\t\t\tif ( ! qsmIsEmpty( mediaFeature ) && 'object' === typeof mediaFeature ) {\r\n\t\t\t\tsetMedia({\r\n\t\t\t\t\tid: featureImageID,\r\n\t\t\t\t\twidth: mediaFeature.media_details.width, \r\n\t\t\t\t\theight: mediaFeature.media_details.height, \r\n\t\t\t\t\turl: mediaFeature.source_url,\r\n\t\t\t\t\talt_text: mediaFeature.alt_text,\r\n\t\t\t\t\tslug: mediaFeature.slug\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetQSMAttr = false;\r\n\t\t};\r\n\t\t\r\n\t}, [ mediaFeature ] );\r\n\r\n\tfunction onDropFiles( filesList ) {\r\n\t\tmediaUpload( {\r\n\t\t\tallowedTypes: [ 'image' ],\r\n\t\t\tfilesList,\r\n\t\t\tonFileChange( [ image ] ) {\r\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\r\n\t\t\t\t\tsetIsLoading( true );\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tonUpdateImage( image );\r\n\t\t\t\tsetIsLoading( false );\r\n\t\t\t},\r\n\t\t\tonError( message ) {\r\n\t\t\t\tcreateNotice( 'error', message, {\r\n\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t} );\r\n\t\t\t},\r\n\t\t} );\r\n\t}\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t{ media && (\r\n\t\t\t\t\r\n\t\t\t\t\t{ media.alt_text &&\r\n\t\t\t\t\t\tsprintf(\r\n\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\r\n\t\t\t\t\t\t\t__( 'Current image: %s' ),\r\n\t\t\t\t\t\t\tmedia.alt_text\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t\t{ ! media.alt_text &&\r\n\t\t\t\t\t\tsprintf(\r\n\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\r\n\t\t\t\t\t\t\t__(\r\n\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\r\n\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\tmedia.slug\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t
\r\n\t\t\t) }\r\n\t\t\t\r\n\t\t\t\t { \r\n\t\t\t\t\t\tsetMedia( media );\r\n\t\t\t\t\t\tonUpdateImage( media );\r\n\t\t\t\t\t} }\r\n\t\t\t\t\tunstableFeaturedImageFlow\r\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\r\n\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\r\n\t\t\t\t\trender={ ( { open } ) => (\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t{ !! featureImageID && media && (\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\t\t{ isLoading && }\r\n\t\t\t\t\t\t\t\t{ ! featureImageID &&\r\n\t\t\t\t\t\t\t\t\t! isLoading &&\r\n\t\t\t\t\t\t\t\t\t(\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t{ !! featureImageID && (\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\r\n\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\r\n\t\t\t\t\t\t\t\t\t\t} }\r\n\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t) }\r\n\t\t\t\t\tvalue={ featureImageID }\r\n\t\t\t\t/>\r\n\t\t\t
\r\n\t\t
\r\n\t);\r\n}\r\n\r\nexport default FeaturedImage;","/**\r\n * Select or add a category\r\n */\r\nimport { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tPanelBody,\r\n Button,\r\n TreeSelect,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tRangeControl,\r\n\tRadioControl,\r\n\tSelectControl,\r\n\tCheckboxControl,\r\n Flex,\r\n FlexItem,\r\n} from '@wordpress/components';\r\nimport { qsmIsEmpty, qsmFormData } from '../helper';\r\n\r\nconst SelectAddCategory = ({\r\n isCategorySelected,\r\n setUnsetCatgory\r\n}) => {\r\n\r\n //whether showing add category form\r\n\tconst [ showForm, setShowForm ] = useState( false );\r\n //new category name\r\n const [ formCatName, setFormCatName ] = useState( '' );\r\n //new category prent id\r\n const [ formCatParent, setFormCatParent ] = useState( 0 );\r\n //new category adding start status\r\n const [ addingNewCategory, setAddingNewCategory ] = useState( false );\r\n //error\r\n const [ newCategoryError, setNewCategoryError ] = useState( false );\r\n //category list \r\n const [ categories, setCategories ] = useState( qsmBlockData?.hierarchicalCategoryList );\r\n\r\n //get category id-details object \r\n const getCategoryIdDetailsObject = ( categories ) => {\r\n let catObj = {};\r\n categories.forEach( cat => {\r\n catObj[ cat.id ] = cat;\r\n if ( 0 < cat.children.length ) {\r\n let childCategory = getCategoryIdDetailsObject( cat.children );\r\n catObj = { ...catObj, ...childCategory };\r\n }\r\n });\r\n return catObj;\r\n }\r\n\r\n //category id wise details\r\n const [ categoryIdDetails, setCategoryIdDetails ] = useState( qsmIsEmpty( qsmBlockData?.hierarchicalCategoryList ) ? {} : getCategoryIdDetailsObject( qsmBlockData.hierarchicalCategoryList ) );\r\n\r\n const addNewCategoryLabel = __( 'Add New Category ', 'quiz-master-next' );\r\n const noParentOption = `— ${ __( 'Parent Category ', 'quiz-master-next' ) } —`;\r\n\r\n //Add new category\r\n const onAddCategory = async ( event ) => {\r\n\t\tevent.preventDefault();\r\n\t\tif ( newCategoryError || qsmIsEmpty( formCatName ) || addingNewCategory ) {\r\n\t\t\treturn;\r\n\t\t}\r\n setAddingNewCategory( true );\r\n\r\n //create a page\r\n apiFetch( {\r\n url: qsmBlockData.ajax_url,\r\n method: 'POST',\r\n body: qsmFormData({\r\n 'action': 'save_new_category',\r\n 'name': formCatName,\r\n 'parent': formCatParent \r\n })\r\n } ).then( ( res ) => {\r\n if ( ! qsmIsEmpty( res.term_id ) ) {\r\n let term_id = res.term_id;\r\n //console.log(\"save_new_category\",res);\r\n //set category list\r\n apiFetch( {\r\n path: '/quiz-survey-master/v1/quiz/hierarchical-category-list',\r\n method: 'POST'\r\n } ).then( ( res ) => {\r\n // console.log(\"new categorieslist\", res);\r\n if ( 'success' == res.status ) {\r\n setCategories( res.result );\r\n setCategoryIdDetails( res.result );\r\n //set form\r\n setFormCatName( '' );\r\n setFormCatParent( 0 );\r\n //set category selected\r\n setUnsetCatgory( term_id, getCategoryIdDetailsObject( term.id ) );\r\n setAddingNewCategory( false );\r\n }\r\n });\r\n \r\n }\r\n \r\n });\r\n }\r\n\r\n //get category name array\r\n const getCategoryNameArray = ( categories ) => {\r\n let cats = [];\r\n categories.forEach( cat => {\r\n cats.push( cat.name );\r\n if ( 0 < cat.children.length ) {\r\n let childCategory = getCategoryNameArray( cat.children );\r\n cats = [ ...cats, ...childCategory ];\r\n }\r\n });\r\n return cats;\r\n }\r\n\r\n //check if category name already exists and set new category name\r\n const checkSetNewCategory = ( catName, categories ) => {\r\n categories = getCategoryNameArray( categories );\r\n console.log( \"categories\", categories );\r\n if ( categories.includes( catName ) ) {\r\n setNewCategoryError( catName );\r\n } else {\r\n setNewCategoryError( false );\r\n setFormCatName( catName );\r\n }\r\n // categories.forEach( cat => {\r\n // if ( cat.name == catName ) {\r\n // matchName = true;\r\n // return false;\r\n // } else if ( 0 < cat.children.length ) {\r\n // checkSetNewCategory( catName, cat.children )\r\n // }\r\n // });\r\n \r\n // if ( matchName ) {\r\n // setNewCategoryError( matchName );\r\n // } else {\r\n // setNewCategoryError( matchName );\r\n // setFormCatName( catName );\r\n // }\r\n }\r\n\r\n const renderTerms = ( categories ) => {\r\n\t\treturn categories.map( ( term ) => {\r\n\t\t\treturn (\r\n\t\t\t\t\r\n\t\t\t\t\t setUnsetCatgory( term.id, categoryIdDetails ) }\r\n />\r\n\t\t\t\t\t{ !! term.children.length && (\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t{ renderTerms( term.children ) }\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t) }\r\n\t\t\t\t
\r\n\t\t\t);\r\n\t\t} );\r\n\t};\r\n \r\n return(\r\n \r\n \r\n\t\t\t\t{ renderTerms( categories ) }\r\n\t\t\t
\r\n
\r\n \r\n
\r\n { showForm && (\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t checkSetNewCategory( formCatName, categories ) }\r\n\t\t\t\t\t\t\trequired\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t{ 0 < categories.length && (\r\n\t\t\t\t\t\t\t setFormCatParent( id ) }\r\n\t\t\t\t\t\t\t\tselectedId={ formCatParent }\r\n\t\t\t\t\t\t\t\ttree={ categories }\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t{ addNewCategoryLabel }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n \r\n

\r\n { false !== newCategoryError && __( 'Category ', 'quiz-master-next' ) + newCategoryError + __( ' already exists.', 'quiz-master-next' ) }\r\n

\r\n
\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t) }\r\n\t\t\r\n );\r\n}\r\n\r\nexport default SelectAddCategory;","import { Icon } from '@wordpress/components';\r\n//QSM Quiz Block\r\nexport const qsmBlockIcon = () => (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const sec = Date.now() * 1000 + Math.random() * 1000;\r\n const id = sec.toString(16).replace(/\\./g, \"\").padEnd(8, \"0\");\r\n return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tInspectorControls,\r\n\tRichText,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n\tstore as blockEditorStore,\r\n\tBlockControls,\r\n} from '@wordpress/block-editor';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect, select } from '@wordpress/data';\r\nimport { createBlock } from '@wordpress/blocks';\r\nimport {\r\n\tPanelBody,\r\n\tToggleControl,\r\n\tSelectControl,\r\n\tToolbarGroup, \r\n\tToolbarButton,\r\n} from '@wordpress/components';\r\nimport FeaturedImage from '../component/FeaturedImage';\r\nimport SelectAddCategory from '../component/SelectAddCategory';\r\nimport { qsmIsEmpty, qsmStripTags, qsmFormData, qsmValueOrDefault, qsmDecodeHtml, qsmUniqueArray } from '../helper';\r\n\r\n\r\n//check for duplicate questionID attr\r\nconst isQuestionIDReserved = ( questionIDCheck, clientIdCheck ) => {\r\n const blocksClientIds = select( 'core/block-editor' ).getClientIdsWithDescendants();\r\n return qsmIsEmpty( blocksClientIds ) ? false : blocksClientIds.some( ( blockClientId ) => {\r\n const { questionID } = select( 'core/block-editor' ).getBlockAttributes( blockClientId );\r\n\t\t//different Client Id but same questionID attribute means duplicate\r\n return clientIdCheck !== blockClientId && questionID === questionIDCheck;\r\n } );\r\n};\r\n\r\n/**\r\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\r\n * \r\n */\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\t\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\r\n\r\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\r\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\tconst {\r\n\t\tquiz_name,\r\n\t\tpost_id,\r\n\t\trest_nonce\r\n\t} = context['quiz-master-next/quizAttr'];\r\n\tconst pageID = context['quiz-master-next/pageID'];\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\tconst { \r\n\t\tgetBlockRootClientId, \r\n\t\tgetBlockIndex \r\n\t} = useSelect( blockEditorStore );\r\n\tconst {\r\n\t\tinsertBlock\r\n\t} = useDispatch( blockEditorStore );\r\n\r\n\tconst {\r\n\t\tisChanged = false,//use in editor only to detect if any change occur in this block\r\n\t\tquestionID,\r\n\t\ttype,\r\n\t\tdescription,\r\n\t\ttitle,\r\n\t\tcorrectAnswerInfo,\r\n\t\tcommentBox,\r\n\t\tcategory,\r\n\t\tmulticategories=[],\r\n\t\thint,\r\n\t\tfeatureImageID,\r\n\t\tfeatureImageSrc,\r\n\t\tanswers,\r\n\t\tanswerEditor,\r\n\t\tmatchAnswer,\r\n\t\trequired,\r\n\t} = attributes;\r\n\t\r\n\tconst proActivated = ( '1' == qsmBlockData.is_pro_activated );\r\n\tconst isAdvanceQuestionType = ( qtype ) => 14 < parseInt( qtype );\r\n\t\r\n\t/**Generate question id if not set or in case duplicate questionID ***/\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetID = true;\r\n\t\tif ( shouldSetID ) {\r\n\t\t\r\n\t\t\tif ( qsmIsEmpty( questionID ) || '0' == questionID || ( ! qsmIsEmpty( questionID ) && isQuestionIDReserved( questionID, clientId ) ) ) {\r\n\t\t\t\t\r\n\t\t\t\t//create a question\r\n\t\t\t\tlet newQuestion = qsmFormData( {\r\n\t\t\t\t\t\"id\": null,\r\n\t\t\t\t\t\"rest_nonce\": rest_nonce,\r\n\t\t\t\t\t\"quizID\": quizID,\r\n\t\t\t\t\t\"quiz_name\": quiz_name,\r\n\t\t\t\t\t\"postID\": post_id,\r\n\t\t\t\t\t\"answerEditor\": qsmValueOrDefault( answerEditor, 'text' ),\r\n\t\t\t\t\t\"type\": qsmValueOrDefault( type , '0' ),\r\n\t\t\t\t\t\"name\": qsmDecodeHtml( qsmValueOrDefault( description ) ),\r\n\t\t\t\t\t\"question_title\": qsmValueOrDefault( title ),\r\n\t\t\t\t\t\"answerInfo\": qsmDecodeHtml( qsmValueOrDefault( correctAnswerInfo ) ),\r\n\t\t\t\t\t\"comments\": qsmValueOrDefault( commentBox, '1' ),\r\n\t\t\t\t\t\"hint\": qsmValueOrDefault( hint ),\r\n\t\t\t\t\t\"category\": qsmValueOrDefault( category ),\r\n\t\t\t\t\t\"multicategories\": [],\r\n\t\t\t\t\t\"required\": qsmValueOrDefault( required, 0 ),\r\n\t\t\t\t\t\"answers\": answers,\r\n\t\t\t\t\t\"page\": 0,\r\n\t\t\t\t\t\"featureImageID\": featureImageID,\r\n\t\t\t\t\t\"featureImageSrc\": featureImageSrc,\r\n\t\t\t\t\t\"matchAnswer\": null,\r\n\t\t\t\t} );\r\n\r\n\t\t\t\t//AJAX call\r\n\t\t\t\tapiFetch( {\r\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\r\n\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\tbody: newQuestion\r\n\t\t\t\t} ).then( ( response ) => {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ( 'success' == response.status ) {\r\n\t\t\t\t\t\tlet question_id = response.id;\r\n\t\t\t\t\t\tsetAttributes( { questionID: question_id } );\r\n\t\t\t\t\t}\r\n\t\t\t\t}).catch(\r\n\t\t\t\t\t( error ) => {\r\n\t\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetID = false;\r\n\t\t};\r\n\t\t\r\n\t}, [] );\r\n\r\n\t//detect change in question\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetChanged = true;\r\n\t\tif ( shouldSetChanged && isSelected && false === isChanged ) {\r\n\t\t\t\r\n\t\t\tsetAttributes( { isChanged: true } );\r\n\t\t}\r\n\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetChanged = false;\r\n\t\t};\r\n\t}, [\r\n\t\tquestionID,\r\n\t\ttype,\r\n\t\tdescription,\r\n\t\ttitle,\r\n\t\tcorrectAnswerInfo,\r\n\t\tcommentBox,\r\n\t\tcategory,\r\n\t\tmulticategories,\r\n\t\thint,\r\n\t\tfeatureImageID,\r\n\t\tfeatureImageSrc,\r\n\t\tanswers,\r\n\t\tanswerEditor,\r\n\t\tmatchAnswer,\r\n\t\trequired,\r\n\t] )\r\n\r\n\t//add classes\r\n\tconst blockProps = useBlockProps( {\r\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\r\n\t} );\r\n\r\n\tconst QUESTION_TEMPLATE = [\r\n\t\t[\r\n\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t{\r\n\t\t\t\toptionID:'0'\r\n\t\t\t}\r\n\t\t],\r\n\t\t[\r\n\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t{\r\n\t\t\t\toptionID:'1'\r\n\t\t\t}\r\n\t\t]\r\n\r\n\t];\r\n\r\n\t//Get category ancestor\r\n\tconst getCategoryAncestors = ( termId, categories ) => {\r\n\t\tlet parents = [];\r\n\t\tif ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) {\r\n\t\t\ttermId = categories[ termId ]['parent'];\r\n\t\t\tparents.push( termId );\r\n\t\t\tif ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) {\r\n\t\t\t\tlet ancestor = getCategoryAncestors( termId, categories );\r\n\t\t\t\tparents = [ ...parents, ...ancestor ];\r\n\t\t\t}\r\n\t\t} \r\n\t\t\r\n\t\treturn qsmUniqueArray( parents );\r\n\t }\r\n\r\n\t//check if a category is selected\r\n\tconst isCategorySelected = ( termId ) => multicategories.includes( termId );\r\n\r\n\t//set or unset category\r\n\tconst setUnsetCatgory = ( termId, categories ) => {\r\n\t\tlet multiCat = ( qsmIsEmpty( multicategories ) || 0 === multicategories.length ) ? ( qsmIsEmpty( category ) ? [] : [ category ] ) : multicategories;\r\n\t\t\r\n\t\t//Case: category unselected\r\n\t\tif ( multiCat.includes( termId ) ) {\r\n\t\t\t//remove category if already set\r\n\t\t\tmultiCat = multiCat.filter( catID => catID != termId );\r\n\t\t\tlet children = [];\r\n\t\t\t//check for if any child is selcted \r\n\t\t\tmultiCat.forEach( childCatID => {\r\n\t\t\t\t//get ancestors of category\r\n\t\t\t\tlet ancestorIds = getCategoryAncestors( childCatID, categories );\r\n\t\t\t\t//given unselected category is an ancestor of selected category\r\n\t\t\t\tif ( ancestorIds.includes( termId ) ) {\r\n\t\t\t\t\t//remove category if already set\r\n\t\t\t\t\tmultiCat = multiCat.filter( catID => catID != childCatID );\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t//add category if not set\r\n\t\t\tmultiCat.push( termId );\r\n\t\t\t//get ancestors of category\r\n\t\t\tlet ancestorIds = getCategoryAncestors( termId, categories );\r\n\t\t\t//select all ancestor\r\n\t\t\tmultiCat = [ ...multiCat, ...ancestorIds ];\r\n\t\t}\r\n\r\n\t\tmultiCat = qsmUniqueArray( multiCat );\r\n\r\n\t\tsetAttributes({ \r\n\t\t\tcategory: '',\r\n\t\t\tmulticategories: [ ...multiCat ]\r\n\t\t});\r\n\t}\r\n\r\n\t//Notes relation to question type\r\n\tconst notes = ['12','7','3','5','14'].includes( type ) ? __( 'Note: Add only correct answer options with their respective points score.', 'quiz-master-next' ) : '';\r\n\r\n\t//set Question type\r\n\tconst setQuestionType = ( qtype ) => {\r\n\t\tif ( ! qsmIsEmpty( MicroModal ) && ! proActivated && ['15', '16', '17'].includes( qtype ) ) {\r\n\t\t\t//Show modal for advance question type\r\n\t\t\tlet modalEl = document.getElementById('modal-advanced-question-type');\r\n\t\t\tif ( ! qsmIsEmpty( modalEl ) ) {\r\n\t\t\t\tMicroModal.show('modal-advanced-question-type');\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tsetAttributes( { type: qtype } );\r\n\t\t}\r\n\t}\r\n\r\n\tconst insertNewQuestion = () => {\r\n\t\tif ( qsmIsEmpty( props?.name )) {\r\n\t\t\tconsole.log(\"block name not found\");\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tconst blockToInsert = createBlock( props.name );\r\n\t\tconst selectBlockOnInsert = true;\r\n\t\tinsertBlock(\r\n\t\t\tblockToInsert,\r\n\t\t\tgetBlockIndex( clientId ) + 1,\r\n\t\t\tgetBlockRootClientId( clientId ),\r\n\t\t\tselectBlockOnInsert\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t<>\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t insertNewQuestion() }\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t\r\n\t { isAdvanceQuestionType( type ) ? (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\r\n\t\t\t\t\t

{ __( 'Advanced Question Type', 'quiz-master-next' ) }

\r\n\t\t\t\t
\r\n\t\t\t
\t\r\n\t\t\t
\r\n\t\t\t

{ __( 'Advanced Question Type : ', 'quiz-master-next' ) + title }

\r\n\t\t\t
\r\n\t\t\r\n\t\t):(\r\n\t\t<>\r\n\t\t\r\n\t\t\t\r\n\t\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\r\n\t\t\t{ /** Question Type **/ }\r\n\t\t\t\r\n\t\t\t\t\tsetQuestionType( type )\r\n\t\t\t\t}\r\n\t\t\t\thelp={ qsmIsEmpty( qsmBlockData.question_type_description[ type ] ) ? '' : qsmBlockData.question_type_description[ type ]+' '+notes }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t>\r\n\t\t\t\t{\r\n\t\t\t\t! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \r\n\t\t\t\t\t(\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tqtypes.types.map( qtype => \r\n\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t)\r\n\t\t\t\t\t)\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t{/**Answer Type */}\r\n\t\t\t{\r\n\t\t\t\t['0','4','1','10','13'].includes( type ) && \r\n\t\t\t\t\r\n\t\t\t\t\t\tsetAttributes( { answerEditor } )\r\n\t\t\t\t\t}\r\n\t\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\t setAttributes( { required : ( ( ! qsmIsEmpty( required ) && '1' == required ) ? 0 : 1 ) } ) }\r\n\t\t\t/>\r\n\t\t\t
\r\n\t\t\t{/**Categories */}\r\n\t\t\t\r\n\t\t\t{/**Feature Image */}\r\n\t\t\t\r\n\t\t\t\t {\r\n\t\t\t\t\tsetAttributes({ \r\n\t\t\t\t\t\tfeatureImageID: mediaDetails.id,\r\n\t\t\t\t\t\tfeatureImageSrc: mediaDetails.url\r\n\t\t\t\t\t});\r\n\t\t\t\t} }\r\n\t\t\t\tonRemoveImage={ ( id ) => {\r\n\t\t\t\t\tsetAttributes({ \r\n\t\t\t\t\t\tfeatureImageID: undefined,\r\n\t\t\t\t\t\tfeatureImageSrc: undefined,\r\n\t\t\t\t\t});\r\n\t\t\t\t} }\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t\t{/**Comment Box */}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\tsetAttributes( { commentBox } )\r\n\t\t\t\t}\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t\t\r\n\t\t
\r\n\t\t
\r\n\t\t\t setAttributes( { title: qsmStripTags( title ) } ) }\r\n\t\t\t\tallowedFormats={ [ ] }\r\n\t\t\t\twithoutInteractiveFormatting\r\n\t\t\t\tclassName={ 'qsm-question-title' }\r\n\t\t\t/>\r\n\t\t\t{\r\n\t\t\t\tisParentOfSelectedBlock && \r\n\t\t\t\t<>\r\n\t\t\t\t setAttributes({ description }) }\r\n\t\t\t\t\tclassName={ 'qsm-question-description' }\r\n\t\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t\t/>\r\n\t\t\t\t{\r\n\t\t\t\t\t! ['8','11','6','9'].includes( type ) &&\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t setAttributes({ correctAnswerInfo }) }\r\n\t\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\r\n\t\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t\t/>\r\n\t\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\r\n\t\t\t\t\tallowedFormats={ [ ] }\r\n\t\t\t\t\twithoutInteractiveFormatting\r\n\t\t\t\t\tclassName={ 'qsm-question-hint' }\r\n\t\t\t\t/>\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t
\r\n\t\t\r\n\t\t)\r\n\t}\r\n\t\r\n\t);\r\n}\r\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blob\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"hooks\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { questionBlockIcon } from \"../component/icon\";\r\n\r\nregisterBlockType( metadata.name, {\r\n\ticon:questionBlockIcon,\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n} );\r\n"],"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","ResponsiveWrapper","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","useEffect","store","noticesStore","useDispatch","useSelect","select","withDispatch","withSelect","MediaUpload","MediaUploadCheck","blockEditorStore","coreStore","qsmIsEmpty","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","createElement","FeaturedImage","featureImageID","onUpdateImage","onRemoveImage","createNotice","toggleRef","isLoading","setIsLoading","media","setMedia","undefined","mediaFeature","mediaUpload","getMedia","getSettings","shouldSetQSMAttr","id","width","media_details","height","url","source_url","alt_text","slug","onDropFiles","filesList","allowedTypes","onFileChange","image","onError","message","isDismissible","type","className","fallback","title","onSelect","unstableFeaturedImageFlow","modalClass","render","open","ref","onClick","naturalWidth","naturalHeight","isInline","src","alt","current","focus","onFilesDrop","value","apiFetch","PanelBody","TreeSelect","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","CheckboxControl","Flex","FlexItem","qsmFormData","SelectAddCategory","isCategorySelected","setUnsetCatgory","showForm","setShowForm","formCatName","setFormCatName","formCatParent","setFormCatParent","addingNewCategory","setAddingNewCategory","newCategoryError","setNewCategoryError","categories","setCategories","qsmBlockData","hierarchicalCategoryList","getCategoryIdDetailsObject","catObj","forEach","cat","children","length","childCategory","categoryIdDetails","setCategoryIdDetails","addNewCategoryLabel","noParentOption","onAddCategory","event","preventDefault","ajax_url","method","body","then","res","term_id","path","status","result","term","getCategoryNameArray","cats","push","name","checkSetNewCategory","catName","console","log","includes","renderTerms","map","key","label","checked","onChange","initialOpen","tabIndex","role","variant","onSubmit","direction","gap","__nextHasNoMarginBottom","required","noOptionLabel","selectedId","tree","disabled","Icon","qsmBlockIcon","icon","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","data","qsmUniqueArray","arr","Array","isArray","filter","val","index","indexOf","qsmDecodeHtml","html","txt","document","innerHTML","qsmSanitizeName","toLowerCase","replace","qsmStripTags","text","div","innerText","obj","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmUniqid","prefix","random","sec","Date","now","Math","toString","padEnd","trunc","qsmValueOrDefault","defaultValue","InspectorControls","RichText","InnerBlocks","useBlockProps","BlockControls","createBlock","ToolbarGroup","ToolbarButton","isQuestionIDReserved","questionIDCheck","clientIdCheck","blocksClientIds","getClientIdsWithDescendants","some","blockClientId","questionID","getBlockAttributes","Edit","props","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","hasSelectedInnerBlock","quizID","quiz_name","post_id","rest_nonce","pageID","getBlockRootClientId","getBlockIndex","insertBlock","isChanged","description","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageSrc","answers","answerEditor","matchAnswer","proActivated","is_pro_activated","isAdvanceQuestionType","qtype","parseInt","shouldSetID","newQuestion","response","question_id","catch","error","shouldSetChanged","blockProps","QUESTION_TEMPLATE","optionID","getCategoryAncestors","termId","parents","ancestor","multiCat","catID","childCatID","ancestorIds","notes","setQuestionType","MicroModal","modalEl","getElementById","show","insertNewQuestion","blockToInsert","selectBlockOnInsert","Fragment","question_type","default","help","question_type_description","options","qtypes","types","mediaDetails","heading","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/style-index.css b/blocks/build/style-index.css index 74830d632..8b1378917 100644 --- a/blocks/build/style-index.css +++ b/blocks/build/style-index.css @@ -1,11 +1 @@ -/*!***************************************************************************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! - \***************************************************************************************************************************************************************************************************************************************/ -/** - * The following styles get applied both on the front of your site - * and in the editor. - * - * Replace them with your own styles or remove the file completely. - */ -/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/blocks/build/style-index.css.map b/blocks/build/style-index.css.map deleted file mode 100644 index 69cae5f30..000000000 --- a/blocks/build/style-index.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA,C","sources":["webpack://qsm/./src/style.scss"],"sourcesContent":["/**\r\n * The following styles get applied both on the front of your site\r\n * and in the editor.\r\n *\r\n * Replace them with your own styles or remove the file completely.\r\n */\r\n\r\n// .wp-block-qsm-main-block {\r\n// \tbackground-color: #21759b;\r\n// \tcolor: #fff;\r\n// \tpadding: 2px;\r\n// }\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file From eb6fd539a2e4927c3154688ce96de3b02023e76d Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Fri, 8 Mar 2024 19:07:50 +0530 Subject: [PATCH 15/27] safe random number --- blocks/build/index.asset.php | 2 +- blocks/build/index.js | 2 +- blocks/src/helper.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index ada096ff6..58a444b87 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '2817ba1a37bfb0793cda'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '3d803ca23d9eaa900d22'); diff --git a/blocks/build/index.js b/blocks/build/index.js index c8e1222cc..3da699769 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={775:function(e,t,n){var a=window.wp.blocks,i=window.wp.element,s=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),u=window.wp.htmlEntities,l=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,q=window.wp.components;const _=e=>null==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=(e,t="")=>_(e)?t:e,z=()=>(0,i.createElement)(q.Icon,{icon:()=>(0,i.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,i.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,a.registerBlockType)("qsm/quiz",{icon:z,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:a,isSelected:r,clientId:f}=e,{createNotice:w}=(0,m.useDispatch)(c.store),b=qsmBlockData.globalQuizsetting,{quizID:v,postID:y,quizAttr:E=b}=n,[k,D]=(0,i.useState)(qsmBlockData.QSMQuizList),[I,x]=(0,i.useState)({error:!1,msg:""}),[B,C]=(0,i.useState)(!1),[S,O]=(0,i.useState)(!1),[P,N]=(0,i.useState)(!1),[A,T]=(0,i.useState)([]),M=qsmBlockData.quizOptions,Q=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(l.store);(0,i.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{H()}),100),!_(v)&&0{if(v==t.value)return e=!0,!0})),e?F(v):(a({quizID:void 0}),x({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const H=()=>{let e=document.getElementById("modal-advanced-question-type");_(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");_(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},F=e=>{!_(e)&&0{if("success"==t.status){x({error:!1,msg:""});let n=t.result;if(a({quizID:parseInt(e),postID:n.post_id,quizAttr:{...E,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:h(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),T(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},L=(e,t)=>{let n=E;n[t]=e,a({quizAttr:{...n}})};(0,i.useEffect)((()=>{if(Q){let e=(()=>{let e=j(f);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:E.quiz_id,post_id:E.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,i=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,s=h(a?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=h(t?.content);_(a?.answerEditor)||"rich"!==a.answerEditor||(n=d((0,u.decodeEntities)(n)));let i=[n,h(t?.points),h(t?.isCorrect)];"image"!==s||_(t?.caption)||i.push(t?.caption),r.push(i)})),i.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:E.quiz_id,postID:E.post_id,answerEditor:s,type:h(a?.type,"0"),name:d(h(a?.description)),question_title:h(a?.title),answerInfo:d(h(a?.correctAnswerInfo)),comments:h(a?.commentBox,"1"),hint:h(a?.hint),category:h(a?.category),multicategories:h(a?.multicategories,[]),required:h(a?.required,0),answers:r,featureImageID:h(a?.featureImageID),featureImageSrc:h(a?.featureImageSrc),page:n,other_settings:{required:h(a?.required,0)}})})),t.pages.push(i),t.qpages.push({id:a,quizID:E.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:i}),n++}})),t.quiz={quiz_name:E.quiz_name,quiz_id:E.quiz_id,post_id:E.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==E[e]&&null!==E[e]&&(t.quiz[e]=E[e])})),t})();O(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{w(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[Q]);const $=(0,l.useBlockProps)(),K=(0,l.useInnerBlocksProps)($,{template:A,allowedBlocks:["qsm/quiz-page"]});return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(l.InspectorControls,null,(0,i.createElement)(q.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,i.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,i.createElement)("span",{className:"qsm-inspector-label-value"},E.post_status)),(0,i.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:E?.quiz_name||"",onChange:e=>L(e,"quiz_name"),className:"qsm-no-mb"}),(!_(v)||"0"!=v)&&(0,i.createElement)("p",null,(0,i.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),_(v)||"0"==v?(0,i.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:z,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,i.createElement)(i.Fragment,null,!_(k)&&0F(e),disabled:B,__nextHasNoMarginBottom:!0}),(0,i.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,i.createElement)(q.Button,{variant:"link",onClick:()=>C(!B)},(0,s.__)("Add New","quiz-master-next"))),(_(k)||B)&&(0,i.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,i.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:E?.quiz_name||"",onChange:e=>L(e,"quiz_name")}),(0,i.createElement)(q.Button,{variant:"link",onClick:()=>N(!P)},(0,s.__)("Advance options","quiz-master-next")),P&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(q.SelectControl,{label:M?.form_type?.label,value:E?.form_type,options:M?.form_type?.options,onChange:e=>L(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,i.createElement)(q.SelectControl,{label:M?.system?.label,value:E?.system,options:M?.system?.options,onChange:e=>L(e,"system"),help:M?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,i.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:M?.[e]?.label,help:M?.[e]?.help,value:_(E[e])?0:E[e],onChange:t=>L(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,i.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:M?.[e]?.label,help:M?.[e]?.help,checked:!_(E[e])&&"1"==E[e],onChange:()=>L(_(E[e])||"1"!=E[e]?1:0,e)})))),(0,i.createElement)(q.Button,{variant:"primary",disabled:S||_(E.quiz_name),onClick:()=>(()=>{if(_(E.quiz_name))return void console.log("empty quiz_name");O(!0);let e=g({quiz_name:E.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===E[t]||null===E[t]?"":e.append(t,E[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(O(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+1e3*Math.random()).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.trunc(1e8*Math.random())}`:""}`)()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&F(e.quizID)}))}})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))}w(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),I.error&&(0,i.createElement)("p",{className:"qsm-error-text"},I.msg))):(0,i.createElement)("div",{...K}))},save:e=>null})}},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,a),s.exports}a.m=t,e=[],a.O=function(t,n,i,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(a.O).every((function(e){return a.O[e](n[u])}))?n.splice(u--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,i,s]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var i,s,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(u)var c=u(a)}for(t&&t(n);lnull==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=(e,t="")=>_(e)?t:e,f=()=>(0,i.createElement)(q.Icon,{icon:()=>(0,i.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,i.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,a.registerBlockType)("qsm/quiz",{icon:f,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:a,isSelected:r,clientId:z}=e,{createNotice:w}=(0,m.useDispatch)(c.store),b=qsmBlockData.globalQuizsetting,{quizID:v,postID:y,quizAttr:E=b}=n,[k,D]=(0,i.useState)(qsmBlockData.QSMQuizList),[I,x]=(0,i.useState)({error:!1,msg:""}),[B,C]=(0,i.useState)(!1),[S,O]=(0,i.useState)(!1),[P,N]=(0,i.useState)(!1),[A,M]=(0,i.useState)([]),T=qsmBlockData.quizOptions,Q=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(u.store);(0,i.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{H()}),100),!_(v)&&0{if(v==t.value)return e=!0,!0})),e?F(v):(a({quizID:void 0}),x({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const H=()=>{let e=document.getElementById("modal-advanced-question-type");_(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");_(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},F=e=>{!_(e)&&0{if("success"==t.status){x({error:!1,msg:""});let n=t.result;if(a({quizID:parseInt(e),postID:n.post_id,quizAttr:{...E,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:h(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),M(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},L=(e,t)=>{let n=E;n[t]=e,a({quizAttr:{...n}})};(0,i.useEffect)((()=>{if(Q){let e=(()=>{let e=j(z);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:E.quiz_id,post_id:E.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,i=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,s=h(a?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=h(t?.content);_(a?.answerEditor)||"rich"!==a.answerEditor||(n=d((0,l.decodeEntities)(n)));let i=[n,h(t?.points),h(t?.isCorrect)];"image"!==s||_(t?.caption)||i.push(t?.caption),r.push(i)})),i.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:E.quiz_id,postID:E.post_id,answerEditor:s,type:h(a?.type,"0"),name:d(h(a?.description)),question_title:h(a?.title),answerInfo:d(h(a?.correctAnswerInfo)),comments:h(a?.commentBox,"1"),hint:h(a?.hint),category:h(a?.category),multicategories:h(a?.multicategories,[]),required:h(a?.required,0),answers:r,featureImageID:h(a?.featureImageID),featureImageSrc:h(a?.featureImageSrc),page:n,other_settings:{required:h(a?.required,0)}})})),t.pages.push(i),t.qpages.push({id:a,quizID:E.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:i}),n++}})),t.quiz={quiz_name:E.quiz_name,quiz_id:E.quiz_id,post_id:E.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==E[e]&&null!==E[e]&&(t.quiz[e]=E[e])})),t})();O(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{w(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[Q]);const $=(0,u.useBlockProps)(),K=(0,u.useInnerBlocksProps)($,{template:A,allowedBlocks:["qsm/quiz-page"]});return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(u.InspectorControls,null,(0,i.createElement)(q.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,i.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,i.createElement)("span",{className:"qsm-inspector-label-value"},E.post_status)),(0,i.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:E?.quiz_name||"",onChange:e=>L(e,"quiz_name"),className:"qsm-no-mb"}),(!_(v)||"0"!=v)&&(0,i.createElement)("p",null,(0,i.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),_(v)||"0"==v?(0,i.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:f,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,i.createElement)(i.Fragment,null,!_(k)&&0F(e),disabled:B,__nextHasNoMarginBottom:!0}),(0,i.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,i.createElement)(q.Button,{variant:"link",onClick:()=>C(!B)},(0,s.__)("Add New","quiz-master-next"))),(_(k)||B)&&(0,i.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,i.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:E?.quiz_name||"",onChange:e=>L(e,"quiz_name")}),(0,i.createElement)(q.Button,{variant:"link",onClick:()=>N(!P)},(0,s.__)("Advance options","quiz-master-next")),P&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(q.SelectControl,{label:T?.form_type?.label,value:E?.form_type,options:T?.form_type?.options,onChange:e=>L(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,i.createElement)(q.SelectControl,{label:T?.system?.label,value:E?.system,options:T?.system?.options,onChange:e=>L(e,"system"),help:T?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,i.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:T?.[e]?.label,help:T?.[e]?.help,value:_(E[e])?0:E[e],onChange:t=>L(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,i.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:T?.[e]?.label,help:T?.[e]?.help,checked:!_(E[e])&&"1"==E[e],onChange:()=>L(_(E[e])||"1"!=E[e]?1:0,e)})))),(0,i.createElement)(q.Button,{variant:"primary",disabled:S||_(E.quiz_name),onClick:()=>(()=>{if(_(E.quiz_name))return void console.log("empty quiz_name");O(!0);let e=g({quiz_name:E.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===E[t]||null===E[t]?"":e.append(t,E[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(O(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+Math.floor(1e3*Math.random())).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.floor(1e8*Math.random())}`:""}`)()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&F(e.quizID)}))}})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))}w(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),I.error&&(0,i.createElement)("p",{className:"qsm-error-text"},I.msg))):(0,i.createElement)("div",{...K}))},save:e=>null})}},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,a),s.exports}a.m=t,e=[],a.O=function(t,n,i,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,i,s]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var i,s,r=n[0],o=n[1],l=n[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(l)var c=l(a)}for(t&&t(n);u { - const sec = Date.now() * 1000 + Math.random() * 1000; + const sec = Date.now() * 1000 + Math.floor( Math.random() * 1000 ); const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.trunc(Math.random() * 100000000)}`:""}`; + return `${prefix}${id}${random ? `.${Math.floor(Math.random() * 100000000)}`:""}`; }; //return data if not empty otherwise default value From d59f59464a12e9cf134c45c349d8eb5f81494438 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Fri, 8 Mar 2024 19:22:53 +0530 Subject: [PATCH 16/27] random key using window.crypto --- blocks/block.php | 4 ---- blocks/src/helper.js | 22 +++++++++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/blocks/block.php b/blocks/block.php index 2f66378d2..0c085dfb0 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -613,10 +613,6 @@ public function save_quiz( WP_REST_Request $request ) { if ( ! empty( $quiz_id ) && ! empty( $post_id ) && ! empty( $quiz_name ) ) { //update quiz name $mlwQuizMasterNext->quizCreator->edit_quiz_name( $quiz_id, $quiz_name, $post_id ); - - if ( false === $update_status ) { - $mlwQuizMasterNext->log_manager->add( 'Error when updating quiz status', '', 0, 'error' ); - } } } diff --git a/blocks/src/helper.js b/blocks/src/helper.js index b1848f671..ac1854b4b 100644 --- a/blocks/src/helper.js +++ b/blocks/src/helper.js @@ -71,11 +71,27 @@ export const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) return data; } +//Generate random number +export const qsmGenerateRandomKey = (length) => { + const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let key = ""; + + // Generate random bytes + const values = new Uint8Array(length); + window.crypto.getRandomValues(values); + + for (let i = 0; i < length; i++) { + // Use the random byte to index into the charset + key += charset[values[i] % charset.length]; + } + + return key; +} + //generate uiniq id export const qsmUniqid = (prefix = "", random = false) => { - const sec = Date.now() * 1000 + Math.floor( Math.random() * 1000 ); - const id = sec.toString(16).replace(/\./g, "").padEnd(8, "0"); - return `${prefix}${id}${random ? `.${Math.floor(Math.random() * 100000000)}`:""}`; + const id = qsmGenerateRandomKey(14); + return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(8) }`:""}`; }; //return data if not empty otherwise default value From 2b047ed74ae782de18334ece9c2ffc59381126cd Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Fri, 8 Mar 2024 19:24:40 +0530 Subject: [PATCH 17/27] update block build --- blocks/build/index.asset.php | 2 +- blocks/build/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 58a444b87..73cb16501 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '3d803ca23d9eaa900d22'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '4ca00a81fe165f0b47a9'); diff --git a/blocks/build/index.js b/blocks/build/index.js index 3da699769..e913f4d61 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={775:function(e,t,n){var a=window.wp.blocks,i=window.wp.element,s=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),l=window.wp.htmlEntities,u=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,q=window.wp.components;const _=e=>null==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=(e,t="")=>_(e)?t:e,f=()=>(0,i.createElement)(q.Icon,{icon:()=>(0,i.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,i.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,a.registerBlockType)("qsm/quiz",{icon:f,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:a,isSelected:r,clientId:z}=e,{createNotice:w}=(0,m.useDispatch)(c.store),b=qsmBlockData.globalQuizsetting,{quizID:v,postID:y,quizAttr:E=b}=n,[k,D]=(0,i.useState)(qsmBlockData.QSMQuizList),[I,x]=(0,i.useState)({error:!1,msg:""}),[B,C]=(0,i.useState)(!1),[S,O]=(0,i.useState)(!1),[P,N]=(0,i.useState)(!1),[A,M]=(0,i.useState)([]),T=qsmBlockData.quizOptions,Q=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(u.store);(0,i.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{H()}),100),!_(v)&&0{if(v==t.value)return e=!0,!0})),e?F(v):(a({quizID:void 0}),x({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const H=()=>{let e=document.getElementById("modal-advanced-question-type");_(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");_(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},F=e=>{!_(e)&&0{if("success"==t.status){x({error:!1,msg:""});let n=t.result;if(a({quizID:parseInt(e),postID:n.post_id,quizAttr:{...E,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:h(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),M(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},L=(e,t)=>{let n=E;n[t]=e,a({quizAttr:{...n}})};(0,i.useEffect)((()=>{if(Q){let e=(()=>{let e=j(z);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:E.quiz_id,post_id:E.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,i=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,s=h(a?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=h(t?.content);_(a?.answerEditor)||"rich"!==a.answerEditor||(n=d((0,l.decodeEntities)(n)));let i=[n,h(t?.points),h(t?.isCorrect)];"image"!==s||_(t?.caption)||i.push(t?.caption),r.push(i)})),i.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:E.quiz_id,postID:E.post_id,answerEditor:s,type:h(a?.type,"0"),name:d(h(a?.description)),question_title:h(a?.title),answerInfo:d(h(a?.correctAnswerInfo)),comments:h(a?.commentBox,"1"),hint:h(a?.hint),category:h(a?.category),multicategories:h(a?.multicategories,[]),required:h(a?.required,0),answers:r,featureImageID:h(a?.featureImageID),featureImageSrc:h(a?.featureImageSrc),page:n,other_settings:{required:h(a?.required,0)}})})),t.pages.push(i),t.qpages.push({id:a,quizID:E.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:i}),n++}})),t.quiz={quiz_name:E.quiz_name,quiz_id:E.quiz_id,post_id:E.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==E[e]&&null!==E[e]&&(t.quiz[e]=E[e])})),t})();O(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{w(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[Q]);const $=(0,u.useBlockProps)(),K=(0,u.useInnerBlocksProps)($,{template:A,allowedBlocks:["qsm/quiz-page"]});return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(u.InspectorControls,null,(0,i.createElement)(q.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,i.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,i.createElement)("span",{className:"qsm-inspector-label-value"},E.post_status)),(0,i.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:E?.quiz_name||"",onChange:e=>L(e,"quiz_name"),className:"qsm-no-mb"}),(!_(v)||"0"!=v)&&(0,i.createElement)("p",null,(0,i.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),_(v)||"0"==v?(0,i.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:f,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,i.createElement)(i.Fragment,null,!_(k)&&0F(e),disabled:B,__nextHasNoMarginBottom:!0}),(0,i.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,i.createElement)(q.Button,{variant:"link",onClick:()=>C(!B)},(0,s.__)("Add New","quiz-master-next"))),(_(k)||B)&&(0,i.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,i.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:E?.quiz_name||"",onChange:e=>L(e,"quiz_name")}),(0,i.createElement)(q.Button,{variant:"link",onClick:()=>N(!P)},(0,s.__)("Advance options","quiz-master-next")),P&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(q.SelectControl,{label:T?.form_type?.label,value:E?.form_type,options:T?.form_type?.options,onChange:e=>L(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,i.createElement)(q.SelectControl,{label:T?.system?.label,value:E?.system,options:T?.system?.options,onChange:e=>L(e,"system"),help:T?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,i.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:T?.[e]?.label,help:T?.[e]?.help,value:_(E[e])?0:E[e],onChange:t=>L(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,i.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:T?.[e]?.label,help:T?.[e]?.help,checked:!_(E[e])&&"1"==E[e],onChange:()=>L(_(E[e])||"1"!=E[e]?1:0,e)})))),(0,i.createElement)(q.Button,{variant:"primary",disabled:S||_(E.quiz_name),onClick:()=>(()=>{if(_(E.quiz_name))return void console.log("empty quiz_name");O(!0);let e=g({quiz_name:E.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===E[t]||null===E[t]?"":e.append(t,E[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(O(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${(1e3*Date.now()+Math.floor(1e3*Math.random())).toString(16).replace(/\./g,"").padEnd(8,"0")}${t?`.${Math.floor(1e8*Math.random())}`:""}`)()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&F(e.quizID)}))}})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))}w(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),w("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),I.error&&(0,i.createElement)("p",{className:"qsm-error-text"},I.msg))):(0,i.createElement)("div",{...K}))},save:e=>null})}},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,a),s.exports}a.m=t,e=[],a.O=function(t,n,i,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,i,s]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var i,s,r=n[0],o=n[1],l=n[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(l)var c=l(a)}for(t&&t(n);unull==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let i=0;i_(e)?t:e,z=()=>(0,s.createElement)(q.Icon,{icon:()=>(0,s.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,s.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,i.registerBlockType)("qsm/quiz",{icon:z,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:w}=e,{createNotice:b}=(0,m.useDispatch)(c.store),v=qsmBlockData.globalQuizsetting,{quizID:y,postID:E,quizAttr:k=v}=n,[D,I]=(0,s.useState)(qsmBlockData.QSMQuizList),[x,B]=(0,s.useState)({error:!1,msg:""}),[C,S]=(0,s.useState)(!1),[O,P]=(0,s.useState)(!1),[N,A]=(0,s.useState)(!1),[T,Q]=(0,s.useState)([]),M=qsmBlockData.quizOptions,j=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:H}=(0,m.useSelect)(l.store);(0,s.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{F()}),100),!_(y)&&0{if(y==t.value)return e=!0,!0})),e?L(y):(i({quizID:void 0}),B({error:!0,msg:(0,a.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const F=()=>{let e=document.getElementById("modal-advanced-question-type");_(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");_(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},L=e=>{!_(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(i({quizID:parseInt(e),postID:n.post_id,quizAttr:{...k,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:f(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},V=(e,t)=>{let n=k;n[t]=e,i({quizAttr:{...n}})};(0,s.useEffect)((()=>{if(j){let e=(()=>{let e=H(w);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:k.quiz_id,post_id:k.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,s=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=e.attributes,a=f(i?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=f(t?.content);_(i?.answerEditor)||"rich"!==i.answerEditor||(n=d((0,u.decodeEntities)(n)));let s=[n,f(t?.points),f(t?.isCorrect)];"image"!==a||_(t?.caption)||s.push(t?.caption),r.push(s)})),s.push(i.questionID),i.isChanged&&t.questions.push({id:i.questionID,quizID:k.quiz_id,postID:k.post_id,answerEditor:a,type:f(i?.type,"0"),name:d(f(i?.description)),question_title:f(i?.title),answerInfo:d(f(i?.correctAnswerInfo)),comments:f(i?.commentBox,"1"),hint:f(i?.hint),category:f(i?.category),multicategories:f(i?.multicategories,[]),required:f(i?.required,0),answers:r,featureImageID:f(i?.featureImageID),featureImageSrc:f(i?.featureImageSrc),page:n,other_settings:{required:f(i?.required,0)}})})),t.pages.push(s),t.qpages.push({id:i,quizID:k.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:k.quiz_name,quiz_id:k.quiz_id,post_id:k.post_id},N&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==k[e]&&null!==k[e]&&(t.quiz[e]=k[e])})),t})();P(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{b(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[j]);const $=(0,l.useBlockProps)(),K=(0,l.useInnerBlocksProps)($,{template:T,allowedBlocks:["qsm/quiz-page"]});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(l.InspectorControls,null,(0,s.createElement)(q.PanelBody,{title:(0,a.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,s.createElement)("label",{className:"qsm-inspector-label"},(0,a.__)("Status","quiz-master-next")+":",(0,s.createElement)("span",{className:"qsm-inspector-label-value"},k.post_status)),(0,s.createElement)(q.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:k?.quiz_name||"",onChange:e=>V(e,"quiz_name"),className:"qsm-no-mb"}),(!_(y)||"0"!=y)&&(0,s.createElement)("p",null,(0,s.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+y},(0,a.__)("Advance Quiz Settings","quiz-master-next"))))),_(y)||"0"==y?(0,s.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:z,label:(0,a.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,a.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,s.createElement)(s.Fragment,null,!_(D)&&0L(e),disabled:C,__nextHasNoMarginBottom:!0}),(0,s.createElement)("span",null,(0,a.__)("OR","quiz-master-next")),(0,s.createElement)(q.Button,{variant:"link",onClick:()=>S(!C)},(0,a.__)("Add New","quiz-master-next"))),(_(D)||C)&&(0,s.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,s.createElement)(q.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:k?.quiz_name||"",onChange:e=>V(e,"quiz_name")}),(0,s.createElement)(q.Button,{variant:"link",onClick:()=>A(!N)},(0,a.__)("Advance options","quiz-master-next")),N&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(q.SelectControl,{label:M?.form_type?.label,value:k?.form_type,options:M?.form_type?.options,onChange:e=>V(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,s.createElement)(q.SelectControl,{label:M?.system?.label,value:k?.system,options:M?.system?.options,onChange:e=>V(e,"system"),help:M?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,s.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:M?.[e]?.label,help:M?.[e]?.help,value:_(k[e])?0:k[e],onChange:t=>V(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,s.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:M?.[e]?.label,help:M?.[e]?.help,checked:!_(k[e])&&"1"==k[e],onChange:()=>V(_(k[e])||"1"!=k[e]?1:0,e)})))),(0,s.createElement)(q.Button,{variant:"primary",disabled:O||_(k.quiz_name),onClick:()=>(()=>{if(_(k.quiz_name))return void console.log("empty quiz_name");P(!0);let e=g({quiz_name:k.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===k[t]||null===k[t]?"":e.append(t,k[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(P(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,i=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});i.append("pages[0][]",n),i.append("qpages[0][id]",1),i.append("qpages[0][quizID]",e.quizID),i.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${h(14)}${t?`.${h(8)}`:""}`)()),i.append("qpages[0][hide_prevbtn]",0),i.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:i}).then((t=>{"success"==t.status&&L(e.quizID)}))}})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))}b(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,a.__)("Create Quiz","quiz-master-next"))),x.error&&(0,s.createElement)("p",{className:"qsm-error-text"},x.msg))):(0,s.createElement)("div",{...K}))},save:e=>null})}},n={};function i(e){var s=n[e];if(void 0!==s)return s.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.m=t,e=[],i.O=function(t,n,s,a){if(!n){var r=1/0;for(c=0;c=a)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(o=!1,a0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,s,a]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,a,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(s in o)i.o(o,s)&&(i.m[s]=o[s]);if(u)var c=u(i)}for(t&&t(n);l Date: Fri, 8 Mar 2024 19:49:38 +0530 Subject: [PATCH 18/27] add page key if empty --- blocks/build/index.asset.php | 2 +- blocks/build/index.js | 2 +- blocks/src/edit.js | 3 ++- blocks/src/helper.js | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 73cb16501..911c51e3f 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '4ca00a81fe165f0b47a9'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '5790e173579b9c6eb9ce'); diff --git a/blocks/build/index.js b/blocks/build/index.js index e913f4d61..da82dcd0d 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={775:function(e,t,n){var i=window.wp.blocks,s=window.wp.element,a=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),u=window.wp.htmlEntities,l=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,q=window.wp.components;const _=e=>null==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let i=0;i_(e)?t:e,z=()=>(0,s.createElement)(q.Icon,{icon:()=>(0,s.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,s.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,i.registerBlockType)("qsm/quiz",{icon:z,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:w}=e,{createNotice:b}=(0,m.useDispatch)(c.store),v=qsmBlockData.globalQuizsetting,{quizID:y,postID:E,quizAttr:k=v}=n,[D,I]=(0,s.useState)(qsmBlockData.QSMQuizList),[x,B]=(0,s.useState)({error:!1,msg:""}),[C,S]=(0,s.useState)(!1),[O,P]=(0,s.useState)(!1),[N,A]=(0,s.useState)(!1),[T,Q]=(0,s.useState)([]),M=qsmBlockData.quizOptions,j=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:H}=(0,m.useSelect)(l.store);(0,s.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{F()}),100),!_(y)&&0{if(y==t.value)return e=!0,!0})),e?L(y):(i({quizID:void 0}),B({error:!0,msg:(0,a.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const F=()=>{let e=document.getElementById("modal-advanced-question-type");_(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");_(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},L=e=>{!_(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(i({quizID:parseInt(e),postID:n.post_id,quizAttr:{...k,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:f(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},V=(e,t)=>{let n=k;n[t]=e,i({quizAttr:{...n}})};(0,s.useEffect)((()=>{if(j){let e=(()=>{let e=H(w);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:k.quiz_id,post_id:k.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,s=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=e.attributes,a=f(i?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=f(t?.content);_(i?.answerEditor)||"rich"!==i.answerEditor||(n=d((0,u.decodeEntities)(n)));let s=[n,f(t?.points),f(t?.isCorrect)];"image"!==a||_(t?.caption)||s.push(t?.caption),r.push(s)})),s.push(i.questionID),i.isChanged&&t.questions.push({id:i.questionID,quizID:k.quiz_id,postID:k.post_id,answerEditor:a,type:f(i?.type,"0"),name:d(f(i?.description)),question_title:f(i?.title),answerInfo:d(f(i?.correctAnswerInfo)),comments:f(i?.commentBox,"1"),hint:f(i?.hint),category:f(i?.category),multicategories:f(i?.multicategories,[]),required:f(i?.required,0),answers:r,featureImageID:f(i?.featureImageID),featureImageSrc:f(i?.featureImageSrc),page:n,other_settings:{required:f(i?.required,0)}})})),t.pages.push(s),t.qpages.push({id:i,quizID:k.quiz_id,pagekey:e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:k.quiz_name,quiz_id:k.quiz_id,post_id:k.post_id},N&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==k[e]&&null!==k[e]&&(t.quiz[e]=k[e])})),t})();P(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{b(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[j]);const $=(0,l.useBlockProps)(),K=(0,l.useInnerBlocksProps)($,{template:T,allowedBlocks:["qsm/quiz-page"]});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(l.InspectorControls,null,(0,s.createElement)(q.PanelBody,{title:(0,a.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,s.createElement)("label",{className:"qsm-inspector-label"},(0,a.__)("Status","quiz-master-next")+":",(0,s.createElement)("span",{className:"qsm-inspector-label-value"},k.post_status)),(0,s.createElement)(q.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:k?.quiz_name||"",onChange:e=>V(e,"quiz_name"),className:"qsm-no-mb"}),(!_(y)||"0"!=y)&&(0,s.createElement)("p",null,(0,s.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+y},(0,a.__)("Advance Quiz Settings","quiz-master-next"))))),_(y)||"0"==y?(0,s.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:z,label:(0,a.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,a.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,s.createElement)(s.Fragment,null,!_(D)&&0L(e),disabled:C,__nextHasNoMarginBottom:!0}),(0,s.createElement)("span",null,(0,a.__)("OR","quiz-master-next")),(0,s.createElement)(q.Button,{variant:"link",onClick:()=>S(!C)},(0,a.__)("Add New","quiz-master-next"))),(_(D)||C)&&(0,s.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,s.createElement)(q.TextControl,{label:(0,a.__)("Quiz Name *","quiz-master-next"),help:(0,a.__)("Enter a name for this Quiz","quiz-master-next"),value:k?.quiz_name||"",onChange:e=>V(e,"quiz_name")}),(0,s.createElement)(q.Button,{variant:"link",onClick:()=>A(!N)},(0,a.__)("Advance options","quiz-master-next")),N&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(q.SelectControl,{label:M?.form_type?.label,value:k?.form_type,options:M?.form_type?.options,onChange:e=>V(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,s.createElement)(q.SelectControl,{label:M?.system?.label,value:k?.system,options:M?.system?.options,onChange:e=>V(e,"system"),help:M?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,s.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:M?.[e]?.label,help:M?.[e]?.help,value:_(k[e])?0:k[e],onChange:t=>V(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,s.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:M?.[e]?.label,help:M?.[e]?.help,checked:!_(k[e])&&"1"==k[e],onChange:()=>V(_(k[e])||"1"!=k[e]?1:0,e)})))),(0,s.createElement)(q.Button,{variant:"primary",disabled:O||_(k.quiz_name),onClick:()=>(()=>{if(_(k.quiz_name))return void console.log("empty quiz_name");P(!0);let e=g({quiz_name:k.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===k[t]||null===k[t]?"":e.append(t,k[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(P(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,i=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});i.append("pages[0][]",n),i.append("qpages[0][id]",1),i.append("qpages[0][quizID]",e.quizID),i.append("qpages[0][pagekey]",((e="",t=!1)=>`${e}${h(14)}${t?`.${h(8)}`:""}`)()),i.append("qpages[0][hide_prevbtn]",0),i.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:i}).then((t=>{"success"==t.status&&L(e.quizID)}))}})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))}b(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,a.__)("Create Quiz","quiz-master-next"))),x.error&&(0,s.createElement)("p",{className:"qsm-error-text"},x.msg))):(0,s.createElement)("div",{...K}))},save:e=>null})}},n={};function i(e){var s=n[e];if(void 0!==s)return s.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.m=t,e=[],i.O=function(t,n,s,a){if(!n){var r=1/0;for(c=0;c=a)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(o=!1,a0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,s,a]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,a,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(s in o)i.o(o,s)&&(i.m[s]=o[s]);if(u)var c=u(i)}for(t&&t(n);lnull==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let i=0;i`${e}${h(8)}${t?`.${h(7)}`:""}`,z=(e,t="")=>_(e)?t:e,w=()=>(0,a.createElement)(q.Icon,{icon:()=>(0,a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,a.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,i.registerBlockType)("qsm/quiz",{icon:w,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:h}=e,{createNotice:b}=(0,m.useDispatch)(c.store),v=qsmBlockData.globalQuizsetting,{quizID:y,postID:E,quizAttr:k=v}=n,[D,I]=(0,a.useState)(qsmBlockData.QSMQuizList),[x,B]=(0,a.useState)({error:!1,msg:""}),[C,S]=(0,a.useState)(!1),[O,P]=(0,a.useState)(!1),[N,A]=(0,a.useState)(!1),[T,Q]=(0,a.useState)([]),M=qsmBlockData.quizOptions,j=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:H}=(0,m.useSelect)(l.store);(0,a.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{F()}),100),!_(y)&&0{if(y==t.value)return e=!0,!0})),e?L(y):(i({quizID:void 0}),B({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const F=()=>{let e=document.getElementById("modal-advanced-question-type");_(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");_(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},L=e=>{!_(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(i({quizID:parseInt(e),postID:n.post_id,quizAttr:{...k,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:z(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},K=(e,t)=>{let n=k;n[t]=e,i({quizAttr:{...n}})};(0,a.useEffect)((()=>{if(j){let e=(()=>{let e=H(h);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:k.quiz_id,post_id:k.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,a=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=e.attributes,s=z(i?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=z(t?.content);_(i?.answerEditor)||"rich"!==i.answerEditor||(n=d((0,u.decodeEntities)(n)));let a=[n,z(t?.points),z(t?.isCorrect)];"image"!==s||_(t?.caption)||a.push(t?.caption),r.push(a)})),a.push(i.questionID),i.isChanged&&t.questions.push({id:i.questionID,quizID:k.quiz_id,postID:k.post_id,answerEditor:s,type:z(i?.type,"0"),name:d(z(i?.description)),question_title:z(i?.title),answerInfo:d(z(i?.correctAnswerInfo)),comments:z(i?.commentBox,"1"),hint:z(i?.hint),category:z(i?.category),multicategories:z(i?.multicategories,[]),required:z(i?.required,0),answers:r,featureImageID:z(i?.featureImageID),featureImageSrc:z(i?.featureImageSrc),page:n,other_settings:{required:z(i?.required,0)}})})),t.pages.push(a),t.qpages.push({id:i,quizID:k.quiz_id,pagekey:_(e.attributes.pageKey)?f():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:a}),n++}})),t.quiz={quiz_name:k.quiz_name,quiz_id:k.quiz_id,post_id:k.post_id},N&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==k[e]&&null!==k[e]&&(t.quiz[e]=k[e])})),t})();P(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{b(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[j]);const V=(0,l.useBlockProps)(),$=(0,l.useInnerBlocksProps)(V,{template:T,allowedBlocks:["qsm/quiz-page"]});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.InspectorControls,null,(0,a.createElement)(q.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,a.createElement)("span",{className:"qsm-inspector-label-value"},k.post_status)),(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:k?.quiz_name||"",onChange:e=>K(e,"quiz_name"),className:"qsm-no-mb"}),(!_(y)||"0"!=y)&&(0,a.createElement)("p",null,(0,a.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+y},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),_(y)||"0"==y?(0,a.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:w,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,a.createElement)(a.Fragment,null,!_(D)&&0L(e),disabled:C,__nextHasNoMarginBottom:!0}),(0,a.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>S(!C)},(0,s.__)("Add New","quiz-master-next"))),(_(D)||C)&&(0,a.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:k?.quiz_name||"",onChange:e=>K(e,"quiz_name")}),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>A(!N)},(0,s.__)("Advance options","quiz-master-next")),N&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(q.SelectControl,{label:M?.form_type?.label,value:k?.form_type,options:M?.form_type?.options,onChange:e=>K(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,a.createElement)(q.SelectControl,{label:M?.system?.label,value:k?.system,options:M?.system?.options,onChange:e=>K(e,"system"),help:M?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,a.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:M?.[e]?.label,help:M?.[e]?.help,value:_(k[e])?0:k[e],onChange:t=>K(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,a.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:M?.[e]?.label,help:M?.[e]?.help,checked:!_(k[e])&&"1"==k[e],onChange:()=>K(_(k[e])||"1"!=k[e]?1:0,e)})))),(0,a.createElement)(q.Button,{variant:"primary",disabled:O||_(k.quiz_name),onClick:()=>(()=>{if(_(k.quiz_name))return void console.log("empty quiz_name");P(!0);let e=g({quiz_name:k.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===k[t]||null===k[t]?"":e.append(t,k[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(P(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,i=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});i.append("pages[0][]",n),i.append("qpages[0][id]",1),i.append("qpages[0][quizID]",e.quizID),i.append("qpages[0][pagekey]",f()),i.append("qpages[0][hide_prevbtn]",0),i.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:i}).then((t=>{"success"==t.status&&L(e.quizID)}))}})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))}b(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),x.error&&(0,a.createElement)("p",{className:"qsm-error-text"},x.msg))):(0,a.createElement)("div",{...$}))},save:e=>null})}},n={};function i(e){var a=n[e];if(void 0!==a)return a.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,i),s.exports}i.m=t,e=[],i.O=function(t,n,a,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,a,s]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var a,s,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(a in o)i.o(o,a)&&(i.m[a]=o[a]);if(u)var c=u(i)}for(t&&t(n);l { //generate uiniq id export const qsmUniqid = (prefix = "", random = false) => { - const id = qsmGenerateRandomKey(14); - return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(8) }`:""}`; + const id = qsmGenerateRandomKey(8); + return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(7) }`:""}`; }; //return data if not empty otherwise default value From 40f57ce07e6dab50f82e7cda400732583bbea4b5 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Mon, 11 Mar 2024 11:22:09 +0530 Subject: [PATCH 19/27] add toolbar button to add new page from question block --- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 4 ++-- blocks/src/question/edit.js | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php index db5936275..f3c33d34a 100644 --- a/blocks/build/question/index.asset.php +++ b/blocks/build/question/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '805ffac9a63872af04cf'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'c6a0dc201b16dffc8a36'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index e640ad15a..7ed14d914 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -1,5 +1,5 @@ -!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch,o=e.n(r),i=window.wp.blockEditor,l=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,p=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=_(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],E=(0,n.__)("Featured image"),w=(0,n.__)("Set featured image"),x=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media."));var C=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:o}=(0,s.useDispatch)(l.store),p=(0,a.useRef)(),[_,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:C,mediaUpload:y}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function b(e){y({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){o("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(C)||"object"!=typeof C||q({id:e,width:C.media_details.width,height:C.media_details.height,url:C.source_url,alt_text:C.alt_text,slug:C.slug})),()=>{t=!1}}),[C]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( +!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch,o=e.n(r),i=window.wp.blockEditor,l=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,p=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=_(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],w=(0,n.__)("Featured image"),E=(0,n.__)("Set featured image"),x=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media."));var C=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:o}=(0,s.useDispatch)(l.store),p=(0,a.useRef)(),[_,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:C,mediaUpload:b}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function y(e){b({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){o("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(C)||"object"!=typeof C||q({id:e,width:C.media_details.width,height:C.media_details.height,url:C.source_url,alt_text:C.alt_text,slug:C.slug})),()=>{t=!1}}),[C]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( // Translators: %s: The selected image alt text. (0,n.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,n.sprintf)( // Translators: %s: The selected image filename. -(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:E,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:p,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),_&&(0,a.createElement)(c.Spinner,null),!e&&!_&&w),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),p.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:b})),value:e})))},y=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[p,_]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,E]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),w=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,x)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},B(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},B(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},y)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(l)||p||(_(!0),o()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;o()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(E(e.result),C(e.result),s(""),u(0),t(a,w(term.id)),_(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:l,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||p},y)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},b=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(b.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:r,attributes:m,setAttributes:u,isSelected:f,clientId:E,context:w}=e,x=(0,s.useSelect)((e=>f||e("core/block-editor").hasSelectedInnerBlock(E,!0))),b=w["quiz-master-next/quizID"],{quiz_name:k,post_id:B,rest_nonce:I}=w["quiz-master-next/quizAttr"],{createNotice:v}=(w["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{getBlockRootClientId:D,getBlockIndex:z}=(0,s.useSelect)(i.store),{insertBlock:N}=(0,s.useDispatch)(i.store),{isChanged:S=!1,questionID:T,type:A,description:F,title:P,correctAnswerInfo:M,commentBox:O,category:R,multicategories:L=[],hint:U,featureImageID:H,featureImageSrc:Q,answers:j,answerEditor:W,matchAnswer:Z,required:$}=m,G="1"==qsmBlockData.is_pro_activated,J=e=>14{let e=!0;if(e&&(d(T)||"0"==T||!d(T)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(T,E))){let e=h({id:null,rest_nonce:I,quizID:b,quiz_name:k,postID:B,answerEditor:q(W,"text"),type:q(A,"0"),name:_(q(F)),question_title:q(P),answerInfo:_(q(M)),comments:q(O,"1"),hint:q(U),category:q(R),multicategories:[],required:q($,0),answers:j,page:0,featureImageID:H,featureImageSrc:Q,matchAnswer:null});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;u({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&f&&!1===S&&u({isChanged:!0}),()=>{e=!1}}),[T,A,F,P,M,O,R,L,U,H,Q,j,W,Z,$]);const K=(0,i.useBlockProps)({className:x?" in-editing-mode":""}),V=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=V(e,t);a=[...a,...n]}return p(a)},X=["12","7","3","5","14"].includes(A)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"";return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>(()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);N(a,z(E)+1,D(E),!0)})()}))),J(A)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+T),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...K},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+P))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+T),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:A||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||G||!["15","16","17"].includes(e))u({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[A])?"":qsmBlockData.question_type_description[A]+" "+X,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug,disabled:G&&J(e.slug)},e.name))))))),["0","4","1","10","13"].includes(A)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:W||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>u({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d($)&&"1"==$,onChange:()=>u({required:d($)||"1"!=$?1:0})})),(0,a.createElement)(y,{isCategorySelected:e=>L.includes(e),setUnsetCatgory:(e,t)=>{let a=d(L)||0===L.length?d(R)?[]:[R]:L;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{V(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=V(e,t);a=[...a,...n]}a=p(a),u({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(C,{featureImageID:H,onUpdateImage:e=>{u({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{u({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:O||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>u({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...K},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:P,onChange:e=>u({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),x&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here","quiz-master-next"),value:_(F),onChange:e=>u({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(A)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:_(M),onChange:e=>u({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Hint","quiz-master-next"),"aria-label":(0,n.__)("Hint","quiz-master-next"),placeholder:(0,n.__)("hint goes here","quiz-master-next"),value:U,onChange:e=>u({hint:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"})))))}})}(); \ No newline at end of file +(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:w,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:p,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),_&&(0,a.createElement)(c.Spinner,null),!e&&!_&&E),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),p.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:y})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[p,_]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,w]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),E=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,x)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},B(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},B(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},b)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(l)||p||(_(!0),o()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;o()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(w(e.result),C(e.result),s(""),u(0),t(a,E(term.id)),_(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:l,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||p},b)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},y=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(y.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:r,attributes:m,setAttributes:u,isSelected:f,clientId:w,context:E}=e,x=(0,s.useSelect)((e=>f||e("core/block-editor").hasSelectedInnerBlock(w,!0))),y=E["quiz-master-next/quizID"],{quiz_name:k,post_id:B,rest_nonce:I}=E["quiz-master-next/quizAttr"],{createNotice:v}=(E["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{getBlockRootClientId:D,getBlockIndex:z}=(0,s.useSelect)(i.store),{insertBlock:N}=(0,s.useDispatch)(i.store),{isChanged:S=!1,questionID:T,type:A,description:F,title:P,correctAnswerInfo:M,commentBox:O,category:R,multicategories:L=[],hint:U,featureImageID:H,featureImageSrc:Q,answers:j,answerEditor:W,matchAnswer:Z,required:$}=m,G="1"==qsmBlockData.is_pro_activated,J=e=>14{let e=!0;if(e&&(d(T)||"0"==T||!d(T)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(T,w))){let e=h({id:null,rest_nonce:I,quizID:y,quiz_name:k,postID:B,answerEditor:q(W,"text"),type:q(A,"0"),name:_(q(F)),question_title:q(P),answerInfo:_(q(M)),comments:q(O,"1"),hint:q(U),category:q(R),multicategories:[],required:q($,0),answers:j,page:0,featureImageID:H,featureImageSrc:Q,matchAnswer:null});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;u({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&f&&!1===S&&u({isChanged:!0}),()=>{e=!1}}),[T,A,F,P,M,O,R,L,U,H,Q,j,W,Z,$]);const K=(0,i.useBlockProps)({className:x?" in-editing-mode":""}),V=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=V(e,t);a=[...a,...n]}return p(a)},X=["12","7","3","5","14"].includes(A)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"";return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>(()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);N(a,z(w)+1,D(w),!0)})()}),(0,a.createElement)(c.ToolbarButton,{icon:"welcome-add-page",label:(0,n.__)("Add New Page","quiz-master-next"),onClick:()=>(()=>{const e=(0,t.createBlock)("qsm/quiz-page"),a=D(w),n=z(a)+1,r=D(a);N(e,n,r,!0)})()}))),J(A)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+T),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...K},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+P))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+T),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:A||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||G||!["15","16","17"].includes(e))u({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[A])?"":qsmBlockData.question_type_description[A]+" "+X,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug,disabled:G&&J(e.slug)},e.name))))))),["0","4","1","10","13"].includes(A)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:W||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>u({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d($)&&"1"==$,onChange:()=>u({required:d($)||"1"!=$?1:0})})),(0,a.createElement)(b,{isCategorySelected:e=>L.includes(e),setUnsetCatgory:(e,t)=>{let a=d(L)||0===L.length?d(R)?[]:[R]:L;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{V(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=V(e,t);a=[...a,...n]}a=p(a),u({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(C,{featureImageID:H,onUpdateImage:e=>{u({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{u({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:O||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>u({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...K},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:P,onChange:e=>u({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),x&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here","quiz-master-next"),value:_(F),onChange:e=>u({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(A)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:_(M),onChange:e=>u({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Hint","quiz-master-next"),"aria-label":(0,n.__)("Hint","quiz-master-next"),placeholder:(0,n.__)("hint goes here","quiz-master-next"),value:U,onChange:e=>u({hint:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"})))))}})}(); \ No newline at end of file diff --git a/blocks/src/question/edit.js b/blocks/src/question/edit.js index 6eb2458dd..276c447e2 100644 --- a/blocks/src/question/edit.js +++ b/blocks/src/question/edit.js @@ -57,10 +57,14 @@ export default function Edit( props ) { } = context['quiz-master-next/quizAttr']; const pageID = context['quiz-master-next/pageID']; const { createNotice } = useDispatch( noticesStore ); + + //Get finstion to find index of blocks const { getBlockRootClientId, getBlockIndex } = useSelect( blockEditorStore ); + + //Get funstion to insert block const { insertBlock } = useDispatch( blockEditorStore ); @@ -269,12 +273,14 @@ export default function Edit( props ) { } } + //insert new Question const insertNewQuestion = () => { if ( qsmIsEmpty( props?.name )) { console.log("block name not found"); return true; } const blockToInsert = createBlock( props.name ); + const selectBlockOnInsert = true; insertBlock( blockToInsert, @@ -284,6 +290,21 @@ export default function Edit( props ) { ); } + //insert new Question + const insertNewPage = () => { + const blockToInsert = createBlock( 'qsm/quiz-page' ); + const currentPageClientID = getBlockRootClientId( clientId ); + const newPageIndex = getBlockIndex( currentPageClientID ) + 1; + const qsmBlockClientID = getBlockRootClientId( currentPageClientID ); + const selectBlockOnInsert = true; + insertBlock( + blockToInsert, + newPageIndex, + qsmBlockClientID, + selectBlockOnInsert + ); + } + return ( <> @@ -293,6 +314,11 @@ export default function Edit( props ) { label={ __( 'Add New Question', 'quiz-master-next' ) } onClick={ () => insertNewQuestion() } /> + insertNewPage() } + /> { isAdvanceQuestionType( type ) ? ( From 20963c23d9ceb34c493cca7f64e801f6a3904207 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Wed, 13 Mar 2024 10:00:20 +0530 Subject: [PATCH 20/27] add upload file settings and make global quiz create settings attributes function --- blocks/block.php | 37 +- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 2 +- blocks/build/index.asset.php | 2 +- blocks/build/index.css | 2 +- blocks/build/index.js | 2 +- blocks/build/question/block.json | 2 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 4 +- blocks/src/answer-option/edit.js | 2 +- blocks/src/component/InputComponent.js | 138 +++++++ blocks/src/edit.js | 67 +--- blocks/src/editor.scss | 8 +- blocks/src/helper.js | 7 + blocks/src/question/block.json | 2 +- blocks/src/question/edit.js | 65 +++- php/admin/functions.php | 420 +++++++++++---------- 17 files changed, 480 insertions(+), 284 deletions(-) create mode 100644 blocks/src/component/InputComponent.js diff --git a/blocks/block.php b/blocks/block.php index 0c085dfb0..3bb4c0154 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -134,24 +134,9 @@ private function hierarchical_qsm_category( $cat = 0 ) { */ public function register_block_scripts() { global $globalQuizsetting, $mlwQuizMasterNext; - if ( empty( $globalQuizsetting ) || empty( $mlwQuizMasterNext ) || ! function_exists( 'qsm_get_plugin_link' ) ) { + if ( empty( $globalQuizsetting ) || empty( $mlwQuizMasterNext ) || ! function_exists( 'qsm_get_plugin_link' ) || ! function_exists( 'qsm_settings_to_create_quiz' ) ) { return; } - - $quiz_options = $mlwQuizMasterNext->quiz_settings->load_setting_fields( 'quiz_options' ); - $quiz_options_id_details = array( - 'enable_contact_form' => array( - 'label' => __( 'Enable Contact Form', 'quiz-master-next' ), - 'help' => __( 'Display a contact form before quiz', 'quiz-master-next' ), - ), - ); - if ( ! empty( $quiz_options ) && is_array( $quiz_options ) ) { - foreach ( $quiz_options as $quiz ) { - if ( ! empty( $quiz ) && ! empty( $quiz['id'] ) ) { - $quiz_options_id_details[ $quiz['id'] ] = $quiz; - } - } - } $question_type = $mlwQuizMasterNext->pluginHelper->categorize_question_types(); $question_types = array(); @@ -195,7 +180,7 @@ public function register_block_scripts() { ) ), 'QSMQuizList' => function_exists( 'qsm_get_quizzes_list' ) ? qsm_get_quizzes_list(): array(), - 'quizOptions' => $quiz_options_id_details, + 'quizOptions' => qsm_settings_to_create_quiz( true ), 'question_type' => array( 'label' => __( 'Question Type', 'quiz-master-next' ), 'options' => $question_types, @@ -231,7 +216,23 @@ public function register_block_scripts() { ), 'default' => '1', 'documentation_link' => qsm_get_plugin_link( 'docs/creating-quizzes-and-surveys/adding-and-editing-questions/', 'quiz_editor', 'comment-box', 'quizsurvey-comment-box_doc' ), - ) + ), + 'file_upload_limit' => array( + 'heading' => __( 'File upload limit ( in MB )', 'quiz-master-next' ), + 'default' => '4', + ), + 'file_upload_type' => array( + 'heading' => __( 'Allow File type', 'quiz-master-next' ), + 'options' => array( + 'text/plain' => __( 'Text File', 'quiz-master-next' ), + 'image' => __( 'Image', 'quiz-master-next' ), + 'application/pdf' => __( 'PDF File', 'quiz-master-next' ), + 'doc' => __( 'Doc File', 'quiz-master-next' ), + 'excel' => __( 'Excel File', 'quiz-master-next' ), + 'video/mp4' => __( 'Video', 'quiz-master-next' ), + ), + 'default' => 'image,application/pdf', + ), ) ); } diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index f36f05282..58956a2f2 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => '2fa909fa636c97d43e0e'); + array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'f124c91015047dfda196'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index ad95eb322..e24e02dad 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -1 +1 @@ -!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,i=window.wp.htmlEntities,o=window.wp.escapeHtml,a=window.wp.blockEditor,l=window.wp.data,r=window.wp.url,c=window.wp.components,s=window.wp.blob,u=window.React,m=window.wp.primitives,d=(0,u.createElement)(m.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,u.createElement)(m.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),p=window.wp.notices;const w=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},E=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText};var h=function({url:e="",caption:i="",alt:o="",setURLCaption:r}){const u=["image"],[m,g]=(0,t.useState)(null),[E,h]=(0,t.useState)(),{imageDefaultSize:f,mediaUpload:x}=((0,t.useRef)(),(0,l.useSelect)((e=>{const{getSettings:t}=e(a.store),n=t();return{imageDefaultSize:n.imageDefaultSize,mediaUpload:n.mediaUpload}}),[])),{createErrorNotice:v}=(0,l.useDispatch)(p.store);function _(e){v(e,{type:"snackbar"}),r(void 0,void 0),h(void 0)}function q(e){if(!e||!e.url)return void r(void 0,void 0);if((0,s.isBlobURL)(e.url))return void h(e.url);h();let t=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));return n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e.url,n})(e,f);g(t.id),r(t.url,t.caption)}function z(t){t!==e&&r(t,i)}let b=((e,t)=>!e&&(0,s.isBlobURL)(t))(m,e);(0,t.useEffect)((()=>{if(!b)return;const t=(0,s.getBlobByURL)(e);t&&x({filesList:[t],onFileChange:([e])=>{q(e)},allowedTypes:u,onError:e=>{b=!1,_(e)}})}),[]),(0,t.useEffect)((()=>{b?h(e):(0,s.revokeBlobURL)(E)}),[b,e]);const R=((e,t)=>t&&!e&&!(0,s.isBlobURL)(t))(m,e)?e:void 0,B=!!e&&(0,t.createElement)("img",{alt:(0,n.__)("Edit image"),title:(0,n.__)("Edit image"),className:"edit-image-preview",src:e});let L=(0,t.createElement)(t.Fragment,null,(0,t.createElement)("img",{src:E||e,alt:"",className:"qsm-answer-option-image",style:{width:"200",height:"auto"}}),E&&(0,t.createElement)(c.Spinner,null));return(0,t.createElement)("figure",null,w(e)?(0,t.createElement)(a.MediaPlaceholder,{icon:(0,t.createElement)(a.BlockIcon,{icon:d}),onSelect:q,onSelectURL:z,onError:_,accept:"image/*",allowedTypes:u,value:{id:m,src:R},mediaPreview:B,disableMediaButtons:E||e}):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.BlockControls,{group:"other"},(0,t.createElement)(a.MediaReplaceFlow,{mediaId:m,mediaURL:e,allowedTypes:u,accept:"image/*",onSelect:q,onSelectURL:z,onError:_})),(0,t.createElement)("div",null,L)))},f=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(f.u2,{icon:()=>(0,t.createElement)(c.Icon,{icon:()=>(0,t.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("rect",{width:"24",height:"24",rx:"4.21657",fill:"#ADADAD"}),(0,t.createElement)("path",{d:"M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z",fill:"white"}))}),merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(s){if("undefined"==typeof qsmBlockData)return null;const{className:u,attributes:m,setAttributes:d,isSelected:p,clientId:f,context:x,mergeBlocks:v,onReplace:_,onRemove:q}=s,z=(x["quiz-master-next/quizID"],x["quiz-master-next/pageID"],x["quiz-master-next/questionID"],x["quiz-master-next/questionType"]),b=x["quiz-master-next/answerType"],R=x["quiz-master-next/questionChanged"],B="qsm/quiz-answer-option",{optionID:L,content:k,caption:S,points:C,isCorrect:y}=m,{selectBlock:U}=(0,l.useDispatch)(a.store),{updateBlockAttributes:T}=(0,l.useDispatch)(a.store),D=(0,l.useSelect)((e=>{let t=e(a.store).getBlockParentsByBlockName(f,"qsm/quiz-question",!0);return w(t)?"":t[0]}),[f]);(0,t.useEffect)((()=>{let e=!0;return e&&p&&!w(D)&&!1===R&&T(D,{isChanged:!0}),()=>{e=!1}}),[k,S,C,y]),(0,t.useEffect)((()=>{let e=!0;return e&&(w(k)||!(0,r.isURL)(k)||-1===k.indexOf("https://")&&-1===k.indexOf("http://")||!["rich","text"].includes(b)||d({content:"",caption:""})),()=>{e=!1}}),[b]);const I=(0,a.useBlockProps)({className:p?" is-highlighted ":""}),A=["4","10"].includes(z)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.InspectorControls,null,(0,t.createElement)(c.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},"image"===b&&(0,t.createElement)(c.TextControl,{type:"text",label:(0,n.__)("Caption","quiz-master-next"),value:S,onChange:e=>d({caption:(0,o.escapeAttribute)(e)})}),(0,t.createElement)(c.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:C,onChange:e=>d({points:e})}),["0","4","1","10","2"].includes(z)&&(0,t.createElement)(c.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!w(y)&&"1"==y,onChange:()=>d({isCorrect:w(y)||"1"!=y?1:0})}))),(0,t.createElement)("div",{...I},(0,t.createElement)(c.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:A,readOnly:!0,tabIndex:"-1"}),!["rich","image"].includes(b)&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:E((0,i.decodeEntities)(k)),onChange:e=>d({content:E((0,i.decodeEntities)(e))}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=f),o},onMerge:v,onReplace:_,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}),"rich"===b&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:g((0,i.decodeEntities)(k)),onChange:e=>d({content:e}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=f),o},onMerge:v,onReplace:_,onRemove:q,className:"qsm-question-answer-option",identifier:"text",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),"image"===b&&(0,t.createElement)(h,{url:(0,r.isURL)(k)?k:"",caption:S,setURLCaption:(e,t)=>d({content:(0,r.isURL)(e)?e:"",caption:t})}))))}})}(); \ No newline at end of file +!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,i=window.wp.htmlEntities,o=window.wp.escapeHtml,a=window.wp.blockEditor,l=window.wp.data,r=window.wp.url,c=window.wp.components,s=window.wp.blob,u=window.React,m=window.wp.primitives,d=(0,u.createElement)(m.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,u.createElement)(m.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),p=window.wp.notices;const w=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},E=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText};var h=function({url:e="",caption:i="",alt:o="",setURLCaption:r}){const u=["image"],[m,g]=(0,t.useState)(null),[E,h]=(0,t.useState)(),{imageDefaultSize:f,mediaUpload:x}=((0,t.useRef)(),(0,l.useSelect)((e=>{const{getSettings:t}=e(a.store),n=t();return{imageDefaultSize:n.imageDefaultSize,mediaUpload:n.mediaUpload}}),[])),{createErrorNotice:v}=(0,l.useDispatch)(p.store);function _(e){v(e,{type:"snackbar"}),r(void 0,void 0),h(void 0)}function q(e){if(!e||!e.url)return void r(void 0,void 0);if((0,s.isBlobURL)(e.url))return void h(e.url);h();let t=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));return n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e.url,n})(e,f);g(t.id),r(t.url,t.caption)}function b(t){t!==e&&r(t,i)}let z=((e,t)=>!e&&(0,s.isBlobURL)(t))(m,e);(0,t.useEffect)((()=>{if(!z)return;const t=(0,s.getBlobByURL)(e);t&&x({filesList:[t],onFileChange:([e])=>{q(e)},allowedTypes:u,onError:e=>{z=!1,_(e)}})}),[]),(0,t.useEffect)((()=>{z?h(e):(0,s.revokeBlobURL)(E)}),[z,e]);const R=((e,t)=>t&&!e&&!(0,s.isBlobURL)(t))(m,e)?e:void 0,B=!!e&&(0,t.createElement)("img",{alt:(0,n.__)("Edit image"),title:(0,n.__)("Edit image"),className:"edit-image-preview",src:e});let L=(0,t.createElement)(t.Fragment,null,(0,t.createElement)("img",{src:E||e,alt:"",className:"qsm-answer-option-image",style:{width:"200",height:"auto"}}),E&&(0,t.createElement)(c.Spinner,null));return(0,t.createElement)("figure",null,w(e)?(0,t.createElement)(a.MediaPlaceholder,{icon:(0,t.createElement)(a.BlockIcon,{icon:d}),onSelect:q,onSelectURL:b,onError:_,accept:"image/*",allowedTypes:u,value:{id:m,src:R},mediaPreview:B,disableMediaButtons:E||e}):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.BlockControls,{group:"other"},(0,t.createElement)(a.MediaReplaceFlow,{mediaId:m,mediaURL:e,allowedTypes:u,accept:"image/*",onSelect:q,onSelectURL:b,onError:_})),(0,t.createElement)("div",null,L)))},f=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(f.u2,{icon:()=>(0,t.createElement)(c.Icon,{icon:()=>(0,t.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("rect",{width:"24",height:"24",rx:"4.21657",fill:"#ADADAD"}),(0,t.createElement)("path",{d:"M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z",fill:"white"}))}),merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(s){if("undefined"==typeof qsmBlockData)return null;const{className:u,attributes:m,setAttributes:d,isSelected:p,clientId:f,context:x,mergeBlocks:v,onReplace:_,onRemove:q}=s,b=(x["quiz-master-next/quizID"],x["quiz-master-next/pageID"],x["quiz-master-next/questionID"],x["quiz-master-next/questionType"]),z=x["quiz-master-next/answerType"],R=x["quiz-master-next/questionChanged"],B="qsm/quiz-answer-option",{optionID:L,content:k,caption:S,points:C,isCorrect:y}=m,{selectBlock:U}=(0,l.useDispatch)(a.store),{updateBlockAttributes:T}=(0,l.useDispatch)(a.store),D=(0,l.useSelect)((e=>{let t=e(a.store).getBlockParentsByBlockName(f,"qsm/quiz-question",!0);return w(t)?"":t[0]}),[f]);(0,t.useEffect)((()=>{let e=!0;return e&&p&&!w(D)&&!1===R&&T(D,{isChanged:!0}),()=>{e=!1}}),[k,S,C,y]),(0,t.useEffect)((()=>{let e=!0;return e&&(w(k)||!(0,r.isURL)(k)||-1===k.indexOf("https://")&&-1===k.indexOf("http://")||!["rich","text"].includes(z)||d({content:"",caption:""})),()=>{e=!1}}),[z]);const I=(0,a.useBlockProps)({className:p?" is-highlighted ":""}),A=["4","10"].includes(b)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.InspectorControls,null,(0,t.createElement)(c.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},"image"===z&&(0,t.createElement)(c.TextControl,{type:"text",label:(0,n.__)("Caption","quiz-master-next"),value:S,onChange:e=>d({caption:(0,o.escapeAttribute)(e)})}),(0,t.createElement)(c.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:C,onChange:e=>d({points:e})}),["0","4","1","10","2"].includes(b)&&(0,t.createElement)(c.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!w(y)&&"1"==y,onChange:()=>d({isCorrect:w(y)||"1"!=y?1:0})}))),(0,t.createElement)("div",{...I},(0,t.createElement)(c.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:A,disabled:!0,readOnly:!0,tabIndex:"-1"}),!["rich","image"].includes(z)&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:E((0,i.decodeEntities)(k)),onChange:e=>d({content:E((0,i.decodeEntities)(e))}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=f),o},onMerge:v,onReplace:_,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}),"rich"===z&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:g((0,i.decodeEntities)(k)),onChange:e=>d({content:e}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=f),o},onMerge:v,onReplace:_,onRemove:q,className:"qsm-question-answer-option",identifier:"text",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),"image"===z&&(0,t.createElement)(h,{url:(0,r.isURL)(k)?k:"",caption:S,setURLCaption:(e,t)=>d({content:(0,r.isURL)(e)?e:"",caption:t})}))))}})}(); \ No newline at end of file diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 911c51e3f..c987538a3 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '5790e173579b9c6eb9ce'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => 'aff066110a75fa50ea10'); diff --git a/blocks/build/index.css b/blocks/build/index.css index 979537d3c..2b6bc3aed 100644 --- a/blocks/build/index.css +++ b/blocks/build/index.css @@ -1 +1 @@ -.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.qsm-placeholder-quiz-create-form{width:50%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{font-size:1rem}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666} +.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.editor-styles-wrapper .qsm-advance-settings{display:flex;flex-direction:column;gap:2rem}.qsm-placeholder-quiz-create-form{width:75%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{font-size:1rem}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666} diff --git a/blocks/build/index.js b/blocks/build/index.js index da82dcd0d..3e700288f 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={775:function(e,t,n){var i=window.wp.blocks,a=window.wp.element,s=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),u=window.wp.htmlEntities,l=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,q=window.wp.components;const _=e=>null==e||""===e,d=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},h=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let i=0;i`${e}${h(8)}${t?`.${h(7)}`:""}`,z=(e,t="")=>_(e)?t:e,w=()=>(0,a.createElement)(q.Icon,{icon:()=>(0,a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,a.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,i.registerBlockType)("qsm/quiz",{icon:w,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:h}=e,{createNotice:b}=(0,m.useDispatch)(c.store),v=qsmBlockData.globalQuizsetting,{quizID:y,postID:E,quizAttr:k=v}=n,[D,I]=(0,a.useState)(qsmBlockData.QSMQuizList),[x,B]=(0,a.useState)({error:!1,msg:""}),[C,S]=(0,a.useState)(!1),[O,P]=(0,a.useState)(!1),[N,A]=(0,a.useState)(!1),[T,Q]=(0,a.useState)([]),M=qsmBlockData.quizOptions,j=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:H}=(0,m.useSelect)(l.store);(0,a.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{F()}),100),!_(y)&&0{if(y==t.value)return e=!0,!0})),e?L(y):(i({quizID:void 0}),B({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const F=()=>{let e=document.getElementById("modal-advanced-question-type");_(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");_(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},L=e=>{!_(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(i({quizID:parseInt(e),postID:n.post_id,quizAttr:{...k,...n}}),!_(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];_(t.question_arr)||t.question_arr.forEach((e=>{if(!_(e)){let t=[];!_(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:z(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},K=(e,t)=>{let n=k;n[t]=e,i({quizAttr:{...n}})};(0,a.useEffect)((()=>{if(j){let e=(()=>{let e=H(h);if(_(e))return!1;e=e.innerBlocks;let t={quiz_id:k.quiz_id,post_id:k.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let i=e.attributes.pageID,a=[];!_(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let i=e.attributes,s=z(i?.answerEditor,"text"),r=[];!_(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=z(t?.content);_(i?.answerEditor)||"rich"!==i.answerEditor||(n=d((0,u.decodeEntities)(n)));let a=[n,z(t?.points),z(t?.isCorrect)];"image"!==s||_(t?.caption)||a.push(t?.caption),r.push(a)})),a.push(i.questionID),i.isChanged&&t.questions.push({id:i.questionID,quizID:k.quiz_id,postID:k.post_id,answerEditor:s,type:z(i?.type,"0"),name:d(z(i?.description)),question_title:z(i?.title),answerInfo:d(z(i?.correctAnswerInfo)),comments:z(i?.commentBox,"1"),hint:z(i?.hint),category:z(i?.category),multicategories:z(i?.multicategories,[]),required:z(i?.required,0),answers:r,featureImageID:z(i?.featureImageID),featureImageSrc:z(i?.featureImageSrc),page:n,other_settings:{required:z(i?.required,0)}})})),t.pages.push(a),t.qpages.push({id:i,quizID:k.quiz_id,pagekey:_(e.attributes.pageKey)?f():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:a}),n++}})),t.quiz={quiz_name:k.quiz_name,quiz_id:k.quiz_id,post_id:k.post_id},N&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==k[e]&&null!==k[e]&&(t.quiz[e]=k[e])})),t})();P(!0),e=g({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{b(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[j]);const V=(0,l.useBlockProps)(),$=(0,l.useInnerBlocksProps)(V,{template:T,allowedBlocks:["qsm/quiz-page"]});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.InspectorControls,null,(0,a.createElement)(q.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,a.createElement)("span",{className:"qsm-inspector-label-value"},k.post_status)),(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:k?.quiz_name||"",onChange:e=>K(e,"quiz_name"),className:"qsm-no-mb"}),(!_(y)||"0"!=y)&&(0,a.createElement)("p",null,(0,a.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+y},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),_(y)||"0"==y?(0,a.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:w,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,a.createElement)(a.Fragment,null,!_(D)&&0L(e),disabled:C,__nextHasNoMarginBottom:!0}),(0,a.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>S(!C)},(0,s.__)("Add New","quiz-master-next"))),(_(D)||C)&&(0,a.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,a.createElement)(q.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:k?.quiz_name||"",onChange:e=>K(e,"quiz_name")}),(0,a.createElement)(q.Button,{variant:"link",onClick:()=>A(!N)},(0,s.__)("Advance options","quiz-master-next")),N&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(q.SelectControl,{label:M?.form_type?.label,value:k?.form_type,options:M?.form_type?.options,onChange:e=>K(e,"form_type"),__nextHasNoMarginBottom:!0}),(0,a.createElement)(q.SelectControl,{label:M?.system?.label,value:k?.system,options:M?.system?.options,onChange:e=>K(e,"system"),help:M?.system?.help,__nextHasNoMarginBottom:!0}),["timer_limit","pagination"].map((e=>(0,a.createElement)(q.TextControl,{key:"quiz-create-text-"+e,type:"number",label:M?.[e]?.label,help:M?.[e]?.help,value:_(k[e])?0:k[e],onChange:t=>K(t,e)}))),["enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].map((e=>(0,a.createElement)(q.ToggleControl,{key:"quiz-create-toggle-"+e,label:M?.[e]?.label,help:M?.[e]?.help,checked:!_(k[e])&&"1"==k[e],onChange:()=>K(_(k[e])||"1"!=k[e]?1:0,e)})))),(0,a.createElement)(q.Button,{variant:"primary",disabled:O||_(k.quiz_name),onClick:()=>(()=>{if(_(k.quiz_name))return void console.log("empty quiz_name");P(!0);let e=g({quiz_name:k.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===k[t]||null===k[t]?"":e.append(t,k[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(P(!1),"success"==e.status){let t=g({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:1,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,i=g({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});i.append("pages[0][]",n),i.append("qpages[0][id]",1),i.append("qpages[0][quizID]",e.quizID),i.append("qpages[0][pagekey]",f()),i.append("qpages[0][hide_prevbtn]",0),i.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:i}).then((t=>{"success"==t.status&&L(e.quizID)}))}})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))}b(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),b("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),x.error&&(0,a.createElement)("p",{className:"qsm-error-text"},x.msg))):(0,a.createElement)("div",{...$}))},save:e=>null})}},n={};function i(e){var a=n[e];if(void 0!==a)return a.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,i),s.exports}i.m=t,e=[],i.O=function(t,n,a,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,a,s]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var a,s,r=n[0],o=n[1],u=n[2],l=0;if(r.some((function(t){return 0!==e[t]}))){for(a in o)i.o(o,a)&&(i.m[a]=o[a]);if(u)var c=u(i)}for(t&&t(n);lnull==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},_=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},f=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let a=0;a`${e}${f(8)}${t?`.${f(7)}`:""}`,b=(e,t="")=>d(e)?t:e,v=()=>{};function w({className:e="",quizAttr:t,setAttributes:n,data:a,onChangeFunc:i=v}){const r=(()=>{if(a.defaultvalue=a.default,!d(a?.options))switch(a.type){case"checkbox":1===a.options.length&&(a.type="toggle"),a.label=a.options[0].label;break;case"radio":1{var e,n,a,r;switch(u){case"toggle":return(0,s.createElement)(q.ToggleControl,{label:l,help:c,checked:!d(t[o])&&"1"==t[o],onChange:()=>i(d(t[o])||"1"!=t[o]?1:0,o)});case"select":return(0,s.createElement)(q.SelectControl,{label:l,value:null!==(e=t[o])&&void 0!==e?e:p,options:m,onChange:e=>i(e,o),help:c,__nextHasNoMarginBottom:!0});case"number":return(0,s.createElement)(q.TextControl,{type:"number",label:l,value:null!==(n=t[o])&&void 0!==n?n:p,onChange:e=>i(e,o),help:c,__nextHasNoMarginBottom:!0});case"text":return(0,s.createElement)(q.TextControl,{type:"text",label:l,value:null!==(a=t[o])&&void 0!==a?a:p,onChange:e=>i(e,o),help:c,__nextHasNoMarginBottom:!0});case"checkbox":return(0,s.createElement)(q.CheckboxControl,{label:l,help:c,checked:!d(t[o])&&"1"==t[o],onChange:()=>i(d(t[o])||"1"!=t[o]?1:0,o)});default:return(0,s.createElement)(q.TextControl,{type:"text",label:l,value:null!==(r=t[o])&&void 0!==r?r:p,onChange:e=>i(e,o),help:c,__nextHasNoMarginBottom:!0})}})()}const y=()=>(0,s.createElement)(q.Icon,{icon:()=>(0,s.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,s.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,a.registerBlockType)("qsm/quiz",{icon:y,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:a,isSelected:r,clientId:_}=e,{createNotice:f}=(0,m.useDispatch)(c.store),v=qsmBlockData.globalQuizsetting,{quizID:E,postID:k,quizAttr:x=v}=n,[D,I]=(0,s.useState)(qsmBlockData.QSMQuizList),[B,C]=(0,s.useState)({error:!1,msg:""}),[S,N]=(0,s.useState)(!1),[O,A]=(0,s.useState)(!1),[P,T]=(0,s.useState)(!1),[M,Q]=(0,s.useState)([]),H=qsmBlockData.quizOptions,j=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:F}=(0,m.useSelect)(u.store);(0,s.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{L()}),100),!d(E)&&0{if(E==t.value)return e=!0,!0})),e?K(E):(a({quizID:void 0}),C({error:!0,msg:(0,i.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const L=()=>{let e=document.getElementById("modal-advanced-question-type");d(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");d(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},K=e=>{!d(e)&&0{if("success"==t.status){C({error:!1,msg:""});let n=t.result;if(a({quizID:parseInt(e),postID:n.post_id,quizAttr:{...x,...n}}),!d(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];d(t.question_arr)||t.question_arr.forEach((e=>{if(!d(e)){let t=[];!d(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:b(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},V=(e,t)=>{let n=x;n[t]=e,a({quizAttr:{...n}})};(0,s.useEffect)((()=>{if(j){let e=(()=>{let e=F(_);if(d(e))return!1;e=e.innerBlocks;let t={quiz_id:x.quiz_id,post_id:x.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,s=[];!d(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,i=b(a?.answerEditor,"text"),r=[];!d(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=b(t?.content);d(a?.answerEditor)||"rich"!==a.answerEditor||(n=g((0,l.decodeEntities)(n)));let s=[n,b(t?.points),b(t?.isCorrect)];"image"!==i||d(t?.caption)||s.push(t?.caption),r.push(s)})),s.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:x.quiz_id,postID:x.post_id,answerEditor:i,type:b(a?.type,"0"),name:g(b(a?.description)),question_title:b(a?.title),answerInfo:g(b(a?.correctAnswerInfo)),comments:b(a?.commentBox,"1"),hint:b(a?.hint),category:b(a?.category),multicategories:b(a?.multicategories,[]),required:b(a?.required,0),answers:r,featureImageID:b(a?.featureImageID),featureImageSrc:b(a?.featureImageSrc),page:n,other_settings:{...b(a?.settings,{}),required:b(a?.required,0)}})})),t.pages.push(s),t.qpages.push({id:a,quizID:x.quiz_id,pagekey:d(e.attributes.pageKey)?z():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:x.quiz_name,quiz_id:x.quiz_id,post_id:x.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==x[e]&&null!==x[e]&&(t.quiz[e]=x[e])})),t})();A(!0),e=h({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[j]);const $=(0,u.useBlockProps)(),R=(0,u.useInnerBlocksProps)($,{template:M,allowedBlocks:["qsm/quiz-page"]});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.InspectorControls,null,(0,s.createElement)(q.PanelBody,{title:(0,i.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,s.createElement)("label",{className:"qsm-inspector-label"},(0,i.__)("Status","quiz-master-next")+":",(0,s.createElement)("span",{className:"qsm-inspector-label-value"},x.post_status)),(0,s.createElement)(q.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>V(e,"quiz_name"),className:"qsm-no-mb"}),(!d(E)||"0"!=E)&&(0,s.createElement)("p",null,(0,s.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+E},(0,i.__)("Advance Quiz Settings","quiz-master-next"))))),d(E)||"0"==E?(0,s.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:y,label:(0,i.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,i.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,s.createElement)(s.Fragment,null,!d(D)&&0K(e),disabled:S,__nextHasNoMarginBottom:!0}),(0,s.createElement)("span",null,(0,i.__)("OR","quiz-master-next")),(0,s.createElement)(q.Button,{variant:"link",onClick:()=>N(!S)},(0,i.__)("Add New","quiz-master-next"))),(d(D)||S)&&(0,s.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,s.createElement)(q.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>V(e,"quiz_name")}),(0,s.createElement)(q.Button,{variant:"link",onClick:()=>T(!P)},(0,i.__)("Advance options","quiz-master-next")),(0,s.createElement)("div",{className:"qsm-advance-settings"},P&&H.map((e=>(0,s.createElement)(w,{key:"qsm-settings"+e.id,data:e,quizAttr:x,setAttributes:a,onChangeFunc:V})))),(0,s.createElement)(q.Button,{variant:"primary",disabled:O||d(x.quiz_name),onClick:()=>(()=>{if(d(x.quiz_name))return void console.log("empty quiz_name");A(!0);let e=h({quiz_name:x.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===x[t]||null===x[t]?"":e.append(t,x[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(A(!1),"success"==e.status){let t=h({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:0,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=h({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",z()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&K(e.quizID)}))}})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,i.__)("Create Quiz","quiz-master-next"))),B.error&&(0,s.createElement)("p",{className:"qsm-error-text"},B.msg))):(0,s.createElement)("div",{...R}))},save:e=>null})}},n={};function a(e){var s=n[e];if(void 0!==s)return s.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.m=t,e=[],a.O=function(t,n,s,i){if(!n){var r=1/0;for(c=0;c=i)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(o=!1,i0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[n,s,i]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,i,r=n[0],o=n[1],l=n[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(s in o)a.o(o,s)&&(a.m[s]=o[s]);if(l)var c=l(a)}for(t&&t(n);u array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'c6a0dc201b16dffc8a36'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'dcd1877a00a779b25a17'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 7ed14d914..1ff899231 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -1,5 +1,5 @@ -!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch,o=e.n(r),i=window.wp.blockEditor,l=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,p=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=_(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],w=(0,n.__)("Featured image"),E=(0,n.__)("Set featured image"),x=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media."));var C=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:o}=(0,s.useDispatch)(l.store),p=(0,a.useRef)(),[_,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:C,mediaUpload:b}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function y(e){b({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){o("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(C)||"object"!=typeof C||q({id:e,width:C.media_details.width,height:C.media_details.height,url:C.source_url,alt_text:C.alt_text,slug:C.slug})),()=>{t=!1}}),[C]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( +!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch,l=e.n(r),i=window.wp.blockEditor,o=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,p=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=_(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],E=(0,n.__)("Featured image"),x=(0,n.__)("Set featured image"),C=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media."));var w=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:l}=(0,s.useDispatch)(o.store),p=(0,a.useRef)(),[_,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:w,mediaUpload:y}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function b(e){y({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){l("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(w)||"object"!=typeof w||q({id:e,width:w.media_details.width,height:w.media_details.height,url:w.source_url,alt_text:w.alt_text,slug:w.slug})),()=>{t=!1}}),[w]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( // Translators: %s: The selected image alt text. (0,n.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,n.sprintf)( // Translators: %s: The selected image filename. -(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:w,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:p,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),_&&(0,a.createElement)(c.Spinner,null),!e&&!_&&E),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),p.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:y})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[l,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[p,_]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,w]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),E=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,x)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},B(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},B(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},b)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(l)||p||(_(!0),o()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:l,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;o()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(w(e.result),C(e.result),s(""),u(0),t(a,E(term.id)),_(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:l,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||p},b)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},y=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(y.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:r,attributes:m,setAttributes:u,isSelected:f,clientId:w,context:E}=e,x=(0,s.useSelect)((e=>f||e("core/block-editor").hasSelectedInnerBlock(w,!0))),y=E["quiz-master-next/quizID"],{quiz_name:k,post_id:B,rest_nonce:I}=E["quiz-master-next/quizAttr"],{createNotice:v}=(E["quiz-master-next/pageID"],(0,s.useDispatch)(l.store)),{getBlockRootClientId:D,getBlockIndex:z}=(0,s.useSelect)(i.store),{insertBlock:N}=(0,s.useDispatch)(i.store),{isChanged:S=!1,questionID:T,type:A,description:F,title:P,correctAnswerInfo:M,commentBox:O,category:R,multicategories:L=[],hint:U,featureImageID:H,featureImageSrc:Q,answers:j,answerEditor:W,matchAnswer:Z,required:$}=m,G="1"==qsmBlockData.is_pro_activated,J=e=>14{let e=!0;if(e&&(d(T)||"0"==T||!d(T)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(T,w))){let e=h({id:null,rest_nonce:I,quizID:y,quiz_name:k,postID:B,answerEditor:q(W,"text"),type:q(A,"0"),name:_(q(F)),question_title:q(P),answerInfo:_(q(M)),comments:q(O,"1"),hint:q(U),category:q(R),multicategories:[],required:q($,0),answers:j,page:0,featureImageID:H,featureImageSrc:Q,matchAnswer:null});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;u({questionID:t})}})).catch((e=>{console.log("error",e),v("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&f&&!1===S&&u({isChanged:!0}),()=>{e=!1}}),[T,A,F,P,M,O,R,L,U,H,Q,j,W,Z,$]);const K=(0,i.useBlockProps)({className:x?" in-editing-mode":""}),V=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=V(e,t);a=[...a,...n]}return p(a)},X=["12","7","3","5","14"].includes(A)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"";return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>(()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);N(a,z(w)+1,D(w),!0)})()}),(0,a.createElement)(c.ToolbarButton,{icon:"welcome-add-page",label:(0,n.__)("Add New Page","quiz-master-next"),onClick:()=>(()=>{const e=(0,t.createBlock)("qsm/quiz-page"),a=D(w),n=z(a)+1,r=D(a);N(e,n,r,!0)})()}))),J(A)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+T),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...K},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+P))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+T),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:A||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||G||!["15","16","17"].includes(e))u({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[A])?"":qsmBlockData.question_type_description[A]+" "+X,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug,disabled:G&&J(e.slug)},e.name))))))),["0","4","1","10","13"].includes(A)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:W||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>u({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d($)&&"1"==$,onChange:()=>u({required:d($)||"1"!=$?1:0})})),(0,a.createElement)(b,{isCategorySelected:e=>L.includes(e),setUnsetCatgory:(e,t)=>{let a=d(L)||0===L.length?d(R)?[]:[R]:L;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{V(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=V(e,t);a=[...a,...n]}a=p(a),u({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(C,{featureImageID:H,onUpdateImage:e=>{u({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{u({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:O||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>u({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...K},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:P,onChange:e=>u({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),x&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here","quiz-master-next"),value:_(F),onChange:e=>u({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(A)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:_(M),onChange:e=>u({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Hint","quiz-master-next"),"aria-label":(0,n.__)("Hint","quiz-master-next"),placeholder:(0,n.__)("hint goes here","quiz-master-next"),value:U,onChange:e=>u({hint:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"})))))}})}(); \ No newline at end of file +(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:C},(0,a.createElement)(i.MediaUpload,{title:E,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:p,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),_&&(0,a.createElement)(c.Spinner,null),!e&&!_&&x),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),p.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:b})),value:e})))},y=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[p,_]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,E]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,C)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},B(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},B(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},y)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(o)||p||(_(!0),l()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:o,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;l()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(E(e.result),w(e.result),s(""),u(0),t(a,x(term.id)),_(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:o,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||p},y)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},b=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(b.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){var r;if("undefined"==typeof qsmBlockData)return null;const{className:m,attributes:u,setAttributes:f,isSelected:E,clientId:x,context:C}=e,b=(0,s.useSelect)((e=>E||e("core/block-editor").hasSelectedInnerBlock(x,!0))),k=C["quiz-master-next/quizID"],{quiz_name:B,post_id:v,rest_nonce:D}=C["quiz-master-next/quizAttr"],{createNotice:I}=(C["quiz-master-next/pageID"],(0,s.useDispatch)(o.store)),{getBlockRootClientId:z,getBlockIndex:N}=(0,s.useSelect)(i.store),{insertBlock:S}=(0,s.useDispatch)(i.store),{isChanged:T=!1,questionID:A,type:F,description:P,title:O,correctAnswerInfo:M,commentBox:R,category:L,multicategories:U=[],hint:H,featureImageID:Q,featureImageSrc:j,answers:W,answerEditor:Z,matchAnswer:$,required:G,settings:J={}}=u,K="1"==qsmBlockData.is_pro_activated,V=e=>14{let e=J?.file_upload_type||qsmBlockData.file_upload_type.default;return d(e)?[]:e.split(",")};(0,a.useEffect)((()=>{let e=!0;if(e&&(d(A)||"0"==A||!d(A)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(A,x))){let e=h({id:null,rest_nonce:D,quizID:k,quiz_name:B,postID:v,answerEditor:q(Z,"text"),type:q(F,"0"),name:_(q(P)),question_title:q(O),answerInfo:_(q(M)),comments:q(R,"1"),hint:q(H),category:q(L),multicategories:[],required:q(G,0),answers:W,page:0,featureImageID:Q,featureImageSrc:j,matchAnswer:null});l()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;f({questionID:t})}})).catch((e=>{console.log("error",e),I("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&E&&!1===T&&f({isChanged:!0}),()=>{e=!1}}),[A,F,P,O,M,R,L,U,H,Q,j,W,Z,$,G,J]);const ee=(0,i.useBlockProps)({className:b?" in-editing-mode":""}),te=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=te(e,t);a=[...a,...n]}return p(a)},ae=["12","7","3","5","14"].includes(F)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"";return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>(()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);S(a,N(x)+1,z(x),!0)})()}),(0,a.createElement)(c.ToolbarButton,{icon:"welcome-add-page",label:(0,n.__)("Add New Page","quiz-master-next"),onClick:()=>(()=>{const e=(0,t.createBlock)("qsm/quiz-page"),a=z(x),n=N(a)+1,r=z(a);S(e,n,r,!0)})()}))),V(F)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+A),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...ee},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+O))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+A),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:F||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||K||!["15","16","17"].includes(e))f({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[F])?"":qsmBlockData.question_type_description[F]+" "+ae,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug,disabled:K&&V(e.slug)},e.name))))))),["0","4","1","10","13"].includes(F)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:Z||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>f({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d(G)&&"1"==G,onChange:()=>f({required:d(G)||"1"!=G?1:0})})),"11"==F&&(0,a.createElement)(c.PanelBody,{title:(0,n.__)("File Settings","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{type:"number",label:qsmBlockData.file_upload_limit.heading,value:null!==(r=J?.file_upload_limit)&&void 0!==r?r:qsmBlockData.file_upload_limit.default,onChange:e=>f({settings:{...J,file_upload_limit:e}})}),(0,a.createElement)("label",{className:"qsm-inspector-label"},qsmBlockData.file_upload_type.heading),Object.keys(qsmBlockData.file_upload_type.options).map((e=>{return(0,a.createElement)(c.CheckboxControl,{key:"filetype-"+e,label:X[e],checked:(t=e,Y().includes(t)),onChange:()=>(e=>{let t=Y();t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),t=t.join(","),f({settings:{...J,file_upload_type:t}})})(e)});var t}))),(0,a.createElement)(y,{isCategorySelected:e=>U.includes(e),setUnsetCatgory:(e,t)=>{let a=d(U)||0===U.length?d(L)?[]:[L]:U;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{te(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=te(e,t);a=[...a,...n]}a=p(a),f({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(w,{featureImageID:Q,onUpdateImage:e=>{f({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{f({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:R||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>f({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...ee},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:O,onChange:e=>f({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),b&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here","quiz-master-next"),value:_(P),onChange:e=>f({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(F)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:_(M),onChange:e=>f({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Hint","quiz-master-next"),"aria-label":(0,n.__)("Hint","quiz-master-next"),placeholder:(0,n.__)("hint goes here","quiz-master-next"),value:H,onChange:e=>f({hint:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"})))))}})}(); \ No newline at end of file diff --git a/blocks/src/answer-option/edit.js b/blocks/src/answer-option/edit.js index ddabad4c1..f46688147 100644 --- a/blocks/src/answer-option/edit.js +++ b/blocks/src/answer-option/edit.js @@ -140,7 +140,7 @@ onRemove } = props; spacing={ 1 } justify='left' > - + { /**Text answer option*/ ! ['rich','image'].includes( answerType ) && {}; +export default function InputComponent( { + className='', + quizAttr, + setAttributes, + data, + onChangeFunc = noop, +} ) { + + const processData = ( ) => { + data.defaultvalue = data.default; + if ( ! qsmIsEmpty( data?.options ) ) { + switch (data.type) { + case 'checkbox': + if ( 1 === data.options.length ) { + data.type = 'toggle'; + } + data.label = data.options[0].label; + break; + case 'radio': + if ( 1 < data.options.length ) { + data.type = 'select'; + } else { + data.label = data.options[0].label; + } + break; + default: + break; + } + } + data.label = qsmIsEmpty( data.label ) ? '': qsmStripTags( data.label ); + data.help = qsmIsEmpty( data.help ) ? '': qsmStripTags( data.help ); + return data; + } + + const newData = processData(); + const { + id, + label='', + type, + help='', + options=[], + defaultvalue + } = newData; + + const getComponent = ( ) => { + const key = 'quiz-create-toggle-'+id; + switch ( type ) { + case 'toggle': + return ( + onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) } + /> + ); + break; + case 'select': + return ( + onChangeFunc( val, id) } + help={ help } + __nextHasNoMarginBottom + /> + ); + break; + case 'number': + return ( + onChangeFunc( val, id) } + help={ help } + __nextHasNoMarginBottom + /> + ); + break; + case 'text': + return ( + onChangeFunc( val, id) } + help={ help } + __nextHasNoMarginBottom + /> + ); + break; + case 'checkbox': + return ( + onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) } + /> + ); + break; + default: + return ( + onChangeFunc( val, id) } + help={ help } + __nextHasNoMarginBottom + /> + ); + break; + } + } + + return getComponent(); +} \ No newline at end of file diff --git a/blocks/src/edit.js b/blocks/src/edit.js index 50dc00fea..af8aa38c2 100644 --- a/blocks/src/edit.js +++ b/blocks/src/edit.js @@ -24,6 +24,7 @@ import { } from '@wordpress/components'; import './editor.scss'; import { qsmIsEmpty, qsmFormData, qsmUniqid, qsmValueOrDefault, qsmDecodeHtml } from './helper'; +import InputComponent from './component/InputComponent'; import { qsmBlockIcon } from './component/icon'; export default function Edit( props ) { //check for QSM initialize data @@ -285,61 +286,18 @@ export default function Edit( props ) { > { __( 'Advance options', 'quiz-master-next' ) } - { showAdvanceOption && (<> - {/**Form Type */} - setQuizAttributes( val, 'form_type') } - __nextHasNoMarginBottom +
+ { showAdvanceOption && quizOptions.map( qSetting => ( + - {/**Grading Type */} - setQuizAttributes( val, 'system') } - help={ quizOptions?.system?.help } - __nextHasNoMarginBottom - /> - { - [ - 'timer_limit', - 'pagination', - ].map( ( item ) => ( - setQuizAttributes( val, item) } - /> - ) ) - } - { - [ - 'enable_contact_form', - 'enable_pagination_quiz', - 'show_question_featured_image_in_result', - 'progress_bar', - 'require_log_in', - 'disable_first_page', - 'comment_section' - ].map( ( item ) => ( - setQuizAttributes( ( ( ! qsmIsEmpty( quizAttr[item] ) && '1' == quizAttr[item] ) ? 0 : 1 ), item ) } - /> - ) ) - - } - ) + )) } +
- quiz_settings->load_setting_fields( 'quiz_options' ); - global $globalQuizsetting; - $quiz_setting_option = array( - 'form_type' => array( - 'option_name' => __( 'Form Type', 'quiz-master-next' ), - 'value' => $globalQuizsetting['form_type'], - 'default' => 0, - 'type' => 'select', - 'options' => array( - array( - 'label' => __( 'Quiz', 'quiz-master-next' ), - 'value' => 0, - ), - array( - 'label' => __( 'Survey', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'Simple Form', 'quiz-master-next' ), - 'value' => 2, - ), - ), - ), - 'system' => array( - 'option_name' => __( 'Grading System', 'quiz-master-next' ), - 'value' => $globalQuizsetting['system'], - 'default' => 0, - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Correct/Incorrect', 'quiz-master-next' ), - 'value' => 0, - ), - array( - 'label' => __( 'Points', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'Both', 'quiz-master-next' ), - 'value' => 3, - ), - ), - 'help' => __( 'Select the system for grading the quiz.', 'quiz-master-next' ), - ), - 'enable_contact_form' => array( - 'option_name' => __( 'Enable Contact Form', 'quiz-master-next' ), - 'value' => 0, - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'help' => __( 'Display a contact form before quiz', 'quiz-master-next' ), - ), - 'timer_limit' => array( - 'option_name' => __( 'Time Limit (in Minute)', 'quiz-master-next' ), - 'value' => $globalQuizsetting['timer_limit'], - 'type' => 'number', - 'default' => 0, - 'help' => __( 'Leave 0 for no time limit', 'quiz-master-next' ), - ), - 'pagination' => array( - 'option_name' => __( 'Questions Per Page', 'quiz-master-next' ), - 'value' => $globalQuizsetting['pagination'], - 'type' => 'number', - 'default' => 0, - 'help' => __( 'Override the default pagination created on questions tab', 'quiz-master-next' ), - ), - 'enable_pagination_quiz' => array( - 'option_name' => __( 'Show current page number', 'quiz-master-next' ), - 'value' => $globalQuizsetting['enable_pagination_quiz'], - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - ), - 'show_question_featured_image_in_result' => array( - 'option_name' => __( 'Show question featured image in results page', 'quiz-master-next' ), - 'value' => $globalQuizsetting['show_question_featured_image_in_result'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - ), - 'progress_bar' => array( - 'option_name' => __( 'Show progress bar', 'quiz-master-next' ), - 'value' => $globalQuizsetting['enable_pagination_quiz'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - ), - 'require_log_in' => array( - 'option_name' => __( 'Require User Login', 'quiz-master-next' ), - 'value' => $globalQuizsetting['require_log_in'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - 'help' => __( 'Enabling this allows only logged in users to take the quiz', 'quiz-master-next' ), - ), - 'disable_first_page' => array( - 'option_name' => __( 'Disable first page on quiz', 'quiz-master-next' ), - 'value' => $globalQuizsetting['disable_first_page'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - ), - 'comment_section' => array( - 'option_name' => __( 'Enable Comment box', 'quiz-master-next' ), - 'value' => $globalQuizsetting['comment_section'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 0, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 1, - ), - ), - 'default' => 1, - 'help' => __( 'Allow users to enter their comments after the quiz', 'quiz-master-next' ), - ), - ); - $quiz_setting_option = apply_filters( 'qsm_quiz_wizard_settings_option', $quiz_setting_option ); - if ( $quiz_setting_option ) { - foreach ( $quiz_setting_option as $key => $single_setting ) { - $index = array_search( $key, array_column( $all_settings, 'id' ), true ); - if ( is_int( $index ) && isset( $all_settings[ $index ] ) ) { - $field = $all_settings[ $index ]; - $field['label'] = $single_setting['option_name']; - $field['default'] = $single_setting['value']; - } else { - $field = array( - 'id' => $key, - 'label' => $single_setting['option_name'], - 'type' => isset( $single_setting['type'] ) ? $single_setting['type'] : 'radio', - 'options' => isset( $single_setting['options'] ) ? $single_setting['options'] : array(), - 'default' => $single_setting['value'], - 'help' => isset( $single_setting['help'] ) ? $single_setting['help'] : "", - ); - } - echo '
'; - QSM_Fields::generate_field( $field, $single_setting['value'] ); - echo '
'; - } - } else { - esc_html_e( 'No settings found!', 'quiz-master-next' ); - } - ?> +
From d84839d64b41c40ae6dc96eb2abc933575437759 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Wed, 13 Mar 2024 12:38:11 +0530 Subject: [PATCH 21/27] Fixed unreachable code break statement --- blocks/build/index.asset.php | 2 +- blocks/build/index.js | 2 +- blocks/src/component/InputComponent.js | 153 ++++++++++++------------- 3 files changed, 76 insertions(+), 81 deletions(-) diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index c987538a3..99f3db49f 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => 'aff066110a75fa50ea10'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '4f7cc18726c10d0fef0a'); diff --git a/blocks/build/index.js b/blocks/build/index.js index 3e700288f..068d116c2 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={820:function(e,t,n){var a=window.wp.blocks,s=window.wp.element,i=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),l=window.wp.htmlEntities,u=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,q=window.wp.components;const d=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},_=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},f=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let a=0;a`${e}${f(8)}${t?`.${f(7)}`:""}`,b=(e,t="")=>d(e)?t:e,v=()=>{};function w({className:e="",quizAttr:t,setAttributes:n,data:a,onChangeFunc:i=v}){const r=(()=>{if(a.defaultvalue=a.default,!d(a?.options))switch(a.type){case"checkbox":1===a.options.length&&(a.type="toggle"),a.label=a.options[0].label;break;case"radio":1{var e,n,a,r;switch(u){case"toggle":return(0,s.createElement)(q.ToggleControl,{label:l,help:c,checked:!d(t[o])&&"1"==t[o],onChange:()=>i(d(t[o])||"1"!=t[o]?1:0,o)});case"select":return(0,s.createElement)(q.SelectControl,{label:l,value:null!==(e=t[o])&&void 0!==e?e:p,options:m,onChange:e=>i(e,o),help:c,__nextHasNoMarginBottom:!0});case"number":return(0,s.createElement)(q.TextControl,{type:"number",label:l,value:null!==(n=t[o])&&void 0!==n?n:p,onChange:e=>i(e,o),help:c,__nextHasNoMarginBottom:!0});case"text":return(0,s.createElement)(q.TextControl,{type:"text",label:l,value:null!==(a=t[o])&&void 0!==a?a:p,onChange:e=>i(e,o),help:c,__nextHasNoMarginBottom:!0});case"checkbox":return(0,s.createElement)(q.CheckboxControl,{label:l,help:c,checked:!d(t[o])&&"1"==t[o],onChange:()=>i(d(t[o])||"1"!=t[o]?1:0,o)});default:return(0,s.createElement)(q.TextControl,{type:"text",label:l,value:null!==(r=t[o])&&void 0!==r?r:p,onChange:e=>i(e,o),help:c,__nextHasNoMarginBottom:!0})}})()}const y=()=>(0,s.createElement)(q.Icon,{icon:()=>(0,s.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,s.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,a.registerBlockType)("qsm/quiz",{icon:y,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:a,isSelected:r,clientId:_}=e,{createNotice:f}=(0,m.useDispatch)(c.store),v=qsmBlockData.globalQuizsetting,{quizID:E,postID:k,quizAttr:x=v}=n,[D,I]=(0,s.useState)(qsmBlockData.QSMQuizList),[B,C]=(0,s.useState)({error:!1,msg:""}),[S,N]=(0,s.useState)(!1),[O,A]=(0,s.useState)(!1),[P,T]=(0,s.useState)(!1),[M,Q]=(0,s.useState)([]),H=qsmBlockData.quizOptions,j=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:F}=(0,m.useSelect)(u.store);(0,s.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{L()}),100),!d(E)&&0{if(E==t.value)return e=!0,!0})),e?K(E):(a({quizID:void 0}),C({error:!0,msg:(0,i.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const L=()=>{let e=document.getElementById("modal-advanced-question-type");d(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");d(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},K=e=>{!d(e)&&0{if("success"==t.status){C({error:!1,msg:""});let n=t.result;if(a({quizID:parseInt(e),postID:n.post_id,quizAttr:{...x,...n}}),!d(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];d(t.question_arr)||t.question_arr.forEach((e=>{if(!d(e)){let t=[];!d(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:b(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},V=(e,t)=>{let n=x;n[t]=e,a({quizAttr:{...n}})};(0,s.useEffect)((()=>{if(j){let e=(()=>{let e=F(_);if(d(e))return!1;e=e.innerBlocks;let t={quiz_id:x.quiz_id,post_id:x.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,s=[];!d(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,i=b(a?.answerEditor,"text"),r=[];!d(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=b(t?.content);d(a?.answerEditor)||"rich"!==a.answerEditor||(n=g((0,l.decodeEntities)(n)));let s=[n,b(t?.points),b(t?.isCorrect)];"image"!==i||d(t?.caption)||s.push(t?.caption),r.push(s)})),s.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:x.quiz_id,postID:x.post_id,answerEditor:i,type:b(a?.type,"0"),name:g(b(a?.description)),question_title:b(a?.title),answerInfo:g(b(a?.correctAnswerInfo)),comments:b(a?.commentBox,"1"),hint:b(a?.hint),category:b(a?.category),multicategories:b(a?.multicategories,[]),required:b(a?.required,0),answers:r,featureImageID:b(a?.featureImageID),featureImageSrc:b(a?.featureImageSrc),page:n,other_settings:{...b(a?.settings,{}),required:b(a?.required,0)}})})),t.pages.push(s),t.qpages.push({id:a,quizID:x.quiz_id,pagekey:d(e.attributes.pageKey)?z():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:x.quiz_name,quiz_id:x.quiz_id,post_id:x.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==x[e]&&null!==x[e]&&(t.quiz[e]=x[e])})),t})();A(!0),e=h({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[j]);const $=(0,u.useBlockProps)(),R=(0,u.useInnerBlocksProps)($,{template:M,allowedBlocks:["qsm/quiz-page"]});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.InspectorControls,null,(0,s.createElement)(q.PanelBody,{title:(0,i.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,s.createElement)("label",{className:"qsm-inspector-label"},(0,i.__)("Status","quiz-master-next")+":",(0,s.createElement)("span",{className:"qsm-inspector-label-value"},x.post_status)),(0,s.createElement)(q.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>V(e,"quiz_name"),className:"qsm-no-mb"}),(!d(E)||"0"!=E)&&(0,s.createElement)("p",null,(0,s.createElement)(q.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+E},(0,i.__)("Advance Quiz Settings","quiz-master-next"))))),d(E)||"0"==E?(0,s.createElement)(q.Placeholder,{className:"qsm-placeholder-wrapper",icon:y,label:(0,i.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,i.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,s.createElement)(s.Fragment,null,!d(D)&&0K(e),disabled:S,__nextHasNoMarginBottom:!0}),(0,s.createElement)("span",null,(0,i.__)("OR","quiz-master-next")),(0,s.createElement)(q.Button,{variant:"link",onClick:()=>N(!S)},(0,i.__)("Add New","quiz-master-next"))),(d(D)||S)&&(0,s.createElement)(q.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,s.createElement)(q.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>V(e,"quiz_name")}),(0,s.createElement)(q.Button,{variant:"link",onClick:()=>T(!P)},(0,i.__)("Advance options","quiz-master-next")),(0,s.createElement)("div",{className:"qsm-advance-settings"},P&&H.map((e=>(0,s.createElement)(w,{key:"qsm-settings"+e.id,data:e,quizAttr:x,setAttributes:a,onChangeFunc:V})))),(0,s.createElement)(q.Button,{variant:"primary",disabled:O||d(x.quiz_name),onClick:()=>(()=>{if(d(x.quiz_name))return void console.log("empty quiz_name");A(!0);let e=h({quiz_name:x.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===x[t]||null===x[t]?"":e.append(t,x[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(A(!1),"success"==e.status){let t=h({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:0,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=h({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",z()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&K(e.quizID)}))}})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))}f(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),f("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,i.__)("Create Quiz","quiz-master-next"))),B.error&&(0,s.createElement)("p",{className:"qsm-error-text"},B.msg))):(0,s.createElement)("div",{...R}))},save:e=>null})}},n={};function a(e){var s=n[e];if(void 0!==s)return s.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.m=t,e=[],a.O=function(t,n,s,i){if(!n){var r=1/0;for(c=0;c=i)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(o=!1,i0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[n,s,i]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,i,r=n[0],o=n[1],l=n[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(s in o)a.o(o,s)&&(a.m[s]=o[s]);if(l)var c=l(a)}for(t&&t(n);unull==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},_=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},z=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let a=0;a`${e}${z(8)}${t?`.${z(7)}`:""}`,b=(e,t="")=>q(e)?t:e,v=()=>{};function w({className:e="",quizAttr:t,setAttributes:n,data:a,onChangeFunc:s=v}){var r,o,l,u,c;const m=(()=>{if(a.defaultvalue=a.default,!q(a?.options))switch(a.type){case"checkbox":1===a.options.length&&(a.type="toggle"),a.label=a.options[0].label;break;case"radio":1==a.options.length?(a.label=a.options[0].label,a.type="toggle"):a.type="select"}return a.label=q(a.label)?"":_(a.label),a.help=q(a.help)?"":_(a.help),a})(),{id:p,label:g="",type:h,help:z="",options:f=[],defaultvalue:b}=m;return(0,i.createElement)(i.Fragment,null,"toggle"===h&&(0,i.createElement)(d.ToggleControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>s(q(t[p])||"1"!=t[p]?1:0,p)}),"select"===h&&(0,i.createElement)(d.SelectControl,{label:g,value:null!==(r=t[p])&&void 0!==r?r:b,options:f,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"number"===h&&(0,i.createElement)(d.TextControl,{type:"number",label:g,value:null!==(o=t[p])&&void 0!==o?o:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"text"===h&&(0,i.createElement)(d.TextControl,{type:"text",label:g,value:null!==(l=t[p])&&void 0!==l?l:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"textarea"===h&&(0,i.createElement)(d.TextareaControl,{label:g,value:null!==(u=t[p])&&void 0!==u?u:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"checkbox"===h&&(0,i.createElement)(d.CheckboxControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>s(q(t[p])||"1"!=t[p]?1:0,p)}),"radio"===h&&(0,i.createElement)(d.RadioControl,{label:g,help:z,selected:null!==(c=t[p])&&void 0!==c?c:b,options:f,onChange:e=>s(e,p)}))}const y=()=>(0,i.createElement)(d.Icon,{icon:()=>(0,i.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,i.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,a.registerBlockType)("qsm/quiz",{icon:y,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:a,isSelected:r,clientId:_}=e,{createNotice:z}=(0,m.useDispatch)(c.store),v=qsmBlockData.globalQuizsetting,{quizID:E,postID:k,quizAttr:x=v}=n,[D,I]=(0,i.useState)(qsmBlockData.QSMQuizList),[C,B]=(0,i.useState)({error:!1,msg:""}),[S,N]=(0,i.useState)(!1),[O,A]=(0,i.useState)(!1),[P,T]=(0,i.useState)(!1),[M,Q]=(0,i.useState)([]),H=qsmBlockData.quizOptions,F=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(u.store);(0,i.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{L()}),100),!q(E)&&0{if(E==t.value)return e=!0,!0})),e?K(E):(a({quizID:void 0}),B({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const L=()=>{let e=document.getElementById("modal-advanced-question-type");q(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");q(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},K=e=>{!q(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(a({quizID:parseInt(e),postID:n.post_id,quizAttr:{...x,...n}}),!q(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:b(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},R=(e,t)=>{let n=x;n[t]=e,a({quizAttr:{...n}})};(0,i.useEffect)((()=>{if(F){let e=(()=>{let e=j(_);if(q(e))return!1;e=e.innerBlocks;let t={quiz_id:x.quiz_id,post_id:x.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,i=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,s=b(a?.answerEditor,"text"),r=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=b(t?.content);q(a?.answerEditor)||"rich"!==a.answerEditor||(n=g((0,l.decodeEntities)(n)));let i=[n,b(t?.points),b(t?.isCorrect)];"image"!==s||q(t?.caption)||i.push(t?.caption),r.push(i)})),i.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:x.quiz_id,postID:x.post_id,answerEditor:s,type:b(a?.type,"0"),name:g(b(a?.description)),question_title:b(a?.title),answerInfo:g(b(a?.correctAnswerInfo)),comments:b(a?.commentBox,"1"),hint:b(a?.hint),category:b(a?.category),multicategories:b(a?.multicategories,[]),required:b(a?.required,0),answers:r,featureImageID:b(a?.featureImageID),featureImageSrc:b(a?.featureImageSrc),page:n,other_settings:{...b(a?.settings,{}),required:b(a?.required,0)}})})),t.pages.push(i),t.qpages.push({id:a,quizID:x.quiz_id,pagekey:q(e.attributes.pageKey)?f():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:i}),n++}})),t.quiz={quiz_name:x.quiz_name,quiz_id:x.quiz_id,post_id:x.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==x[e]&&null!==x[e]&&(t.quiz[e]=x[e])})),t})();A(!0),e=h({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[F]);const V=(0,u.useBlockProps)(),$=(0,u.useInnerBlocksProps)(V,{template:M,allowedBlocks:["qsm/quiz-page"]});return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(u.InspectorControls,null,(0,i.createElement)(d.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,i.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,i.createElement)("span",{className:"qsm-inspector-label-value"},x.post_status)),(0,i.createElement)(d.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name"),className:"qsm-no-mb"}),(!q(E)||"0"!=E)&&(0,i.createElement)("p",null,(0,i.createElement)(d.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+E},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),q(E)||"0"==E?(0,i.createElement)(d.Placeholder,{className:"qsm-placeholder-wrapper",icon:y,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,i.createElement)(i.Fragment,null,!q(D)&&0K(e),disabled:S,__nextHasNoMarginBottom:!0}),(0,i.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,i.createElement)(d.Button,{variant:"link",onClick:()=>N(!S)},(0,s.__)("Add New","quiz-master-next"))),(q(D)||S)&&(0,i.createElement)(d.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,i.createElement)(d.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name")}),(0,i.createElement)(d.Button,{variant:"link",onClick:()=>T(!P)},(0,s.__)("Advance options","quiz-master-next")),(0,i.createElement)("div",{className:"qsm-advance-settings"},P&&H.map((e=>(0,i.createElement)(w,{key:"qsm-settings"+e.id,data:e,quizAttr:x,setAttributes:a,onChangeFunc:R})))),(0,i.createElement)(d.Button,{variant:"primary",disabled:O||q(x.quiz_name),onClick:()=>(()=>{if(q(x.quiz_name))return void console.log("empty quiz_name");A(!0);let e=h({quiz_name:x.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===x[t]||null===x[t]?"":e.append(t,x[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(A(!1),"success"==e.status){let t=h({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:0,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=h({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",f()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&K(e.quizID)}))}})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),C.error&&(0,i.createElement)("p",{className:"qsm-error-text"},C.msg))):(0,i.createElement)("div",{...$}))},save:e=>null})}},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,a),s.exports}a.m=t,e=[],a.O=function(t,n,i,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,i,s]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var i,s,r=n[0],o=n[1],l=n[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(l)var c=l(a)}for(t&&t(n);u { - const key = 'quiz-create-toggle-'+id; - switch ( type ) { - case 'toggle': - return ( - onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) } - /> - ); - break; - case 'select': - return ( - onChangeFunc( val, id) } - help={ help } - __nextHasNoMarginBottom - /> - ); - break; - case 'number': - return ( - onChangeFunc( val, id) } - help={ help } - __nextHasNoMarginBottom - /> - ); - break; - case 'text': - return ( - onChangeFunc( val, id) } - help={ help } - __nextHasNoMarginBottom - /> - ); - break; - case 'checkbox': - return ( - onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) } - /> - ); - break; - default: - return ( - onChangeFunc( val, id) } - help={ help } - __nextHasNoMarginBottom - /> - ); - break; - } - } - - return getComponent(); + return( + <> + { 'toggle' === type && ( + onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) } + /> + )} + { 'select' === type && ( + onChangeFunc( val, id) } + help={ help } + __nextHasNoMarginBottom + /> + )} + { 'number' === type && ( + onChangeFunc( val, id) } + help={ help } + __nextHasNoMarginBottom + /> + )} + { 'text' === type && ( + onChangeFunc( val, id) } + help={ help } + __nextHasNoMarginBottom + /> + )} + { 'textarea' === type && ( + onChangeFunc( val, id) } + help={ help } + __nextHasNoMarginBottom + /> + )} + { 'checkbox' === type && ( + onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) } + /> + )} + { 'radio' === type && ( + onChangeFunc( val, id) } + /> + )} + + ); } \ No newline at end of file From 2c13599f797b8e924094dd783535dadf60a0d609 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Wed, 20 Mar 2024 10:21:58 +0530 Subject: [PATCH 22/27] added Question title and answer as a block name in the sidebar --- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 938 +++++++++++++- blocks/build/answer-option/index.js.map | 1 + blocks/build/index.asset.php | 2 +- blocks/build/index.css | 117 +- blocks/build/index.css.map | 1 + blocks/build/index.js | 1322 ++++++++++++++++++- blocks/build/index.js.map | 1 + blocks/build/page/index.asset.php | 2 +- blocks/build/page/index.js | 361 +++++- blocks/build/page/index.js.map | 1 + blocks/build/question/block.json | 7 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 1348 +++++++++++++++++++- blocks/build/question/index.js.map | 1 + blocks/build/style-index.css | 10 + blocks/build/style-index.css.map | 1 + blocks/src/answer-option/index.js | 12 + blocks/src/component/icon.js | 11 + blocks/src/edit.js | 4 +- blocks/src/editor.scss | 31 + blocks/src/index.js | 24 + blocks/src/question/block.json | 7 +- blocks/src/question/edit.js | 139 +- blocks/src/question/index.js | 12 + 25 files changed, 4303 insertions(+), 54 deletions(-) create mode 100644 blocks/build/answer-option/index.js.map create mode 100644 blocks/build/index.css.map create mode 100644 blocks/build/index.js.map create mode 100644 blocks/build/page/index.js.map create mode 100644 blocks/build/question/index.js.map create mode 100644 blocks/build/style-index.css.map diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index 58956a2f2..1baa202b2 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'f124c91015047dfda196'); + array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'e57f925605ba8567c314'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index e24e02dad..435c85504 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -1 +1,937 @@ -!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,i=window.wp.htmlEntities,o=window.wp.escapeHtml,a=window.wp.blockEditor,l=window.wp.data,r=window.wp.url,c=window.wp.components,s=window.wp.blob,u=window.React,m=window.wp.primitives,d=(0,u.createElement)(m.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,u.createElement)(m.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),p=window.wp.notices;const w=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},E=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText};var h=function({url:e="",caption:i="",alt:o="",setURLCaption:r}){const u=["image"],[m,g]=(0,t.useState)(null),[E,h]=(0,t.useState)(),{imageDefaultSize:f,mediaUpload:x}=((0,t.useRef)(),(0,l.useSelect)((e=>{const{getSettings:t}=e(a.store),n=t();return{imageDefaultSize:n.imageDefaultSize,mediaUpload:n.mediaUpload}}),[])),{createErrorNotice:v}=(0,l.useDispatch)(p.store);function _(e){v(e,{type:"snackbar"}),r(void 0,void 0),h(void 0)}function q(e){if(!e||!e.url)return void r(void 0,void 0);if((0,s.isBlobURL)(e.url))return void h(e.url);h();let t=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));return n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e.url,n})(e,f);g(t.id),r(t.url,t.caption)}function b(t){t!==e&&r(t,i)}let z=((e,t)=>!e&&(0,s.isBlobURL)(t))(m,e);(0,t.useEffect)((()=>{if(!z)return;const t=(0,s.getBlobByURL)(e);t&&x({filesList:[t],onFileChange:([e])=>{q(e)},allowedTypes:u,onError:e=>{z=!1,_(e)}})}),[]),(0,t.useEffect)((()=>{z?h(e):(0,s.revokeBlobURL)(E)}),[z,e]);const R=((e,t)=>t&&!e&&!(0,s.isBlobURL)(t))(m,e)?e:void 0,B=!!e&&(0,t.createElement)("img",{alt:(0,n.__)("Edit image"),title:(0,n.__)("Edit image"),className:"edit-image-preview",src:e});let L=(0,t.createElement)(t.Fragment,null,(0,t.createElement)("img",{src:E||e,alt:"",className:"qsm-answer-option-image",style:{width:"200",height:"auto"}}),E&&(0,t.createElement)(c.Spinner,null));return(0,t.createElement)("figure",null,w(e)?(0,t.createElement)(a.MediaPlaceholder,{icon:(0,t.createElement)(a.BlockIcon,{icon:d}),onSelect:q,onSelectURL:b,onError:_,accept:"image/*",allowedTypes:u,value:{id:m,src:R},mediaPreview:B,disableMediaButtons:E||e}):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.BlockControls,{group:"other"},(0,t.createElement)(a.MediaReplaceFlow,{mediaId:m,mediaURL:e,allowedTypes:u,accept:"image/*",onSelect:q,onSelectURL:b,onError:_})),(0,t.createElement)("div",null,L)))},f=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(f.u2,{icon:()=>(0,t.createElement)(c.Icon,{icon:()=>(0,t.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("rect",{width:"24",height:"24",rx:"4.21657",fill:"#ADADAD"}),(0,t.createElement)("path",{d:"M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z",fill:"white"}))}),merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(s){if("undefined"==typeof qsmBlockData)return null;const{className:u,attributes:m,setAttributes:d,isSelected:p,clientId:f,context:x,mergeBlocks:v,onReplace:_,onRemove:q}=s,b=(x["quiz-master-next/quizID"],x["quiz-master-next/pageID"],x["quiz-master-next/questionID"],x["quiz-master-next/questionType"]),z=x["quiz-master-next/answerType"],R=x["quiz-master-next/questionChanged"],B="qsm/quiz-answer-option",{optionID:L,content:k,caption:S,points:C,isCorrect:y}=m,{selectBlock:U}=(0,l.useDispatch)(a.store),{updateBlockAttributes:T}=(0,l.useDispatch)(a.store),D=(0,l.useSelect)((e=>{let t=e(a.store).getBlockParentsByBlockName(f,"qsm/quiz-question",!0);return w(t)?"":t[0]}),[f]);(0,t.useEffect)((()=>{let e=!0;return e&&p&&!w(D)&&!1===R&&T(D,{isChanged:!0}),()=>{e=!1}}),[k,S,C,y]),(0,t.useEffect)((()=>{let e=!0;return e&&(w(k)||!(0,r.isURL)(k)||-1===k.indexOf("https://")&&-1===k.indexOf("http://")||!["rich","text"].includes(z)||d({content:"",caption:""})),()=>{e=!1}}),[z]);const I=(0,a.useBlockProps)({className:p?" is-highlighted ":""}),A=["4","10"].includes(b)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.InspectorControls,null,(0,t.createElement)(c.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},"image"===z&&(0,t.createElement)(c.TextControl,{type:"text",label:(0,n.__)("Caption","quiz-master-next"),value:S,onChange:e=>d({caption:(0,o.escapeAttribute)(e)})}),(0,t.createElement)(c.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:C,onChange:e=>d({points:e})}),["0","4","1","10","2"].includes(b)&&(0,t.createElement)(c.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!w(y)&&"1"==y,onChange:()=>d({isCorrect:w(y)||"1"!=y?1:0})}))),(0,t.createElement)("div",{...I},(0,t.createElement)(c.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:A,disabled:!0,readOnly:!0,tabIndex:"-1"}),!["rich","image"].includes(z)&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:E((0,i.decodeEntities)(k)),onChange:e=>d({content:E((0,i.decodeEntities)(e))}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=f),o},onMerge:v,onReplace:_,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}),"rich"===z&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:g((0,i.decodeEntities)(k)),onChange:e=>d({content:e}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(B,i);return n&&(o.clientId=f),o},onMerge:v,onReplace:_,onRemove:q,className:"qsm-question-answer-option",identifier:"text",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),"image"===z&&(0,t.createElement)(h,{url:(0,r.isURL)(k)?k:"",caption:S,setURLCaption:(e,t)=>d({content:(0,r.isURL)(e)?e:"",caption:t})}))))}})}(); \ No newline at end of file +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/@wordpress/icons/build-module/library/image.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@wordpress/icons/build-module/library/image.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/primitives */ "@wordpress/primitives"); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + +/** + * WordPress dependencies + */ + +const image = (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.Path, { + d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" +})); +/* harmony default export */ __webpack_exports__["default"] = (image); +//# sourceMappingURL=image.js.map + +/***/ }), + +/***/ "./src/answer-option/edit.js": +/*!***********************************!*\ + !*** ./src/answer-option/edit.js ***! + \***********************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": function() { return /* binding */ Edit; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/escape-html */ "@wordpress/escape-html"); +/* harmony import */ var _wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); +/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var _component_ImageType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../component/ImageType */ "./src/component/ImageType.js"); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); + + + + + + + + + + + + +function Edit(props) { + //check for QSM initialize data + if ('undefined' === typeof qsmBlockData) { + return null; + } + const { + className, + attributes, + setAttributes, + isSelected, + clientId, + context, + mergeBlocks, + onReplace, + onRemove + } = props; + const quizID = context['quiz-master-next/quizID']; + const pageID = context['quiz-master-next/pageID']; + const questionID = context['quiz-master-next/questionID']; + const questionType = context['quiz-master-next/questionType']; + const answerType = context['quiz-master-next/answerType']; + const questionChanged = context['quiz-master-next/questionChanged']; + const name = 'qsm/quiz-answer-option'; + const { + optionID, + content, + caption, + points, + isCorrect + } = attributes; + const { + selectBlock + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); + + //Use to to update block attributes using clientId + const { + updateBlockAttributes + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); + const questionClientID = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + //get parent gutena form clientIds + let questionClientID = select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store).getBlockParentsByBlockName(clientId, 'qsm/quiz-question', true); + return (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionClientID) ? '' : questionClientID[0]; + }, [clientId]); + + //detect change in question + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetChanged = true; + if (shouldSetChanged && isSelected && !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionClientID) && false === questionChanged) { + updateBlockAttributes(questionClientID, { + isChanged: true + }); + } + + //cleanup + return () => { + shouldSetChanged = false; + }; + }, [content, caption, points, isCorrect]); + + /**Initialize block from server */ + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetQSMAttr = true; + if (shouldSetQSMAttr) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(content) && (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_6__.isURL)(content) && (-1 !== content.indexOf('https://') || -1 !== content.indexOf('http://')) && ['rich', 'text'].includes(answerType)) { + setAttributes({ + content: '', + caption: '' + }); + } + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + }, [answerType]); + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)({ + className: isSelected ? ' is-highlighted ' : '' + }); + const inputType = ['4', '10'].includes(questionType) ? "checkbox" : "radio"; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Settings', 'quiz-master-next'), + initialOpen: true + }, /**Image answer option */ + 'image' === answerType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + type: "text", + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Caption', 'quiz-master-next'), + value: caption, + onChange: caption => setAttributes({ + caption: (0,_wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3__.escapeAttribute)(caption) + }) + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + type: "number", + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Points', 'quiz-master-next'), + help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer points', 'quiz-master-next'), + value: points, + onChange: points => setAttributes({ + points + }) + }), ['0', '4', '1', '10', '2'].includes(questionType) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct', 'quiz-master-next'), + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(isCorrect) && '1' == isCorrect, + onChange: () => setAttributes({ + isCorrect: !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(isCorrect) && '1' == isCorrect ? 0 : 1 + }) + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.__experimentalHStack, { + className: "edit-post-document-actions__title", + spacing: 1, + justify: "left" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("input", { + type: inputType, + disabled: true, + readOnly: true, + tabIndex: "-1" + }), /**Text answer option*/ + !['rich', 'image'].includes(answerType) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { + tagName: "p", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer options', 'quiz-master-next'), + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question answer', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Your Answer', 'quiz-master-next'), + value: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmStripTags)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(content)), + onChange: content => setAttributes({ + content: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmStripTags)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(content)) + }), + onSplit: (value, isOriginal) => { + let newAttributes; + if (isOriginal || value) { + newAttributes = { + ...attributes, + content: value + }; + } + const block = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__.createBlock)(name, newAttributes); + if (isOriginal) { + block.clientId = clientId; + } + return block; + }, + onMerge: mergeBlocks, + onReplace: onReplace, + onRemove: onRemove, + allowedFormats: [], + withoutInteractiveFormatting: true, + className: 'qsm-question-answer-option', + identifier: "text" + }), /**Rich Text answer option */ + 'rich' === answerType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { + tagName: "p", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer options', 'quiz-master-next'), + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question answer', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Your Answer', 'quiz-master-next'), + value: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(content)), + onChange: content => setAttributes({ + content + }), + onSplit: (value, isOriginal) => { + let newAttributes; + if (isOriginal || value) { + newAttributes = { + ...attributes, + content: value + }; + } + const block = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__.createBlock)(name, newAttributes); + if (isOriginal) { + block.clientId = clientId; + } + return block; + }, + onMerge: mergeBlocks, + onReplace: onReplace, + onRemove: onRemove, + className: 'qsm-question-answer-option', + identifier: "text", + __unstableEmbedURLOnPaste: true, + __unstableAllowPrefixTransformations: true + }), /**Image answer option */ + 'image' === answerType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_ImageType__WEBPACK_IMPORTED_MODULE_9__["default"], { + url: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_6__.isURL)(content) ? content : '', + caption: caption, + setURLCaption: (url, caption) => setAttributes({ + content: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_6__.isURL)(url) ? url : '', + caption: caption + }) + })))); +} + +/***/ }), + +/***/ "./src/component/ImageType.js": +/*!************************************!*\ + !*** ./src/component/ImageType.js ***! + \************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ImageType: function() { return /* binding */ ImageType; }, +/* harmony export */ isExternalImage: function() { return /* binding */ isExternalImage; }, +/* harmony export */ pickRelevantMediaFiles: function() { return /* binding */ pickRelevantMediaFiles; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blob */ "@wordpress/blob"); +/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/@wordpress/icons/build-module/library/image.js"); +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); +/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); + +/** + * Image Component: Upload, Use media, external image url + */ + + + + + + + + + + +const pickRelevantMediaFiles = (image, size) => { + const imageProps = Object.fromEntries(Object.entries(image !== null && image !== void 0 ? image : {}).filter(([key]) => ['alt', 'id', 'link', 'caption'].includes(key))); + imageProps.url = image?.sizes?.[size]?.url || image?.media_details?.sizes?.[size]?.source_url || image.url; + return imageProps; +}; + +/** + * Is the URL a temporary blob URL? A blob URL is one that is used temporarily + * while the image is being uploaded and will not have an id yet allocated. + * + * @param {number=} id The id of the image. + * @param {string=} url The url of the image. + * + * @return {boolean} Is the URL a Blob URL + */ +const isTemporaryImage = (id, url) => !id && (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.isBlobURL)(url); + +/** + * Is the url for the image hosted externally. An externally hosted image has no + * id and is not a blob url. + * + * @param {number=} id The id of the image. + * @param {string=} url The url of the image. + * + * @return {boolean} Is the url an externally hosted url? + */ +const isExternalImage = (id, url) => url && !id && !(0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.isBlobURL)(url); +function ImageType({ + url = '', + caption = '', + alt = '', + setURLCaption +}) { + const ALLOWED_MEDIA_TYPES = ['image']; + const [id, setId] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const [temporaryURL, setTemporaryURL] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(); + const ref = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const { + imageDefaultSize, + mediaUpload + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useSelect)(select => { + const { + getSettings + } = select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); + const settings = getSettings(); + return { + imageDefaultSize: settings.imageDefaultSize, + mediaUpload: settings.mediaUpload + }; + }, []); + const { + createErrorNotice + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_6__.store); + function onUploadError(message) { + createErrorNotice(message, { + type: 'snackbar' + }); + setURLCaption(undefined, undefined); + setTemporaryURL(undefined); + } + function onSelectImage(media) { + if (!media || !media.url) { + setURLCaption(undefined, undefined); + return; + } + if ((0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.isBlobURL)(media.url)) { + setTemporaryURL(media.url); + return; + } + setTemporaryURL(); + let mediaAttributes = pickRelevantMediaFiles(media, imageDefaultSize); + setId(mediaAttributes.id); + setURLCaption(mediaAttributes.url, mediaAttributes.caption); + } + function onSelectURL(newURL) { + if (newURL !== url) { + setURLCaption(newURL, caption); + } + } + let isTemp = isTemporaryImage(id, url); + + // Upload a temporary image on mount. + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!isTemp) { + return; + } + const file = (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.getBlobByURL)(url); + if (file) { + mediaUpload({ + filesList: [file], + onFileChange: ([img]) => { + onSelectImage(img); + }, + allowedTypes: ALLOWED_MEDIA_TYPES, + onError: message => { + isTemp = false; + onUploadError(message); + } + }); + } + }, []); + + // If an image is temporary, revoke the Blob url when it is uploaded (and is + // no longer temporary). + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (isTemp) { + setTemporaryURL(url); + return; + } + (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.revokeBlobURL)(temporaryURL); + }, [isTemp, url]); + const isExternal = isExternalImage(id, url); + const src = isExternal ? url : undefined; + const mediaPreview = !!url && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + alt: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Edit image'), + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Edit image'), + className: 'edit-image-preview', + src: url + }); + let img = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + src: temporaryURL || url, + alt: "", + className: "qsm-answer-option-image", + style: { + width: '200', + height: 'auto' + } + }), temporaryURL && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Spinner, null)); + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figure", null, (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(url) ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaPlaceholder, { + icon: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.BlockIcon, { + icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__["default"] + }), + onSelect: onSelectImage, + onSelectURL: onSelectURL, + onError: onUploadError, + accept: "image/*", + allowedTypes: ALLOWED_MEDIA_TYPES, + value: { + id, + src + }, + mediaPreview: mediaPreview, + disableMediaButtons: temporaryURL || url + }) : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.BlockControls, { + group: "other" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaReplaceFlow, { + mediaId: id, + mediaURL: url, + allowedTypes: ALLOWED_MEDIA_TYPES, + accept: "image/*", + onSelect: onSelectImage, + onSelectURL: onSelectURL, + onError: onUploadError + })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", null, img))); +} +/* harmony default export */ __webpack_exports__["default"] = (ImageType); + +/***/ }), + +/***/ "./src/component/icon.js": +/*!*******************************!*\ + !*** ./src/component/icon.js ***! + \*******************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ answerOptionBlockIcon: function() { return /* binding */ answerOptionBlockIcon; }, +/* harmony export */ qsmBlockIcon: function() { return /* binding */ qsmBlockIcon; }, +/* harmony export */ questionBlockIcon: function() { return /* binding */ questionBlockIcon; }, +/* harmony export */ warningIcon: function() { return /* binding */ warningIcon; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); + + +//QSM Quiz Block +const qsmBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "24", + height: "24", + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + width: "24", + height: "24", + rx: "3", + fill: "black" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z", + fill: "white" + })) +}); + +//Question Block +const questionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "25", + height: "25", + viewBox: "0 0 25 25", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + x: "0.102539", + y: "0.101562", + width: "24", + height: "24", + rx: "4.68852", + fill: "#ADADAD" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z", + fill: "white" + })) +}); + +//Answer option Block +const answerOptionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "24", + height: "24", + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + width: "24", + height: "24", + rx: "4.21657", + fill: "#ADADAD" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z", + fill: "white" + })) +}); + +//Warning icon +const warningIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "54", + height: "54", + viewBox: "0 0 54 54", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z", + stroke: "#B45309", + strokeWidth: "1.65929", + strokeLinecap: "round", + strokeLinejoin: "round" + })) +}); + +/***/ }), + +/***/ "./src/helper.js": +/*!***********************!*\ + !*** ./src/helper.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, +/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, +/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, +/* harmony export */ qsmGenerateRandomKey: function() { return /* binding */ qsmGenerateRandomKey; }, +/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, +/* harmony export */ qsmMatchingValueKeyArray: function() { return /* binding */ qsmMatchingValueKeyArray; }, +/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, +/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, +/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } +/* harmony export */ }); +//Check if undefined, null, empty +const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; + +//Get Unique array values +const qsmUniqueArray = arr => { + if (qsmIsEmpty(arr) || !Array.isArray(arr)) { + return arr; + } + return arr.filter((val, index, arr) => arr.indexOf(val) === index); +}; + +//Match array of object values and return array of cooresponding matching keys +const qsmMatchingValueKeyArray = (values, obj) => { + if (qsmIsEmpty(obj) || !Array.isArray(values)) { + return values; + } + return values.map(val => Object.keys(obj).find(key => obj[key] == val)); +}; + +//Decode htmlspecialchars +const qsmDecodeHtml = html => { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; +}; +const qsmSanitizeName = name => { + if (qsmIsEmpty(name)) { + name = ''; + } else { + name = name.toLowerCase().replace(/ /g, '_'); + name = name.replace(/\W/g, ''); + } + return name; +}; + +// Remove anchor tags from text content. +const qsmStripTags = text => { + let div = document.createElement("div"); + div.innerHTML = qsmDecodeHtml(text); + return div.innerText; +}; + +//prepare form data +const qsmFormData = (obj = false) => { + let newData = new FormData(); + //add to check if api call from editor + newData.append('qsm_block_api_call', '1'); + if (false !== obj) { + for (let k in obj) { + if (obj.hasOwnProperty(k)) { + newData.append(k, obj[k]); + } + } + } + return newData; +}; + +//add objecyt to form data +const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { + if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { + return data; + } + for (let key in valueObj) { + if (valueObj.hasOwnProperty(key)) { + let value = valueObj[key]; + if ('object' === value) { + qsmAddObjToFormData(formKey + '[' + key + ']', value, data); + } else { + data.append(formKey + '[' + key + ']', valueObj[key]); + } + } + } + return data; +}; + +//Generate random number +const qsmGenerateRandomKey = length => { + const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let key = ""; + + // Generate random bytes + const values = new Uint8Array(length); + window.crypto.getRandomValues(values); + for (let i = 0; i < length; i++) { + // Use the random byte to index into the charset + key += charset[values[i] % charset.length]; + } + return key; +}; + +//generate uiniq id +const qsmUniqid = (prefix = "", random = false) => { + const id = qsmGenerateRandomKey(8); + return `${prefix}${id}${random ? `.${qsmGenerateRandomKey(7)}` : ""}`; +}; + +//return data if not empty otherwise default value +const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; + +/***/ }), + +/***/ "react": +/*!************************!*\ + !*** external "React" ***! + \************************/ +/***/ (function(module) { + +module.exports = window["React"]; + +/***/ }), + +/***/ "@wordpress/blob": +/*!******************************!*\ + !*** external ["wp","blob"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blob"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/escape-html": +/*!************************************!*\ + !*** external ["wp","escapeHtml"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["escapeHtml"]; + +/***/ }), + +/***/ "@wordpress/html-entities": +/*!**************************************!*\ + !*** external ["wp","htmlEntities"] ***! + \**************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["htmlEntities"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "@wordpress/notices": +/*!*********************************!*\ + !*** external ["wp","notices"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["notices"]; + +/***/ }), + +/***/ "@wordpress/primitives": +/*!************************************!*\ + !*** external ["wp","primitives"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["primitives"]; + +/***/ }), + +/***/ "@wordpress/url": +/*!*****************************!*\ + !*** external ["wp","url"] ***! + \*****************************/ +/***/ (function(module) { + +module.exports = window["wp"]["url"]; + +/***/ }), + +/***/ "./src/answer-option/block.json": +/*!**************************************!*\ + !*** ./src/answer-option/block.json ***! + \**************************************/ +/***/ (function(module) { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-answer-option","version":"0.1.0","title":"Answer Option","category":"widgets","parent":["qsm/quiz-question"],"icon":"remove","description":"QSM Quiz answer option","attributes":{"optionID":{"type":"string","default":"0"},"content":{"type":"string","default":""},"caption":{"type":"string","default":""},"points":{"type":"string","default":"0"},"isCorrect":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/quizAttr","quiz-master-next/questionID","quiz-master-next/questionType","quiz-master-next/answerType","quiz-master-next/questionChanged"],"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { +/*!************************************!*\ + !*** ./src/answer-option/index.js ***! + \************************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/answer-option/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/answer-option/block.json"); +/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../component/icon */ "./src/component/icon.js"); + + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { + icon: _component_icon__WEBPACK_IMPORTED_MODULE_3__.answerOptionBlockIcon, + __experimentalLabel(attributes, { + context + }) { + const { + content + } = attributes; + const customName = attributes?.metadata?.name; + const hasContent = content?.length > 0; + + // In the list view, use the answer content as the label. + // If the content is empty, fall back to the default label. + if (context === 'list-view' && (customName || hasContent)) { + return customName || content; + } + }, + merge(attributes, attributesToMerge) { + return { + content: (attributes.content || '') + (attributesToMerge.content || '') + }; + }, + edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] +}); +}(); +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/build/answer-option/index.js.map b/blocks/build/answer-option/index.js.map new file mode 100644 index 000000000..331e84a34 --- /dev/null +++ b/blocks/build/answer-option/index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,CAAE,CAAC,C","sources":["webpack://qsm/./node_modules/@wordpress/icons/build-module/library/image.js","webpack://qsm/./src/answer-option/edit.js","webpack://qsm/./src/component/ImageType.js","webpack://qsm/./src/component/icon.js","webpack://qsm/./src/helper.js","webpack://qsm/external window \"React\"","webpack://qsm/external window [\"wp\",\"blob\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"escapeHtml\"]","webpack://qsm/external window [\"wp\",\"htmlEntities\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/external window [\"wp\",\"primitives\"]","webpack://qsm/external window [\"wp\",\"url\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/answer-option/index.js"],"sourcesContent":["import { createElement } from \"react\";\n/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\nconst image = createElement(SVG, {\n viewBox: \"0 0 24 24\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, createElement(Path, {\n d: \"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z\"\n}));\nexport default image;\n//# sourceMappingURL=image.js.map","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport { decodeEntities } from '@wordpress/html-entities';\r\nimport { escapeAttribute } from \"@wordpress/escape-html\";\r\nimport {\r\n\tInspectorControls,\r\n\tstore as blockEditorStore,\r\n\tRichText,\r\n\tuseBlockProps,\r\n} from '@wordpress/block-editor';\r\nimport { useDispatch, useSelect, select } from '@wordpress/data';\r\nimport { isURL } from '@wordpress/url';\r\nimport {\r\n\tPanelBody,\r\n\tTextControl,\r\n\tToggleControl,\r\n\t__experimentalHStack as HStack,\r\n} from '@wordpress/components';\r\nimport { createBlock } from '@wordpress/blocks';\r\nimport ImageType from '../component/ImageType';\r\nimport { qsmIsEmpty, qsmStripTags, qsmDecodeHtml } from '../helper';\r\nexport default function Edit( props ) {\r\n\t\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace,\r\nonRemove } = props;\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\tconst pageID = context['quiz-master-next/pageID'];\r\n\tconst questionID = context['quiz-master-next/questionID'];\r\n\tconst questionType = context['quiz-master-next/questionType'];\r\n\tconst answerType = context['quiz-master-next/answerType'];\r\n\tconst questionChanged = context['quiz-master-next/questionChanged'];\r\n\r\n\tconst name = 'qsm/quiz-answer-option';\r\n\tconst {\r\n\t\toptionID,\r\n\t\tcontent,\r\n\t\tcaption,\r\n\t\tpoints,\r\n\t\tisCorrect\r\n\t} = attributes;\r\n\r\n\tconst {\r\n\t\tselectBlock,\r\n\t} = useDispatch( blockEditorStore );\r\n\r\n\t//Use to to update block attributes using clientId\r\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\r\n\r\n\tconst questionClientID = useSelect(\r\n\t\t( select ) => {\r\n\t\t\t//get parent gutena form clientIds\r\n\t\t\tlet questionClientID = select( blockEditorStore ).getBlockParentsByBlockName( clientId,'qsm/quiz-question', true );\r\n\t\t\treturn qsmIsEmpty( questionClientID ) ? '': questionClientID[0];\r\n\t\t},\r\n\t\t[ clientId ]\r\n\t);\r\n\r\n\t//detect change in question\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetChanged = true;\r\n\t\tif ( shouldSetChanged && isSelected && ! qsmIsEmpty( questionClientID ) && false === questionChanged ) {\r\n\t\t\tupdateBlockAttributes( questionClientID, { isChanged: true } );\r\n\t\t}\r\n\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetChanged = false;\r\n\t\t};\r\n\t}, [\r\n\t\tcontent,\r\n\t\tcaption,\r\n\t\tpoints,\r\n\t\tisCorrect\r\n\t] )\r\n\r\n\t/**Initialize block from server */\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetQSMAttr = true;\r\n\t\tif ( shouldSetQSMAttr ) {\r\n\t\t\tif ( ! qsmIsEmpty( content ) && isURL( content ) && ( -1 !== content.indexOf('https://') || -1 !== content.indexOf('http://') ) && ['rich','text'].includes( answerType ) ) {\r\n\t\t\t\tsetAttributes({\r\n\t\t\t\t\tcontent:'',\r\n\t\t\t\t\tcaption:''\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetQSMAttr = false;\r\n\t\t};\r\n\t\t\r\n\t}, [ answerType ] );\r\n\r\n\tconst blockProps = useBlockProps( {\r\n\t\tclassName: isSelected ? ' is-highlighted ': '',\r\n\t} );\r\n\r\n\tconst inputType = ['4','10'].includes( questionType ) ? \"checkbox\":\"radio\";\r\n\t\r\n\treturn (\r\n\t<>\r\n\t\r\n\t\t\r\n\t\t\t{ /**Image answer option */\r\n\t\t\t\t'image' === answerType &&\r\n\t\t\t\t setAttributes( { caption: escapeAttribute( caption ) } ) }\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\t setAttributes( { points } ) }\r\n\t\t\t/>\r\n\t\t\t{\r\n\t\t\t\t['0','4','1','10', '2'].includes( questionType ) &&\r\n\t\t\t\t setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) }\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\r\n\t\r\n\t
\r\n\t\t\r\n \t\t\r\n\t\t{ /**Text answer option*/\r\n\t\t\t! ['rich','image'].includes( answerType ) && \r\n\t\t\t setAttributes( { content: qsmStripTags( decodeEntities( content ) ) } ) }\r\n\t\t\t\tonSplit={ ( value, isOriginal ) => {\r\n\t\t\t\t\tlet newAttributes;\r\n\r\n\t\t\t\t\tif ( isOriginal || value ) {\r\n\t\t\t\t\t\tnewAttributes = {\r\n\t\t\t\t\t\t\t...attributes,\r\n\t\t\t\t\t\t\tcontent: value,\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst block = createBlock( name, newAttributes );\r\n\r\n\t\t\t\t\tif ( isOriginal ) {\r\n\t\t\t\t\t\tblock.clientId = clientId;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn block;\r\n\t\t\t\t} }\r\n\t\t\t\tonMerge={ mergeBlocks }\r\n\t\t\t\tonReplace={ onReplace }\r\n\t\t\t\tonRemove={ onRemove }\r\n\t\t\t\tallowedFormats={ [ ] }\r\n\t\t\t\twithoutInteractiveFormatting\r\n\t\t\t\tclassName={ 'qsm-question-answer-option' }\r\n\t\t\t\tidentifier='text'\r\n\t\t\t/>\r\n\t\t}\r\n\t\t{ /**Rich Text answer option */\r\n\t\t 'rich' === answerType && \r\n\t\t\t setAttributes( { content } ) }\r\n\t\t\t\tonSplit={ ( value, isOriginal ) => {\r\n\t\t\t\t\tlet newAttributes;\r\n\r\n\t\t\t\t\tif ( isOriginal || value ) {\r\n\t\t\t\t\t\tnewAttributes = {\r\n\t\t\t\t\t\t\t...attributes,\r\n\t\t\t\t\t\t\tcontent: value,\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst block = createBlock( name, newAttributes );\r\n\r\n\t\t\t\t\tif ( isOriginal ) {\r\n\t\t\t\t\t\tblock.clientId = clientId;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn block;\r\n\t\t\t\t} }\r\n\t\t\t\tonMerge={ mergeBlocks }\r\n\t\t\t\tonReplace={ onReplace }\r\n\t\t\t\tonRemove={ onRemove }\r\n\t\t\t\tclassName={ 'qsm-question-answer-option' }\r\n\t\t\t\tidentifier='text'\r\n\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t/>\r\n\t\t}\r\n\t\t{ /**Image answer option */\r\n\t\t\t'image' === answerType &&\r\n\t\t\t setAttributes({\r\n\t\t\t\tcontent: isURL( url ) ? url: '',\r\n\t\t\t\tcaption: caption\r\n\t\t\t}) }\r\n\t\t\t/>\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t
\r\n\t\r\n\t);\r\n}\r\n","/**\r\n * Image Component: Upload, Use media, external image url\r\n */\r\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\r\nimport {\r\n\tButton,\r\n\tSpinner,\r\n} from '@wordpress/components';\r\nimport { useDispatch, useSelect } from '@wordpress/data';\r\nimport {\r\n\tBlockControls,\r\n\tBlockIcon,\r\n\tMediaReplaceFlow,\r\n\tMediaPlaceholder,\r\n\tstore as blockEditorStore,\r\n} from '@wordpress/block-editor';\r\nimport { useEffect, useRef, useState } from '@wordpress/element';\r\nimport { __ } from '@wordpress/i18n';\r\nimport { image as icon } from '@wordpress/icons';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { isURL } from '@wordpress/url';\r\nimport { qsmIsEmpty } from '../helper';\r\n\r\nexport const pickRelevantMediaFiles = ( image, size ) => {\r\n\tconst imageProps = Object.fromEntries(\r\n\t\tObject.entries( image ?? {} ).filter( ( [ key ] ) =>\r\n\t\t\t[ 'alt', 'id', 'link', 'caption' ].includes( key )\r\n\t\t)\r\n\t);\r\n\r\n\timageProps.url =\r\n\t\timage?.sizes?.[ size ]?.url ||\r\n\t\timage?.media_details?.sizes?.[ size ]?.source_url ||\r\n\t\timage.url;\r\n\treturn imageProps;\r\n};\r\n\r\n/**\r\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\r\n * while the image is being uploaded and will not have an id yet allocated.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the URL a Blob URL\r\n */\r\nconst isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );\r\n\r\n/**\r\n * Is the url for the image hosted externally. An externally hosted image has no\r\n * id and is not a blob url.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the url an externally hosted url?\r\n */\r\nexport const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\r\n\r\n\r\nexport function ImageType( {\r\n\turl = '',\r\n\tcaption = '',\r\n\talt = '',\r\n\tsetURLCaption,\r\n} ) {\r\n\t\r\n\tconst ALLOWED_MEDIA_TYPES = [ 'image' ];\r\n\tconst [ id, setId ] = useState( null );\r\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\r\n\r\n\tconst ref = useRef();\r\n\tconst { imageDefaultSize, mediaUpload } = useSelect( ( select ) => {\r\n\t\tconst { getSettings } = select( blockEditorStore );\r\n\t\tconst settings = getSettings();\r\n\t\treturn {\r\n\t\t\timageDefaultSize: settings.imageDefaultSize,\r\n\t\t\tmediaUpload: settings.mediaUpload,\r\n\t\t};\r\n\t}, [] );\r\n\r\n\tconst { createErrorNotice } = useDispatch( noticesStore );\r\n\tfunction onUploadError( message ) {\r\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\r\n\t\tsetURLCaption( undefined, undefined );\r\n\t\tsetTemporaryURL( undefined );\r\n\t}\r\n\r\n\tfunction onSelectImage( media ) {\r\n\t\tif ( ! media || ! media.url ) {\r\n\t\t\tsetURLCaption( undefined, undefined );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif ( isBlobURL( media.url ) ) {\r\n\t\t\tsetTemporaryURL( media.url );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tsetTemporaryURL();\r\n\r\n\t\tlet mediaAttributes = pickRelevantMediaFiles( media, imageDefaultSize );\r\n\t\tsetId( mediaAttributes.id );\r\n\t\tsetURLCaption( mediaAttributes.url, mediaAttributes.caption );\r\n\t}\r\n\r\n\tfunction onSelectURL( newURL ) {\r\n\t\tif ( newURL !== url ) {\r\n\t\t\tsetURLCaption( newURL, caption );\r\n\t\t}\r\n\t}\r\n\r\n\tlet isTemp = isTemporaryImage( id, url );\r\n\r\n\t// Upload a temporary image on mount.\r\n\tuseEffect( () => {\r\n\t\tif ( ! isTemp ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst file = getBlobByURL( url );\r\n\r\n\t\tif ( file ) {\r\n\t\t\tmediaUpload( {\r\n\t\t\t\tfilesList: [ file ],\r\n\t\t\t\tonFileChange: ( [ img ] ) => {\r\n\t\t\t\t\tonSelectImage( img );\r\n\t\t\t\t},\r\n\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\r\n\t\t\t\tonError: ( message ) => {\r\n\t\t\t\t\tisTemp = false;\r\n\t\t\t\t\tonUploadError( message );\r\n\t\t\t\t},\r\n\t\t\t} );\r\n\t\t}\r\n\t}, [] );\r\n\r\n\t// If an image is temporary, revoke the Blob url when it is uploaded (and is\r\n\t// no longer temporary).\r\n\tuseEffect( () => {\r\n\t\tif ( isTemp ) {\r\n\t\t\tsetTemporaryURL( url );\r\n\t\t\treturn;\r\n\t\t}\r\n\t\trevokeBlobURL( temporaryURL );\r\n\t}, [ isTemp, url ] );\r\n\r\n\tconst isExternal = isExternalImage( id, url );\r\n\tconst src = isExternal ? url : undefined;\r\n\tconst mediaPreview = !! url && (\r\n\t\t\r\n\t);\r\n\r\n\tlet img = (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t{ temporaryURL && }\r\n\t\t\r\n\t);\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t{ qsmIsEmpty( url ) ? (\r\n\t\t\t\t }\r\n\t\t\t\t\tonSelect={ onSelectImage }\r\n\t\t\t\t\tonSelectURL={ onSelectURL }\r\n\t\t\t\t\tonError={ onUploadError }\r\n\t\t\t\t\taccept=\"image/*\"\r\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\r\n\t\t\t\t\tvalue={ { id, src } }\r\n\t\t\t\t\tmediaPreview={ mediaPreview }\r\n\t\t\t\t\tdisableMediaButtons={ temporaryURL || url }\r\n\t\t\t\t/>\r\n\t\t\t) : (\r\n\t\t\t<>\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t
{ img }
\r\n\t\t\t\r\n\t\t\t) }\r\n\t\t
\r\n\t);\r\n}\r\n\r\nexport default ImageType;\r\n","import { Icon } from '@wordpress/components';\r\n//QSM Quiz Block\r\nexport const qsmBlockIcon = () => (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Warning icon\r\nexport const warningIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n//Match array of object values and return array of cooresponding matching keys \r\nexport const qsmMatchingValueKeyArray = ( values, obj ) => {\r\n\tif ( qsmIsEmpty( obj ) || ! Array.isArray( values ) ) {\r\n\t\treturn values;\r\n\t}\r\n\treturn values.map( ( val ) => Object.keys(obj).find( key => obj[key] == val) );\r\n}\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//Generate random number\r\nexport const qsmGenerateRandomKey = (length) => {\r\n const charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n let key = \"\";\r\n\r\n // Generate random bytes\r\n const values = new Uint8Array(length);\r\n window.crypto.getRandomValues(values);\r\n\r\n for (let i = 0; i < length; i++) {\r\n // Use the random byte to index into the charset\r\n key += charset[values[i] % charset.length];\r\n }\r\n\r\n return key;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const id = qsmGenerateRandomKey(8);\r\n return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(7) }`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blob\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"escapeHtml\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","module.exports = window[\"wp\"][\"primitives\"];","module.exports = window[\"wp\"][\"url\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { answerOptionBlockIcon } from \"../component/icon\";\r\n\r\nregisterBlockType( metadata.name, {\r\n\ticon: answerOptionBlockIcon,\r\n\t__experimentalLabel( attributes, { context } ) {\r\n\t\tconst { content } = attributes;\r\n\r\n\t\tconst customName = attributes?.metadata?.name;\r\n\t\tconst hasContent = content?.length > 0;\r\n\r\n\t\t// In the list view, use the answer content as the label.\r\n\t\t// If the content is empty, fall back to the default label.\r\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\r\n\t\t\treturn customName || content;\r\n\t\t}\r\n\t},\r\n\tmerge( attributes, attributesToMerge ) {\r\n\t\treturn {\r\n\t\t\tcontent:\r\n\t\t\t\t( attributes.content || '' ) +\r\n\t\t\t\t( attributesToMerge.content || '' ),\r\n\t\t};\r\n\t},\r\n\tedit: Edit,\r\n} );\r\n"],"names":["__","useState","useEffect","decodeEntities","escapeAttribute","InspectorControls","store","blockEditorStore","RichText","useBlockProps","useDispatch","useSelect","select","isURL","PanelBody","TextControl","ToggleControl","__experimentalHStack","HStack","createBlock","ImageType","qsmIsEmpty","qsmStripTags","qsmDecodeHtml","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","mergeBlocks","onReplace","onRemove","quizID","pageID","questionID","questionType","answerType","questionChanged","name","optionID","content","caption","points","isCorrect","selectBlock","updateBlockAttributes","questionClientID","getBlockParentsByBlockName","shouldSetChanged","isChanged","shouldSetQSMAttr","indexOf","includes","blockProps","inputType","createElement","Fragment","title","initialOpen","type","label","value","onChange","help","checked","spacing","justify","disabled","readOnly","tabIndex","tagName","placeholder","onSplit","isOriginal","newAttributes","block","onMerge","allowedFormats","withoutInteractiveFormatting","identifier","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","url","setURLCaption","getBlobByURL","isBlobURL","revokeBlobURL","Button","Spinner","BlockControls","BlockIcon","MediaReplaceFlow","MediaPlaceholder","useRef","image","icon","noticesStore","pickRelevantMediaFiles","size","imageProps","Object","fromEntries","entries","filter","key","sizes","media_details","source_url","isTemporaryImage","id","isExternalImage","alt","ALLOWED_MEDIA_TYPES","setId","temporaryURL","setTemporaryURL","ref","imageDefaultSize","mediaUpload","getSettings","settings","createErrorNotice","onUploadError","message","undefined","onSelectImage","media","mediaAttributes","onSelectURL","newURL","isTemp","file","filesList","onFileChange","img","allowedTypes","onError","isExternal","src","mediaPreview","style","width","height","onSelect","accept","disableMediaButtons","group","mediaId","mediaURL","Icon","qsmBlockIcon","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","warningIcon","stroke","strokeWidth","strokeLinecap","strokeLinejoin","data","qsmUniqueArray","arr","Array","isArray","val","index","qsmMatchingValueKeyArray","values","obj","map","keys","find","html","txt","document","innerHTML","qsmSanitizeName","toLowerCase","replace","text","div","innerText","qsmFormData","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmGenerateRandomKey","length","charset","Uint8Array","window","crypto","getRandomValues","i","qsmUniqid","prefix","random","qsmValueOrDefault","defaultValue","registerBlockType","metadata","__experimentalLabel","customName","hasContent","merge","attributesToMerge","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 99f3db49f..fcc253b7e 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '4f7cc18726c10d0fef0a'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '5cf62a5252dcf32b6416'); diff --git a/blocks/build/index.css b/blocks/build/index.css index 2b6bc3aed..5e09f7bc5 100644 --- a/blocks/build/index.css +++ b/blocks/build/index.css @@ -1 +1,116 @@ -.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.editor-styles-wrapper .qsm-advance-settings{display:flex;flex-direction:column;gap:2rem}.qsm-placeholder-quiz-create-form{width:75%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{font-size:1rem}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666} +/*!****************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! + \****************************************************************************************************************************************************************************************************************************************/ +/** + * The following styles get applied inside the editor only. + * + * Replace them with your own styles or remove the file completely. + */ +.block-editor-block-inspector .qsm-inspector-label { + font-size: 11px; + font-weight: 500; + line-height: 1.4; + text-transform: uppercase; + display: inline-block; + margin-bottom: 0.5rem; + padding: 0px; +} +.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value { + padding-left: 0.5rem; +} +.block-editor-block-inspector .qsm-inspector-label-value { + font-weight: 400; + text-transform: capitalize; +} +.block-editor-block-inspector .qsm-no-mb { + margin-bottom: 0; +} + +.qsm-placeholder-select-create-quiz { + display: flex; + gap: 1rem; + align-items: center; + margin-bottom: 1rem; +} +.qsm-placeholder-select-create-quiz .components-base-control { + max-width: 50%; +} + +.qsm-ptb-1 { + padding: 1rem 0; +} + +.qsm-error-text { + color: #FD3E3E; +} + +.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset { + flex-direction: column; +} +.editor-styles-wrapper .qsm-advance-settings { + display: flex; + flex-direction: column; + gap: 2rem; +} + +.qsm-placeholder-quiz-create-form { + width: 75%; +} +.qsm-placeholder-quiz-create-form .components-button { + width: -moz-fit-content; + width: fit-content; +} + +.wp-block-qsm-quiz-question { + /*Question Title*/ + /*Question description*/ + /*Question options*/ + /*Question block in editing mode*/ +} +.wp-block-qsm-quiz-question .qsm-question-title { + color: #1f8cbe; + font-size: 1.38rem; +} +.wp-block-qsm-quiz-question .qsm-question-description, +.wp-block-qsm-quiz-question .qsm-question-correct-answer-info, +.wp-block-qsm-quiz-question .qsm-question-hint { + font-size: 1rem; + color: #666666; +} +.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input:disabled { + border-color: inherit; +} +.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=radio]:disabled, .wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=checkbox]:disabled { + opacity: 1; +} +.wp-block-qsm-quiz-question .qsm-question-answer-option { + color: #666666; + font-size: 0.9rem; + margin-left: 1rem; +} +.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title { + color: #666666; +} +.wp-block-qsm-quiz-question .add-new-question-btn { + margin-top: 2rem; +} + +.qsm-advance-q-modal { + text-align: center; + justify-content: center; + max-width: 580px; +} +.qsm-advance-q-modal .qsm-title { + margin-top: 0; +} +.qsm-advance-q-modal .qsm-modal-btn-wrapper { + display: flex; + gap: 1rem; + justify-content: center; +} +.qsm-advance-q-modal .qsm-modal-btn-wrapper .components-external-link { + color: #ffffff; + text-decoration: none; +} + +/*# sourceMappingURL=index.css.map*/ \ No newline at end of file diff --git a/blocks/build/index.css.map b/blocks/build/index.css.map new file mode 100644 index 000000000..99daf30c7 --- /dev/null +++ b/blocks/build/index.css.map @@ -0,0 +1 @@ +{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAUI;EACI;EACA;EACA;EACA;EACA;EACA;EACA;AAJR;AAKQ;EACI;AAHZ;AAMI;EACI;EACA;AAJR;AAOI;EACI;AALR;;AAQA;EACI;EACA;EACA;EACA;AALJ;AAMI;EACI;AAJR;;AAQA;EACI;AALJ;;AAQA;EACI;AALJ;;AAWQ;EACI;AARZ;AAYI;EACI;EACA;EACA;AAVR;;AAcA;EACI;AAXJ;AAYI;EACI;EAAA;AAVR;;AAcA;EACI;EAMA;EAQA;EAeA;AArCJ;AASI;EACI,cAnEiB;EAoEjB;AAPR;AAWI;;;EAGI;EACA,cA7Ea;AAoErB;AAcQ;EACI;AAZZ;AAcQ;EACI;AAZZ;AAeI;EACI,cA1Fa;EA2Fb;EACA;AAbR;AAkBQ;EACI,cAlGS;AAkFrB;AAoBI;EACI;AAlBR;;AAuBA;EACI;EACA;EACA;AApBJ;AAqBI;EACI;AAnBR;AAqBI;EACI;EACA;EACA;AAnBR;AAoBQ;EACI;EACA;AAlBZ,C","sources":["webpack://qsm/./src/editor.scss"],"sourcesContent":["/**\r\n * The following styles get applied inside the editor only.\r\n *\r\n * Replace them with your own styles or remove the file completely.\r\n */\r\n\r\n $qsm_primary_color: #666666;\r\n $qsm_wp_primary_color : #1f8cbe;\r\n\r\n.block-editor-block-inspector{\r\n .qsm-inspector-label{\r\n font-size: 11px;\r\n font-weight: 500;\r\n line-height: 1.4;\r\n text-transform: uppercase;\r\n display: inline-block;\r\n margin-bottom: 0.5rem;\r\n padding: 0px;\r\n .qsm-inspector-label-value{\r\n padding-left: 0.5rem;\r\n }\r\n }\r\n .qsm-inspector-label-value{\r\n font-weight: 400; \r\n text-transform: capitalize;\r\n }\r\n\r\n .qsm-no-mb{\r\n margin-bottom: 0;\r\n }\r\n}\r\n.qsm-placeholder-select-create-quiz{\r\n display: flex;\r\n gap: 1rem;\r\n align-items: center;\r\n margin-bottom: 1rem;\r\n .components-base-control{\r\n max-width: 50%;\r\n }\r\n}\r\n\r\n.qsm-ptb-1{\r\n padding: 1rem 0;\r\n}\r\n\r\n.qsm-error-text{\r\n color: #FD3E3E;\r\n}\r\n\r\n//Create or select quiz placeholder\r\n.editor-styles-wrapper {\r\n .qsm-placeholder-wrapper{\r\n .components-placeholder__fieldset {\r\n flex-direction: column;\r\n }\r\n }\r\n\r\n .qsm-advance-settings{\r\n display: flex;\r\n flex-direction: column;\r\n gap: 2rem;\r\n }\r\n}\r\n\r\n.qsm-placeholder-quiz-create-form{\r\n width: 75%;\r\n .components-button{\r\n width: fit-content;\r\n }\r\n}\r\n\r\n.wp-block-qsm-quiz-question {\r\n /*Question Title*/\r\n .qsm-question-title {\r\n color: $qsm_wp_primary_color;\r\n font-size: 1.38rem;\r\n }\r\n\r\n /*Question description*/\r\n .qsm-question-description, \r\n .qsm-question-correct-answer-info,\r\n .qsm-question-hint {\r\n font-size: 1rem;\r\n color: $qsm_primary_color;\r\n }\r\n\r\n /*Question options*/\r\n .wp-block-qsm-quiz-answer-option{\r\n input:disabled{\r\n border-color: inherit;\r\n }\r\n input[type=\"radio\"]:disabled, input[type=\"checkbox\"]:disabled{\r\n opacity: 1;\r\n }\r\n }\r\n .qsm-question-answer-option{\r\n color: $qsm_primary_color;\r\n font-size: 0.9rem;\r\n margin-left: 1rem;\r\n }\r\n\r\n /*Question block in editing mode*/\r\n &.in-editing-mode{\r\n .qsm-question-title{\r\n color: $qsm_primary_color;\r\n }\r\n }\r\n\r\n .add-new-question-btn{\r\n margin-top: 2rem;\r\n }\r\n \r\n}\r\n\r\n.qsm-advance-q-modal{\r\n text-align: center;\r\n justify-content: center;\r\n max-width: 580px;\r\n .qsm-title{\r\n margin-top: 0;\r\n }\r\n .qsm-modal-btn-wrapper{\r\n display: flex;\r\n gap: 1rem;\r\n justify-content: center;\r\n .components-external-link{\r\n color: #ffffff;\r\n text-decoration: none;\r\n }\r\n }\r\n}"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/index.js b/blocks/build/index.js index 068d116c2..7aa029705 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1,1321 @@ -!function(){"use strict";var e,t={820:function(e,t,n){var a=window.wp.blocks,i=window.wp.element,s=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),l=window.wp.htmlEntities,u=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,d=window.wp.components;const q=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},_=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},z=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let a=0;a`${e}${z(8)}${t?`.${z(7)}`:""}`,b=(e,t="")=>q(e)?t:e,v=()=>{};function w({className:e="",quizAttr:t,setAttributes:n,data:a,onChangeFunc:s=v}){var r,o,l,u,c;const m=(()=>{if(a.defaultvalue=a.default,!q(a?.options))switch(a.type){case"checkbox":1===a.options.length&&(a.type="toggle"),a.label=a.options[0].label;break;case"radio":1==a.options.length?(a.label=a.options[0].label,a.type="toggle"):a.type="select"}return a.label=q(a.label)?"":_(a.label),a.help=q(a.help)?"":_(a.help),a})(),{id:p,label:g="",type:h,help:z="",options:f=[],defaultvalue:b}=m;return(0,i.createElement)(i.Fragment,null,"toggle"===h&&(0,i.createElement)(d.ToggleControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>s(q(t[p])||"1"!=t[p]?1:0,p)}),"select"===h&&(0,i.createElement)(d.SelectControl,{label:g,value:null!==(r=t[p])&&void 0!==r?r:b,options:f,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"number"===h&&(0,i.createElement)(d.TextControl,{type:"number",label:g,value:null!==(o=t[p])&&void 0!==o?o:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"text"===h&&(0,i.createElement)(d.TextControl,{type:"text",label:g,value:null!==(l=t[p])&&void 0!==l?l:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"textarea"===h&&(0,i.createElement)(d.TextareaControl,{label:g,value:null!==(u=t[p])&&void 0!==u?u:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"checkbox"===h&&(0,i.createElement)(d.CheckboxControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>s(q(t[p])||"1"!=t[p]?1:0,p)}),"radio"===h&&(0,i.createElement)(d.RadioControl,{label:g,help:z,selected:null!==(c=t[p])&&void 0!==c?c:b,options:f,onChange:e=>s(e,p)}))}const y=()=>(0,i.createElement)(d.Icon,{icon:()=>(0,i.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,i.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});(0,a.registerBlockType)("qsm/quiz",{icon:y,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:a,isSelected:r,clientId:_}=e,{createNotice:z}=(0,m.useDispatch)(c.store),v=qsmBlockData.globalQuizsetting,{quizID:E,postID:k,quizAttr:x=v}=n,[D,I]=(0,i.useState)(qsmBlockData.QSMQuizList),[C,B]=(0,i.useState)({error:!1,msg:""}),[S,N]=(0,i.useState)(!1),[O,A]=(0,i.useState)(!1),[P,T]=(0,i.useState)(!1),[M,Q]=(0,i.useState)([]),H=qsmBlockData.quizOptions,F=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(u.store);(0,i.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{L()}),100),!q(E)&&0{if(E==t.value)return e=!0,!0})),e?K(E):(a({quizID:void 0}),B({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const L=()=>{let e=document.getElementById("modal-advanced-question-type");q(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");q(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},K=e=>{!q(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(a({quizID:parseInt(e),postID:n.post_id,quizAttr:{...x,...n}}),!q(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:b(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},R=(e,t)=>{let n=x;n[t]=e,a({quizAttr:{...n}})};(0,i.useEffect)((()=>{if(F){let e=(()=>{let e=j(_);if(q(e))return!1;e=e.innerBlocks;let t={quiz_id:x.quiz_id,post_id:x.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,i=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,s=b(a?.answerEditor,"text"),r=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=b(t?.content);q(a?.answerEditor)||"rich"!==a.answerEditor||(n=g((0,l.decodeEntities)(n)));let i=[n,b(t?.points),b(t?.isCorrect)];"image"!==s||q(t?.caption)||i.push(t?.caption),r.push(i)})),i.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:x.quiz_id,postID:x.post_id,answerEditor:s,type:b(a?.type,"0"),name:g(b(a?.description)),question_title:b(a?.title),answerInfo:g(b(a?.correctAnswerInfo)),comments:b(a?.commentBox,"1"),hint:b(a?.hint),category:b(a?.category),multicategories:b(a?.multicategories,[]),required:b(a?.required,0),answers:r,featureImageID:b(a?.featureImageID),featureImageSrc:b(a?.featureImageSrc),page:n,other_settings:{...b(a?.settings,{}),required:b(a?.required,0)}})})),t.pages.push(i),t.qpages.push({id:a,quizID:x.quiz_id,pagekey:q(e.attributes.pageKey)?f():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:i}),n++}})),t.quiz={quiz_name:x.quiz_name,quiz_id:x.quiz_id,post_id:x.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==x[e]&&null!==x[e]&&(t.quiz[e]=x[e])})),t})();A(!0),e=h({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[F]);const V=(0,u.useBlockProps)(),$=(0,u.useInnerBlocksProps)(V,{template:M,allowedBlocks:["qsm/quiz-page"]});return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(u.InspectorControls,null,(0,i.createElement)(d.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,i.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,i.createElement)("span",{className:"qsm-inspector-label-value"},x.post_status)),(0,i.createElement)(d.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name"),className:"qsm-no-mb"}),(!q(E)||"0"!=E)&&(0,i.createElement)("p",null,(0,i.createElement)(d.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+E},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),q(E)||"0"==E?(0,i.createElement)(d.Placeholder,{className:"qsm-placeholder-wrapper",icon:y,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,i.createElement)(i.Fragment,null,!q(D)&&0K(e),disabled:S,__nextHasNoMarginBottom:!0}),(0,i.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,i.createElement)(d.Button,{variant:"link",onClick:()=>N(!S)},(0,s.__)("Add New","quiz-master-next"))),(q(D)||S)&&(0,i.createElement)(d.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,i.createElement)(d.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name")}),(0,i.createElement)(d.Button,{variant:"link",onClick:()=>T(!P)},(0,s.__)("Advance options","quiz-master-next")),(0,i.createElement)("div",{className:"qsm-advance-settings"},P&&H.map((e=>(0,i.createElement)(w,{key:"qsm-settings"+e.id,data:e,quizAttr:x,setAttributes:a,onChangeFunc:R})))),(0,i.createElement)(d.Button,{variant:"primary",disabled:O||q(x.quiz_name),onClick:()=>(()=>{if(q(x.quiz_name))return void console.log("empty quiz_name");A(!0);let e=h({quiz_name:x.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===x[t]||null===x[t]?"":e.append(t,x[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(A(!1),"success"==e.status){let t=h({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:0,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=h({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",f()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&K(e.quizID)}))}})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),C.error&&(0,i.createElement)("p",{className:"qsm-error-text"},C.msg))):(0,i.createElement)("div",{...$}))},save:e=>null})}},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,a),s.exports}a.m=t,e=[],a.O=function(t,n,i,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,i,s]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var i,s,r=n[0],o=n[1],l=n[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(l)var c=l(a)}for(t&&t(n);u {}; +function InputComponent({ + className = '', + quizAttr, + setAttributes, + data, + onChangeFunc = noop +}) { + var _quizAttr$id, _quizAttr$id2, _quizAttr$id3, _quizAttr$id4, _quizAttr$id5; + const processData = () => { + data.defaultvalue = data.default; + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(data?.options)) { + switch (data.type) { + case 'checkbox': + if (1 === data.options.length) { + data.type = 'toggle'; + } + data.label = data.options[0].label; + break; + case 'radio': + if (1 == data.options.length) { + data.label = data.options[0].label; + data.type = 'toggle'; + } else { + data.type = 'select'; + } + break; + default: + break; + } + } + data.label = (0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(data.label) ? '' : (0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmStripTags)(data.label); + data.help = (0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(data.help) ? '' : (0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmStripTags)(data.help); + return data; + }; + const newData = processData(); + const { + id, + label = '', + type, + help = '', + options = [], + defaultvalue + } = newData; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, 'toggle' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { + label: label, + help: help, + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(quizAttr[id]) && '1' == quizAttr[id], + onChange: () => onChangeFunc(!(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(quizAttr[id]) && '1' == quizAttr[id] ? 0 : 1, id) + }), 'select' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.SelectControl, { + label: label, + value: (_quizAttr$id = quizAttr[id]) !== null && _quizAttr$id !== void 0 ? _quizAttr$id : defaultvalue, + options: options, + onChange: val => onChangeFunc(val, id), + help: help, + __nextHasNoMarginBottom: true + }), 'number' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextControl, { + type: "number", + label: label, + value: (_quizAttr$id2 = quizAttr[id]) !== null && _quizAttr$id2 !== void 0 ? _quizAttr$id2 : defaultvalue, + onChange: val => onChangeFunc(val, id), + help: help, + __nextHasNoMarginBottom: true + }), 'text' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextControl, { + type: "text", + label: label, + value: (_quizAttr$id3 = quizAttr[id]) !== null && _quizAttr$id3 !== void 0 ? _quizAttr$id3 : defaultvalue, + onChange: val => onChangeFunc(val, id), + help: help, + __nextHasNoMarginBottom: true + }), 'textarea' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextareaControl, { + label: label, + value: (_quizAttr$id4 = quizAttr[id]) !== null && _quizAttr$id4 !== void 0 ? _quizAttr$id4 : defaultvalue, + onChange: val => onChangeFunc(val, id), + help: help, + __nextHasNoMarginBottom: true + }), 'checkbox' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.CheckboxControl, { + label: label, + help: help, + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(quizAttr[id]) && '1' == quizAttr[id], + onChange: () => onChangeFunc(!(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(quizAttr[id]) && '1' == quizAttr[id] ? 0 : 1, id) + }), 'radio' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.RadioControl, { + label: label, + help: help, + selected: (_quizAttr$id5 = quizAttr[id]) !== null && _quizAttr$id5 !== void 0 ? _quizAttr$id5 : defaultvalue, + options: options, + onChange: val => onChangeFunc(val, id) + })); +} + +/***/ }), + +/***/ "./src/component/icon.js": +/*!*******************************!*\ + !*** ./src/component/icon.js ***! + \*******************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ answerOptionBlockIcon: function() { return /* binding */ answerOptionBlockIcon; }, +/* harmony export */ qsmBlockIcon: function() { return /* binding */ qsmBlockIcon; }, +/* harmony export */ questionBlockIcon: function() { return /* binding */ questionBlockIcon; }, +/* harmony export */ warningIcon: function() { return /* binding */ warningIcon; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); + + +//QSM Quiz Block +const qsmBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "24", + height: "24", + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + width: "24", + height: "24", + rx: "3", + fill: "black" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z", + fill: "white" + })) +}); + +//Question Block +const questionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "25", + height: "25", + viewBox: "0 0 25 25", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + x: "0.102539", + y: "0.101562", + width: "24", + height: "24", + rx: "4.68852", + fill: "#ADADAD" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z", + fill: "white" + })) +}); + +//Answer option Block +const answerOptionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "24", + height: "24", + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + width: "24", + height: "24", + rx: "4.21657", + fill: "#ADADAD" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z", + fill: "white" + })) +}); + +//Warning icon +const warningIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "54", + height: "54", + viewBox: "0 0 54 54", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z", + stroke: "#B45309", + strokeWidth: "1.65929", + strokeLinecap: "round", + strokeLinejoin: "round" + })) +}); + +/***/ }), + +/***/ "./src/edit.js": +/*!*********************!*\ + !*** ./src/edit.js ***! + \*********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": function() { return /* binding */ Edit; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); +/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./helper */ "./src/helper.js"); +/* harmony import */ var _component_InputComponent__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./component/InputComponent */ "./src/component/InputComponent.js"); +/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./component/icon */ "./src/component/icon.js"); + + + + + + + + + + + + + + +function Edit(props) { + //check for QSM initialize data + if ('undefined' === typeof qsmBlockData) { + return null; + } + const { + className, + attributes, + setAttributes, + isSelected, + clientId + } = props; + const { + createNotice + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__.store); + //quiz attribute + const globalQuizsetting = qsmBlockData.globalQuizsetting; + const { + quizID, + postID, + quizAttr = globalQuizsetting + } = attributes; + + //quiz list + const [quizList, setQuizList] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.QSMQuizList); + //quiz list + const [quizMessage, setQuizMessage] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)({ + error: false, + msg: '' + }); + //whether creating a new quiz + const [createQuiz, setCreateQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + //whether saving quiz + const [saveQuiz, setSaveQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + //whether to show advance option + const [showAdvanceOption, setShowAdvanceOption] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + //Quiz template on set Quiz ID + const [quizTemplate, setQuizTemplate] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)([]); + //Quiz Options to create attributes label, description and layout + const quizOptions = qsmBlockData.quizOptions; + + //check if page is saving + const isSavingPage = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(select => { + const { + isAutosavingPost, + isSavingPost + } = select(_wordpress_editor__WEBPACK_IMPORTED_MODULE_7__.store); + return isSavingPost() && !isAutosavingPost(); + }, []); + const { + getBlock + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); + + /**Initialize block from server */ + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetQSMAttr = true; + if (shouldSetQSMAttr) { + //add upgrade modal + if ('0' == qsmBlockData.is_pro_activated) { + setTimeout(() => { + addUpgradePopupHtml(); + }, 100); + } + //initialize QSM block + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizID) && 0 < quizID) { + //Check if quiz exists + let hasQuiz = false; + quizList.forEach(quizElement => { + if (quizID == quizElement.value) { + hasQuiz = true; + return true; + } + }); + if (hasQuiz) { + initializeQuizAttributes(quizID); + } else { + setAttributes({ + quizID: undefined + }); + setQuizMessage({ + error: true, + msg: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz not found. Please select an existing quiz or create a new one.', 'quiz-master-next') + }); + } + } + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + }, []); + + /**Add modal advanced-question-type */ + const addUpgradePopupHtml = () => { + let modalEl = document.getElementById('modal-advanced-question-type'); + if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(modalEl)) { + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup', + method: 'POST' + }).then(res => { + let bodyEl = document.getElementById('wpbody-content'); + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(bodyEl) && 'success' == res.status) { + bodyEl.insertAdjacentHTML('afterbegin', res.result); + } + }).catch(error => { + console.log('error', error); + }); + } + }; + + /**Initialize quiz attributes: first time render only */ + const initializeQuizAttributes = quiz_id => { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quiz_id) && 0 < quiz_id) { + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/quiz/structure', + method: 'POST', + data: { + quizID: quiz_id + } + }).then(res => { + if ('success' == res.status) { + setQuizMessage({ + error: false, + msg: '' + }); + let result = res.result; + setAttributes({ + quizID: parseInt(quiz_id), + postID: result.post_id, + quizAttr: { + ...quizAttr, + ...result + } + }); + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(result.qpages)) { + let quizTemp = []; + result.qpages.forEach(page => { + let questions = []; + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(page.question_arr)) { + page.question_arr.forEach(question => { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(question)) { + let answers = []; + //answers options blocks + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(question.answers) && 0 < question.answers.length) { + question.answers.forEach((answer, aIndex) => { + answers.push(['qsm/quiz-answer-option', { + optionID: aIndex, + content: answer[0], + points: answer[1], + isCorrect: answer[2], + caption: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answer[3]) + }]); + }); + } + //question blocks + questions.push(['qsm/quiz-question', { + questionID: question.question_id, + type: question.question_type_new, + answerEditor: question.settings.answerEditor, + title: question.settings.question_title, + description: question.question_name, + required: question.settings.required, + hint: question.hints, + answers: question.answers, + correctAnswerInfo: question.question_answer_info, + category: question.category, + multicategories: question.multicategories, + commentBox: question.comments, + matchAnswer: question.settings.matchAnswer, + featureImageID: question.settings.featureImageID, + featureImageSrc: question.settings.featureImageSrc, + settings: question.settings + }, answers]); + } + }); + } + quizTemp.push(['qsm/quiz-page', { + pageID: page.id, + pageKey: page.pagekey, + hidePrevBtn: page.hide_prevbtn, + quizID: page.quizID + }, questions]); + }); + setQuizTemplate(quizTemp); + } + } else { + console.log("error " + res.msg); + } + }).catch(error => { + console.log('error', error); + }); + } + }; + + /** + * + * @returns Placeholder for quiz in case quiz ID is not set + */ + const quizPlaceholder = () => { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Placeholder, { + className: "qsm-placeholder-wrapper", + icon: _component_icon__WEBPACK_IMPORTED_MODULE_12__.qsmBlockIcon, + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz And Survey Master', 'quiz-master-next'), + instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Easily and quickly add quizzes and surveys inside the block editor.', 'quiz-master-next') + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizList) && 0 < quizList.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "qsm-placeholder-select-create-quiz" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.SelectControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('', 'quiz-master-next'), + value: quizID, + options: quizList, + onChange: quizID => initializeQuizAttributes(quizID), + disabled: createQuiz, + __nextHasNoMarginBottom: true + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('OR', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, { + variant: "link", + onClick: () => setCreateQuiz(!createQuiz) + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New', 'quiz-master-next'))), ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizList) || createQuiz) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.__experimentalVStack, { + spacing: "3", + className: "qsm-placeholder-quiz-create-form" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.TextControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), + help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), + value: quizAttr?.quiz_name || '', + onChange: val => setQuizAttributes(val, 'quiz_name') + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, { + variant: "link", + onClick: () => setShowAdvanceOption(!showAdvanceOption) + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance options', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "qsm-advance-settings" + }, showAdvanceOption && quizOptions.map(qSetting => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_InputComponent__WEBPACK_IMPORTED_MODULE_11__["default"], { + key: 'qsm-settings' + qSetting.id, + data: qSetting, + quizAttr: quizAttr, + setAttributes: setAttributes, + onChangeFunc: setQuizAttributes + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, { + variant: "primary", + disabled: saveQuiz || (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizAttr.quiz_name), + onClick: () => createNewQuiz() + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Create Quiz', 'quiz-master-next'))), quizMessage.error && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { + className: "qsm-error-text" + }, quizMessage.msg))); + }; + + /** + * Set attribute value + * @param { any } value attribute value to set + * @param { string } attr_name attribute name + */ + const setQuizAttributes = (value, attr_name) => { + let newAttr = quizAttr; + newAttr[attr_name] = value; + setAttributes({ + quizAttr: { + ...newAttr + } + }); + }; + + /** + * Prepare quiz data e.g. quiz details, questions, answers etc to save + * @returns quiz data + */ + const getQuizDataToSave = () => { + let blocks = getBlock(clientId); + if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(blocks)) { + return false; + } + blocks = blocks.innerBlocks; + let quizDataToSave = { + quiz_id: quizAttr.quiz_id, + post_id: quizAttr.post_id, + quiz: {}, + pages: [], + qpages: [], + questions: [] + }; + let pageSNo = 0; + //loop through inner blocks + blocks.forEach(block => { + if ('qsm/quiz-page' === block.name) { + let pageID = block.attributes.pageID; + let questions = []; + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(block.innerBlocks) && 0 < block.innerBlocks.length) { + let questionBlocks = block.innerBlocks; + //Question Blocks + questionBlocks.forEach(questionBlock => { + if ('qsm/quiz-question' !== questionBlock.name) { + return true; + } + let questionAttr = questionBlock.attributes; + let answerEditor = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.answerEditor, 'text'); + let answers = []; + //Answer option blocks + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionBlock.innerBlocks) && 0 < questionBlock.innerBlocks.length) { + let answerOptionBlocks = questionBlock.innerBlocks; + answerOptionBlocks.forEach(answerOptionBlock => { + if ('qsm/quiz-answer-option' !== answerOptionBlock.name) { + return true; + } + let answerAttr = answerOptionBlock.attributes; + let answerContent = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerAttr?.content); + //if rich text + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionAttr?.answerEditor) && 'rich' === questionAttr.answerEditor) { + answerContent = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__.decodeEntities)(answerContent)); + } + let ans = [answerContent, (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerAttr?.points), (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerAttr?.isCorrect)]; + //answer options are image type + if ('image' === answerEditor && !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(answerAttr?.caption)) { + ans.push(answerAttr?.caption); + } + answers.push(ans); + }); + } + + //questions Data + questions.push(questionAttr.questionID); + //update question only if changes occured + if (questionAttr.isChanged) { + quizDataToSave.questions.push({ + "id": questionAttr.questionID, + "quizID": quizAttr.quiz_id, + "postID": quizAttr.post_id, + "answerEditor": answerEditor, + "type": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.type, '0'), + "name": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.description)), + "question_title": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.title), + "answerInfo": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.correctAnswerInfo)), + "comments": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.commentBox, '1'), + "hint": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.hint), + "category": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.category), + "multicategories": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.multicategories, []), + "required": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.required, 0), + "answers": answers, + "featureImageID": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.featureImageID), + "featureImageSrc": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.featureImageSrc), + "page": pageSNo, + "other_settings": { + ...(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.settings, {}), + "required": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.required, 0) + } + }); + } + }); + } + + // pages[0][]: 2512 + // qpages[0][id]: 2 + // qpages[0][quizID]: 76 + // qpages[0][pagekey]: Ipj90nNT + // qpages[0][hide_prevbtn]: 0 + // qpages[0][questions][]: 2512 + // post_id: 111 + //page data + quizDataToSave.pages.push(questions); + quizDataToSave.qpages.push({ + 'id': pageID, + 'quizID': quizAttr.quiz_id, + 'pagekey': (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(block.attributes.pageKey) ? (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmUniqid)() : block.attributes.pageKey, + 'hide_prevbtn': block.attributes.hidePrevBtn, + 'questions': questions + }); + pageSNo++; + } + }); + + //Quiz details + quizDataToSave.quiz = { + 'quiz_name': quizAttr.quiz_name, + 'quiz_id': quizAttr.quiz_id, + 'post_id': quizAttr.post_id + }; + if (showAdvanceOption) { + ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => { + if ('undefined' !== typeof quizAttr[item] && null !== quizAttr[item]) { + quizDataToSave.quiz[item] = quizAttr[item]; + } + }); + } + return quizDataToSave; + }; + + //saving Quiz on save page + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (isSavingPage) { + let quizData = getQuizDataToSave(); + //save quiz status + setSaveQuiz(true); + quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ + 'save_entire_quiz': '1', + 'quizData': JSON.stringify(quizData), + 'qsm_block_quiz_nonce': qsmBlockData.nonce, + "nonce": qsmBlockData.saveNonce //save pages nonce + }); + + //AJAX call + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/quiz/save_quiz', + method: 'POST', + body: quizData + }).then(res => { + //create notice + createNotice(res.status, res.msg, { + isDismissible: true, + type: 'snackbar' + }); + }).catch(error => { + console.log('error', error); + createNotice('error', error.message, { + isDismissible: true, + type: 'snackbar' + }); + }); + } + }, [isSavingPage]); + + /** + * Create new quiz and set quiz ID + * + */ + const createNewQuiz = () => { + if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizAttr.quiz_name)) { + console.log("empty quiz_name"); + return; + } + //save quiz status + setSaveQuiz(true); + let quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ + 'quiz_name': quizAttr.quiz_name, + 'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce + }); + ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => 'undefined' === typeof quizAttr[item] || null === quizAttr[item] ? '' : quizData.append(item, quizAttr[item])); + + //AJAX call + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/quiz/create_quiz', + method: 'POST', + body: quizData + }).then(res => { + //save quiz status + setSaveQuiz(false); + if ('success' == res.status) { + //create a question + let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ + "id": null, + "quizID": res.quizID, + "answerEditor": "text", + "type": "0", + "name": "", + "question_title": "", + "answerInfo": "", + "comments": "1", + "hint": "", + "category": "", + "required": 0, + "answers": [], + "page": 0 + }); + //AJAX call + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/questions', + method: 'POST', + body: newQuestion + }).then(response => { + if ('success' == response.status) { + let question_id = response.id; + + /**Page attributes required format */ + // pages[0][]: 2512 + // qpages[0][id]: 2 + // qpages[0][quizID]: 76 + // qpages[0][pagekey]: Ipj90nNT + // qpages[0][hide_prevbtn]: 0 + // qpages[0][questions][]: 2512 + // post_id: 111 + + let newPage = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ + "action": qsmBlockData.save_pages_action, + "quiz_id": res.quizID, + "nonce": qsmBlockData.saveNonce, + "post_id": res.quizPostID + }); + newPage.append('pages[0][]', question_id); + newPage.append('qpages[0][id]', 1); + newPage.append('qpages[0][quizID]', res.quizID); + newPage.append('qpages[0][pagekey]', (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmUniqid)()); + newPage.append('qpages[0][hide_prevbtn]', 0); + newPage.append('qpages[0][questions][]', question_id); + + //create a page + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + url: qsmBlockData.ajax_url, + method: 'POST', + body: newPage + }).then(pageResponse => { + if ('success' == pageResponse.status) { + //set new quiz + initializeQuizAttributes(res.quizID); + } + }); + } + }).catch(error => { + console.log('error', error); + createNotice('error', error.message, { + isDismissible: true, + type: 'snackbar' + }); + }); + } + + //create notice + createNotice(res.status, res.msg, { + isDismissible: true, + type: 'snackbar' + }); + }).catch(error => { + console.log('error', error); + createNotice('error', error.message, { + isDismissible: true, + type: 'snackbar' + }); + }); + }; + + /** + * Inner Blocks + */ + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)(); + const innerBlocksProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useInnerBlocksProps)(blockProps, { + template: quizTemplate, + allowedBlocks: ['qsm/quiz-page'] + }); + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz settings', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", { + className: "qsm-inspector-label" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Status', 'quiz-master-next') + ':', (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { + className: "qsm-inspector-label-value" + }, quizAttr.post_status)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.TextControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), + help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), + value: quizAttr?.quiz_name || '', + onChange: val => setQuizAttributes(val, 'quiz_name'), + className: "qsm-no-mb" + }), (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizID) || '0' != quizID) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ExternalLink, { + href: qsmBlockData.quiz_settings_url + '&quiz_id=' + quizID + '&tab=options' + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance Quiz Settings', 'quiz-master-next'))))), (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizID) || '0' == quizID ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, " ", quizPlaceholder(), " ") : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...innerBlocksProps + })); +} + +/***/ }), + +/***/ "./src/helper.js": +/*!***********************!*\ + !*** ./src/helper.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, +/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, +/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, +/* harmony export */ qsmGenerateRandomKey: function() { return /* binding */ qsmGenerateRandomKey; }, +/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, +/* harmony export */ qsmMatchingValueKeyArray: function() { return /* binding */ qsmMatchingValueKeyArray; }, +/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, +/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, +/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } +/* harmony export */ }); +//Check if undefined, null, empty +const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; + +//Get Unique array values +const qsmUniqueArray = arr => { + if (qsmIsEmpty(arr) || !Array.isArray(arr)) { + return arr; + } + return arr.filter((val, index, arr) => arr.indexOf(val) === index); +}; + +//Match array of object values and return array of cooresponding matching keys +const qsmMatchingValueKeyArray = (values, obj) => { + if (qsmIsEmpty(obj) || !Array.isArray(values)) { + return values; + } + return values.map(val => Object.keys(obj).find(key => obj[key] == val)); +}; + +//Decode htmlspecialchars +const qsmDecodeHtml = html => { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; +}; +const qsmSanitizeName = name => { + if (qsmIsEmpty(name)) { + name = ''; + } else { + name = name.toLowerCase().replace(/ /g, '_'); + name = name.replace(/\W/g, ''); + } + return name; +}; + +// Remove anchor tags from text content. +const qsmStripTags = text => { + let div = document.createElement("div"); + div.innerHTML = qsmDecodeHtml(text); + return div.innerText; +}; + +//prepare form data +const qsmFormData = (obj = false) => { + let newData = new FormData(); + //add to check if api call from editor + newData.append('qsm_block_api_call', '1'); + if (false !== obj) { + for (let k in obj) { + if (obj.hasOwnProperty(k)) { + newData.append(k, obj[k]); + } + } + } + return newData; +}; + +//add objecyt to form data +const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { + if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { + return data; + } + for (let key in valueObj) { + if (valueObj.hasOwnProperty(key)) { + let value = valueObj[key]; + if ('object' === value) { + qsmAddObjToFormData(formKey + '[' + key + ']', value, data); + } else { + data.append(formKey + '[' + key + ']', valueObj[key]); + } + } + } + return data; +}; + +//Generate random number +const qsmGenerateRandomKey = length => { + const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let key = ""; + + // Generate random bytes + const values = new Uint8Array(length); + window.crypto.getRandomValues(values); + for (let i = 0; i < length; i++) { + // Use the random byte to index into the charset + key += charset[values[i] % charset.length]; + } + return key; +}; + +//generate uiniq id +const qsmUniqid = (prefix = "", random = false) => { + const id = qsmGenerateRandomKey(8); + return `${prefix}${id}${random ? `.${qsmGenerateRandomKey(7)}` : ""}`; +}; + +//return data if not empty otherwise default value +const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; + +/***/ }), + +/***/ "./src/index.js": +/*!**********************!*\ + !*** ./src/index.js ***! + \**********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss"); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edit */ "./src/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/block.json"); +/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./component/icon */ "./src/component/icon.js"); +/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); +/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_6__); + + + + + + + +const save = props => null; +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, { + icon: _component_icon__WEBPACK_IMPORTED_MODULE_5__.qsmBlockIcon, + /** + * @see ./edit.js + */ + edit: _edit__WEBPACK_IMPORTED_MODULE_3__["default"], + save: save +}); +const withMyPluginControls = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_6__.createHigherOrderComponent)(BlockEdit => { + return props => { + const { + name, + className, + attributes, + setAttributes, + isSelected, + clientId, + context + } = props; + if ('core/group' !== name) { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(BlockEdit, { + key: "edit", + ...props + }); + } + console.log("props", props); + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(BlockEdit, { + key: "edit", + ...props + })); + }; +}, 'withMyPluginControls'); +wp.hooks.addFilter('editor.BlockEdit', 'my-plugin/with-inspector-controls', withMyPluginControls); + +/***/ }), + +/***/ "./src/editor.scss": +/*!*************************!*\ + !*** ./src/editor.scss ***! + \*************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/style.scss": +/*!************************!*\ + !*** ./src/style.scss ***! + \************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "@wordpress/api-fetch": +/*!**********************************!*\ + !*** external ["wp","apiFetch"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["apiFetch"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/compose": +/*!*********************************!*\ + !*** external ["wp","compose"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["compose"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/editor": +/*!********************************!*\ + !*** external ["wp","editor"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["editor"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/html-entities": +/*!**************************************!*\ + !*** external ["wp","htmlEntities"] ***! + \**************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["htmlEntities"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "@wordpress/notices": +/*!*********************************!*\ + !*** external ["wp","notices"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["notices"]; + +/***/ }), + +/***/ "./src/block.json": +/*!************************!*\ + !*** ./src/block.json ***! + \************************/ +/***/ (function(module) { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz","version":"0.1.0","title":"QSM","category":"widgets","keywords":["Quiz","QSM Quiz","Survey","form","Quiz Block"],"icon":"vault","description":"Easily and quickly add quizzes and surveys inside the block editor.","attributes":{"quizID":{"type":"number","default":0},"postID":{"type":"number"},"quizAttr":{"type":"object"}},"providesContext":{"quiz-master-next/quizID":"quizID","quiz-master-next/quizAttr":"quizAttr"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = __webpack_modules__; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ !function() { +/******/ var deferred = []; +/******/ __webpack_require__.O = function(result, chunkIds, fn, priority) { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var chunkIds = deferred[i][0]; +/******/ var fn = deferred[i][1]; +/******/ var priority = deferred[i][2]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/jsonp chunk loading */ +/******/ !function() { +/******/ // no baseURI +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "index": 0, +/******/ "./style-index": 0 +/******/ }; +/******/ +/******/ // no chunk on demand loading +/******/ +/******/ // no prefetching +/******/ +/******/ // no preloaded +/******/ +/******/ // no HMR +/******/ +/******/ // no HMR manifest +/******/ +/******/ __webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; }; +/******/ +/******/ // install a JSONP callback for chunk loading +/******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) { +/******/ var chunkIds = data[0]; +/******/ var moreModules = data[1]; +/******/ var runtime = data[2]; +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { +/******/ installedChunks[chunkId][0](); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ return __webpack_require__.O(result); +/******/ } +/******/ +/******/ var chunkLoadingGlobal = self["webpackChunkqsm"] = self["webpackChunkqsm"] || []; +/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); +/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); +/******/ }(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module depends on other loaded chunks and execution need to be delayed +/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], function() { return __webpack_require__("./src/index.js"); }) +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/build/index.js.map b/blocks/build/index.js.map new file mode 100644 index 000000000..ee505c9b5 --- /dev/null +++ b/blocks/build/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AAS1B;AACsB;;AAErD;AACA;AACA;AACA;AACA;AACA,MAAMY,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACN,SAASC,cAAcA,CAAE;EACnCC,SAAS,GAAC,EAAE;EACZC,QAAQ;EACRC,aAAa;EACbC,IAAI;EACJC,YAAY,GAAGN;AACpB,CAAC,EAAG;EAAA,IAAAO,YAAA,EAAAC,aAAA,EAAAC,aAAA,EAAAC,aAAA,EAAAC,aAAA;EAEA,MAAMC,WAAW,GAAGA,CAAA,KAAO;IACvBP,IAAI,CAACQ,YAAY,GAAGR,IAAI,CAACS,OAAO;IAChC,IAAK,CAAEhB,mDAAU,CAAEO,IAAI,EAAEU,OAAQ,CAAC,EAAG;MACjC,QAAQV,IAAI,CAACW,IAAI;QACb,KAAK,UAAU;UACX,IAAK,C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;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,8CAA8C;;WAE9C;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,iCAAiC,mCAAmC;WACpE;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA,2FAA2F,+CAA+C;UAC1I","sources":["webpack://qsm/./src/component/InputComponent.js","webpack://qsm/./src/component/icon.js","webpack://qsm/./src/edit.js","webpack://qsm/./src/helper.js","webpack://qsm/./src/index.js","webpack://qsm/./src/editor.scss","webpack://qsm/./src/style.scss","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"compose\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"editor\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"htmlEntities\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/chunk loaded","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/webpack/runtime/jsonp chunk loading","webpack://qsm/webpack/before-startup","webpack://qsm/webpack/startup","webpack://qsm/webpack/after-startup"],"sourcesContent":["import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport {\r\n Button,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tSelectControl,\r\n\tCheckboxControl,\r\n\tRadioControl,\r\n\tTextareaControl,\r\n} from '@wordpress/components';\r\nimport { qsmIsEmpty, qsmStripTags } from '../helper';\r\n\r\n/**\r\n * Create Input component based on data provided\r\n * id: attribute name\r\n * type: input type\r\n */\r\nconst noop = () => {};\r\nexport default function InputComponent( {\r\n className='', \r\n quizAttr, \r\n setAttributes,\r\n data,\r\n onChangeFunc = noop,\r\n} ) {\r\n\r\n const processData = ( ) => {\r\n data.defaultvalue = data.default;\r\n if ( ! qsmIsEmpty( data?.options ) ) {\r\n switch (data.type) {\r\n case 'checkbox':\r\n if ( 1 === data.options.length ) {\r\n data.type = 'toggle';\r\n }\r\n data.label = data.options[0].label;\r\n break;\r\n case 'radio':\r\n if ( 1 == data.options.length ) {\r\n\t\t\t\t\t\tdata.label = data.options[0].label;\r\n\t\t\t\t\t\tdata.type = 'toggle';\r\n } else {\r\n\t\t\t\t\t\tdata.type = 'select';\r\n\t\t\t\t\t}\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n data.label = qsmIsEmpty( data.label ) ? '': qsmStripTags( data.label );\r\n data.help = qsmIsEmpty( data.help ) ? '': qsmStripTags( data.help );\r\n return data;\r\n }\r\n \r\n const newData = processData();\r\n const {\r\n id,\r\n label='',\r\n type,\r\n help='',\r\n options=[],\r\n defaultvalue \r\n } = newData;\r\n\r\n return(\r\n\t\t<>\r\n\t\t{ 'toggle' === type && (\r\n\t\t\t onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) }\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'select' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t\thelp={ help }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'number' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t\thelp={ help }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'text' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t\thelp={ help }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'textarea' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t\thelp={ help }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n \t/>\r\n\t\t)}\r\n\t\t{ 'checkbox' === type && (\t\r\n\t\t\t onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) }\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'radio' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t\r\n\t);\r\n}","import { Icon } from '@wordpress/components';\r\n//QSM Quiz Block\r\nexport const qsmBlockIcon = () => (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Warning icon\r\nexport const warningIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport { decodeEntities } from '@wordpress/html-entities';\r\nimport {\r\n\tInspectorControls,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n\tstore as blockEditorStore,\r\n\tuseInnerBlocksProps,\r\n} from '@wordpress/block-editor';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect } from '@wordpress/data';\r\nimport { store as editorStore } from '@wordpress/editor';\r\nimport {\r\n\tPanelBody,\r\n\tButton,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tSelectControl,\r\n\tPlaceholder,\r\n\tExternalLink,\r\n\t__experimentalVStack as VStack,\r\n} from '@wordpress/components';\r\nimport './editor.scss';\r\nimport { qsmIsEmpty, qsmFormData, qsmUniqid, qsmValueOrDefault, qsmDecodeHtml } from './helper';\r\nimport InputComponent from './component/InputComponent';\r\nimport { qsmBlockIcon } from './component/icon';\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst { className, attributes, setAttributes, isSelected, clientId } = props;\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\t//quiz attribute\r\n\tconst globalQuizsetting = qsmBlockData.globalQuizsetting;\r\n\tconst {\r\n\t\tquizID,\r\n\t\tpostID,\r\n\t\tquizAttr = globalQuizsetting\r\n\t} = attributes;\r\n\r\n\r\n\t//quiz list\r\n\tconst [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList );\r\n\t//quiz list\r\n\tconst [ quizMessage, setQuizMessage ] = useState( {\r\n\t\terror: false,\r\n\t\tmsg: ''\r\n\t} );\r\n\t//whether creating a new quiz\r\n\tconst [ createQuiz, setCreateQuiz ] = useState( false );\r\n\t//whether saving quiz\r\n\tconst [ saveQuiz, setSaveQuiz ] = useState( false );\r\n\t//whether to show advance option\r\n\tconst [ showAdvanceOption, setShowAdvanceOption ] = useState( false );\r\n\t//Quiz template on set Quiz ID\r\n\tconst [ quizTemplate, setQuizTemplate ] = useState( [] );\r\n\t//Quiz Options to create attributes label, description and layout\r\n\tconst quizOptions = qsmBlockData.quizOptions;\r\n\r\n\t//check if page is saving\r\n\tconst isSavingPage = useSelect( ( select ) => {\r\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\r\n\t\treturn isSavingPost() && ! isAutosavingPost();\r\n\t}, [] );\r\n\r\n\tconst { getBlock } = useSelect( blockEditorStore );\r\n\r\n\t/**Initialize block from server */\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetQSMAttr = true;\r\n\t\tif ( shouldSetQSMAttr ) {\r\n\t\t\t//add upgrade modal\r\n\t\t\tif ( '0' == qsmBlockData.is_pro_activated ) {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\taddUpgradePopupHtml();\r\n\t\t\t\t}, 100);\r\n\t\t\t}\r\n\t\t\t//initialize QSM block\r\n\t\t\tif ( ! qsmIsEmpty( quizID ) && 0 < quizID ) {\r\n\t\t\t\t//Check if quiz exists\r\n\t\t\t\tlet hasQuiz = false;\r\n\t\t\t\tquizList.forEach( quizElement => {\r\n\t\t\t\t\tif ( quizID == quizElement.value ) {\r\n\t\t\t\t\t\thasQuiz = true;\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tif ( hasQuiz ) {\r\n\t\t\t\t\tinitializeQuizAttributes( quizID );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsetAttributes({\r\n\t\t\t\t\t\tquizID : undefined\r\n\t\t\t\t\t});\r\n\t\t\t\t\tsetQuizMessage( {\r\n\t\t\t\t\t\terror: true,\r\n\t\t\t\t\t\tmsg: __( 'Quiz not found. Please select an existing quiz or create a new one.', 'quiz-master-next' )\r\n\t\t\t\t\t} );\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetQSMAttr = false;\r\n\t\t};\r\n\t\t\r\n\t}, [ ] );\r\n\r\n\t/**Add modal advanced-question-type */\r\n\tconst addUpgradePopupHtml = () => {\r\n\t\tlet modalEl = document.getElementById('modal-advanced-question-type');\r\n\t\tif ( qsmIsEmpty( modalEl ) ) {\r\n\t\t\tapiFetch( {\r\n\t\t\t\tpath: '/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t} ).then( ( res ) => {\r\n\t\t\t\tlet bodyEl = document.getElementById('wpbody-content');\r\n\t\t\t\tif ( ! qsmIsEmpty( bodyEl ) && 'success' == res.status ) { \r\n\t\t\t\t\tbodyEl.insertAdjacentHTML('afterbegin', res.result );\r\n\t\t\t\t}\r\n\t\t\t} ).catch(\r\n\t\t\t\t( error ) => {\r\n\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**Initialize quiz attributes: first time render only */\r\n\tconst initializeQuizAttributes = ( quiz_id ) => {\r\n\t\tif ( ! qsmIsEmpty( quiz_id ) && 0 < quiz_id ) {\r\n\t\t\tapiFetch( {\r\n\t\t\t\tpath: '/quiz-survey-master/v1/quiz/structure',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t\tdata: { quizID: quiz_id },\r\n\t\t\t} ).then( ( res ) => {\r\n\t\t\t\t\r\n\t\t\t\tif ( 'success' == res.status ) {\r\n\t\t\t\t\tsetQuizMessage( {\r\n\t\t\t\t\t\terror: false,\r\n\t\t\t\t\t\tmsg: ''\r\n\t\t\t\t\t} );\r\n\t\t\t\t\tlet result = res.result;\r\n\t\t\t\t\tsetAttributes( { \r\n\t\t\t\t\t\tquizID: parseInt( quiz_id ),\r\n\t\t\t\t\t\tpostID: result.post_id,\r\n\t\t\t\t\t\tquizAttr: { ...quizAttr, ...result }\r\n\t\t\t\t\t} );\r\n\t\t\t\t\tif ( ! qsmIsEmpty( result.qpages ) ) {\r\n\t\t\t\t\t\tlet quizTemp = [];\r\n\t\t\t\t\t\tresult.qpages.forEach( page => {\r\n\t\t\t\t\t\t\tlet questions = [];\r\n\t\t\t\t\t\t\tif ( ! qsmIsEmpty( page.question_arr ) ) {\r\n\t\t\t\t\t\t\t\tpage.question_arr.forEach( question => {\r\n\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question ) ) {\r\n\t\t\t\t\t\t\t\t\t\tlet answers = [];\r\n\t\t\t\t\t\t\t\t\t\t//answers options blocks\r\n\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) {\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tquestion.answers.forEach( ( answer, aIndex ) => {\r\n\t\t\t\t\t\t\t\t\t\t\t\tanswers.push(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptionID:aIndex,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontent:answer[0],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoints:answer[1],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect:answer[2],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcaption: qsmValueOrDefault( answer[3] )\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t//question blocks\r\n\t\t\t\t\t\t\t\t\t\tquestions.push(\r\n\t\t\t\t\t\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-question',\r\n\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tquestionID: question.question_id,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: question.question_type_new,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswerEditor: question.settings.answerEditor,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: question.settings.question_title,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: question.question_name,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\trequired: question.settings.required,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\thint:question.hints,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers: question.answers,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcorrectAnswerInfo:question.question_answer_info,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcategory:question.category,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tmulticategories:question.multicategories,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcommentBox: question.comments,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tmatchAnswer: question.settings.matchAnswer,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageID: question.settings.featureImageID,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageSrc: question.settings.featureImageSrc,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsettings: question.settings\r\n\t\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t\tanswers\r\n\t\t\t\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tquizTemp.push(\r\n\t\t\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t\t\t'qsm/quiz-page',\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tpageID:page.id,\r\n\t\t\t\t\t\t\t\t\t\tpageKey: page.pagekey,\r\n\t\t\t\t\t\t\t\t\t\thidePrevBtn: page.hide_prevbtn,\r\n\t\t\t\t\t\t\t\t\t\tquizID: page.quizID\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\tquestions\r\n\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tsetQuizTemplate( quizTemp );\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconsole.log( \"error \"+ res.msg );\r\n\t\t\t\t}\r\n\t\t\t} ).catch(\r\n\t\t\t\t( error ) => {\r\n\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * \r\n\t * @returns Placeholder for quiz in case quiz ID is not set\r\n\t */\r\n\tconst quizPlaceholder = ( ) => {\r\n\t\treturn (\r\n\t\t\t\r\n\t\t\t\t{\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t{ ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& \r\n\t\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tinitializeQuizAttributes( quizID )\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdisabled={ createQuiz }\r\n\t\t\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t{ __( 'OR', 'quiz-master-next' ) }\r\n\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t\t}\r\n\t\t\t\t\t{ ( qsmIsEmpty( quizList ) || createQuiz ) &&\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t setQuizAttributes( val, 'quiz_name') }\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t{ showAdvanceOption && quizOptions.map( qSetting => (\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t))\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t }\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tquizMessage.error && (\r\n\t\t\t\t\t\t\t

{ quizMessage.msg }

\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t);\r\n\t};\r\n\r\n\t/**\r\n\t * Set attribute value\r\n\t * @param { any } value attribute value to set\r\n\t * @param { string } attr_name attribute name\r\n\t */\r\n\tconst setQuizAttributes = ( value , attr_name ) => {\r\n\t\tlet newAttr = quizAttr;\r\n\t\tnewAttr[ attr_name ] = value;\r\n\t\tsetAttributes( { quizAttr: { ...newAttr } } );\r\n\t}\r\n\r\n\t/**\r\n\t * Prepare quiz data e.g. quiz details, questions, answers etc to save \r\n\t * @returns quiz data\r\n\t */\r\n\tconst getQuizDataToSave = ( ) => {\t\r\n\t\tlet blocks = getBlock( clientId ); \r\n\t\tif ( qsmIsEmpty( blocks ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tblocks = blocks.innerBlocks;\r\n\t\tlet quizDataToSave = {\r\n\t\t\tquiz_id: quizAttr.quiz_id,\r\n\t\t\tpost_id: quizAttr.post_id,\r\n\t\t\tquiz:{},\r\n\t\t\tpages:[],\r\n\t\t\tqpages:[],\r\n\t\t\tquestions:[]\r\n\t\t};\r\n\t\tlet pageSNo = 0;\r\n\t\t//loop through inner blocks\r\n\t\tblocks.forEach( (block) => {\r\n\t\t\tif ( 'qsm/quiz-page' === block.name ) {\r\n\t\t\t\tlet pageID = block.attributes.pageID;\r\n\t\t\t\tlet questions = [];\r\n\t\t\t\tif ( ! qsmIsEmpty( block.innerBlocks ) && 0 < block.innerBlocks.length ) { \r\n\t\t\t\t\tlet questionBlocks = block.innerBlocks;\r\n\t\t\t\t\t//Question Blocks\r\n\t\t\t\t\tquestionBlocks.forEach( ( questionBlock ) => {\r\n\t\t\t\t\t\tif ( 'qsm/quiz-question' !== questionBlock.name ) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlet questionAttr = questionBlock.attributes;\r\n\t\t\t\t\t\tlet answerEditor = qsmValueOrDefault( questionAttr?.answerEditor, 'text' );\r\n\t\t\t\t\t\tlet answers = [];\r\n\t\t\t\t\t\t//Answer option blocks\r\n\t\t\t\t\t\tif ( ! qsmIsEmpty( questionBlock.innerBlocks ) && 0 < questionBlock.innerBlocks.length ) { \r\n\t\t\t\t\t\t\tlet answerOptionBlocks = questionBlock.innerBlocks;\r\n\t\t\t\t\t\t\tanswerOptionBlocks.forEach( ( answerOptionBlock ) => {\r\n\t\t\t\t\t\t\t\tif ( 'qsm/quiz-answer-option' !== answerOptionBlock.name ) {\r\n\t\t\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tlet answerAttr = answerOptionBlock.attributes;\r\n\t\t\t\t\t\t\t\tlet answerContent = qsmValueOrDefault( answerAttr?.content );\r\n\t\t\t\t\t\t\t\t//if rich text\r\n\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( questionAttr?.answerEditor ) && 'rich' === questionAttr.answerEditor ) {\r\n\t\t\t\t\t\t\t\t\tanswerContent = qsmDecodeHtml( decodeEntities( answerContent ) );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tlet ans = [\r\n\t\t\t\t\t\t\t\t\tanswerContent,\r\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.points ),\r\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.isCorrect ),\r\n\t\t\t\t\t\t\t\t];\r\n\t\t\t\t\t\t\t\t//answer options are image type\r\n\t\t\t\t\t\t\t\tif ( 'image' === answerEditor && ! qsmIsEmpty( answerAttr?.caption ) ) {\r\n\t\t\t\t\t\t\t\t\tans.push( answerAttr?.caption );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tanswers.push( ans );\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//questions Data\r\n\t\t\t\t\t\tquestions.push( questionAttr.questionID );\r\n\t\t\t\t\t\t//update question only if changes occured\r\n\t\t\t\t\t\tif ( questionAttr.isChanged ) {\r\n\t\t\t\t\t\t\tquizDataToSave.questions.push({\r\n\t\t\t\t\t\t\t\t\"id\": questionAttr.questionID,\r\n\t\t\t\t\t\t\t\t\"quizID\": quizAttr.quiz_id,\r\n\t\t\t\t\t\t\t\t\"postID\": quizAttr.post_id,\r\n\t\t\t\t\t\t\t\t\"answerEditor\": answerEditor,\r\n\t\t\t\t\t\t\t\t\"type\": qsmValueOrDefault( questionAttr?.type , '0' ),\r\n\t\t\t\t\t\t\t\t\"name\": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.description ) ),\r\n\t\t\t\t\t\t\t\t\"question_title\": qsmValueOrDefault( questionAttr?.title ),\r\n\t\t\t\t\t\t\t\t\"answerInfo\": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.correctAnswerInfo ) ),\r\n\t\t\t\t\t\t\t\t\"comments\": qsmValueOrDefault( questionAttr?.commentBox, '1' ),\r\n\t\t\t\t\t\t\t\t\"hint\": qsmValueOrDefault( questionAttr?.hint ),\r\n\t\t\t\t\t\t\t\t\"category\": qsmValueOrDefault( questionAttr?.category ),\r\n\t\t\t\t\t\t\t\t\"multicategories\": qsmValueOrDefault( questionAttr?.multicategories, [] ),\r\n\t\t\t\t\t\t\t\t\"required\": qsmValueOrDefault( questionAttr?.required, 0 ),\r\n\t\t\t\t\t\t\t\t\"answers\": answers,\r\n\t\t\t\t\t\t\t\t\"featureImageID\":qsmValueOrDefault( questionAttr?.featureImageID ),\r\n\t\t\t\t\t\t\t\t\"featureImageSrc\":qsmValueOrDefault( questionAttr?.featureImageSrc ),\r\n\t\t\t\t\t\t\t\t\"page\": pageSNo,\r\n\t\t\t\t\t\t\t\t\"other_settings\": {\r\n\t\t\t\t\t\t\t\t\t...qsmValueOrDefault( questionAttr?.settings, {} ),\r\n\t\t\t\t\t\t\t\t\t\"required\": qsmValueOrDefault( questionAttr?.required, 0 )\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// pages[0][]: 2512\r\n\t\t\t\t// \tqpages[0][id]: 2\r\n\t\t\t\t// \tqpages[0][quizID]: 76\r\n\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\r\n\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\r\n\t\t\t\t// \tqpages[0][questions][]: 2512\r\n\t\t\t\t// \tpost_id: 111\r\n\t\t\t\t//page data\r\n\t\t\t\tquizDataToSave.pages.push( questions );\r\n\t\t\t\t\r\n\t\t\t\tquizDataToSave.qpages.push( {\r\n\t\t\t\t\t'id': pageID,\r\n\t\t\t\t\t'quizID': quizAttr.quiz_id,\r\n\t\t\t\t\t'pagekey': qsmIsEmpty( block.attributes.pageKey ) ? qsmUniqid() :block.attributes.pageKey,\r\n\t\t\t\t\t'hide_prevbtn':block.attributes.hidePrevBtn,\r\n\t\t\t\t\t'questions': questions\r\n\t\t\t\t} );\r\n\t\t\t\tpageSNo++;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t//Quiz details\r\n\t\tquizDataToSave.quiz = { \r\n\t\t\t'quiz_name': quizAttr.quiz_name,\r\n\t\t\t'quiz_id': quizAttr.quiz_id,\r\n\t\t\t'post_id': quizAttr.post_id,\r\n\t\t};\r\n\t\tif ( showAdvanceOption ) {\r\n\t\t\t[\r\n\t\t\t'form_type', \r\n\t\t\t'system', \r\n\t\t\t'timer_limit', \r\n\t\t\t'pagination',\r\n\t\t\t'enable_contact_form', \r\n\t\t\t'enable_pagination_quiz', \r\n\t\t\t'show_question_featured_image_in_result',\r\n\t\t\t'progress_bar',\r\n\t\t\t'require_log_in',\r\n\t\t\t'disable_first_page',\r\n\t\t\t'comment_section'\r\n\t\t\t].forEach( ( item ) => { \r\n\t\t\t\tif ( 'undefined' !== typeof quizAttr[ item ] && null !== quizAttr[ item ] ) {\r\n\t\t\t\t\tquizDataToSave.quiz[ item ] = quizAttr[ item ];\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn quizDataToSave;\r\n\t}\r\n\r\n\t//saving Quiz on save page\r\n\tuseEffect( () => {\r\n\t\tif ( isSavingPage ) {\r\n\t\t\tlet quizData = getQuizDataToSave();\r\n\t\t\t//save quiz status\r\n\t\t\tsetSaveQuiz( true );\r\n\t\t\t\r\n\t\t\tquizData = qsmFormData({\r\n\t\t\t\t'save_entire_quiz': '1',\r\n\t\t\t\t'quizData': JSON.stringify( quizData ),\r\n\t\t\t\t'qsm_block_quiz_nonce' : qsmBlockData.nonce,\r\n\t\t\t\t\"nonce\": qsmBlockData.saveNonce,//save pages nonce\r\n\t\t\t});\r\n\r\n\t\t\t//AJAX call\r\n\t\t\tapiFetch( {\r\n\t\t\t\tpath: '/quiz-survey-master/v1/quiz/save_quiz',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t\tbody: quizData\r\n\t\t\t} ).then( ( res ) => {\r\n\t\t\t\t//create notice\r\n\t\t\t\tcreateNotice( res.status, res.msg, {\r\n\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t} );\r\n\t\t\t} ).catch(\r\n\t\t\t\t( error ) => {\r\n\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t} );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}, [ isSavingPage ] );\r\n\r\n\t/**\r\n\t * Create new quiz and set quiz ID\r\n\t * \r\n\t */\r\n\tconst createNewQuiz = () => {\r\n\t\tif ( qsmIsEmpty( quizAttr.quiz_name ) ) {\r\n\t\t\tconsole.log(\"empty quiz_name\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t//save quiz status\r\n\t\tsetSaveQuiz( true );\r\n\t\t\r\n\t\tlet quizData = qsmFormData({\r\n\t\t\t'quiz_name': quizAttr.quiz_name,\r\n\t\t\t'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce\r\n\t\t});\r\n\t\t\r\n\t\t['form_type', \r\n\t\t'system', \r\n\t\t'timer_limit', \r\n\t\t'pagination',\r\n\t\t'enable_contact_form', \r\n\t\t'enable_pagination_quiz', \r\n\t\t'show_question_featured_image_in_result',\r\n\t\t'progress_bar',\r\n\t\t'require_log_in',\r\n\t\t'disable_first_page',\r\n\t\t'comment_section'\r\n\t\t].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) );\r\n\r\n\t\t//AJAX call\r\n\t\tapiFetch( {\r\n\t\t\tpath: '/quiz-survey-master/v1/quiz/create_quiz',\r\n\t\t\tmethod: 'POST',\r\n\t\t\tbody: quizData\r\n\t\t} ).then( ( res ) => {\r\n\t\t\t//save quiz status\r\n\t\t\tsetSaveQuiz( false );\r\n\t\t\tif ( 'success' == res.status ) {\r\n\t\t\t\t//create a question\r\n\t\t\t\tlet newQuestion = qsmFormData( {\r\n\t\t\t\t\t\"id\": null,\r\n\t\t\t\t\t\"quizID\": res.quizID,\r\n\t\t\t\t\t\"answerEditor\": \"text\",\r\n\t\t\t\t\t\"type\": \"0\",\r\n\t\t\t\t\t\"name\": \"\",\r\n\t\t\t\t\t\"question_title\": \"\",\r\n\t\t\t\t\t\"answerInfo\": \"\",\r\n\t\t\t\t\t\"comments\": \"1\",\r\n\t\t\t\t\t\"hint\": \"\",\r\n\t\t\t\t\t\"category\": \"\",\r\n\t\t\t\t\t\"required\": 0,\r\n\t\t\t\t\t\"answers\": [],\r\n\t\t\t\t\t\"page\": 0\r\n\t\t\t\t} );\r\n\t\t\t\t//AJAX call\r\n\t\t\t\tapiFetch( {\r\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\r\n\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\tbody: newQuestion\r\n\t\t\t\t} ).then( ( response ) => {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ( 'success' == response.status ) {\r\n\t\t\t\t\t\tlet question_id = response.id;\r\n\r\n\t\t\t\t\t\t/**Page attributes required format */\r\n\t\t\t\t\t\t// pages[0][]: 2512\r\n\t\t\t\t\t\t// \tqpages[0][id]: 2\r\n\t\t\t\t\t\t// \tqpages[0][quizID]: 76\r\n\t\t\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\r\n\t\t\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\r\n\t\t\t\t\t\t// \tqpages[0][questions][]: 2512\r\n\t\t\t\t\t\t// \tpost_id: 111\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlet newPage = qsmFormData( {\r\n\t\t\t\t\t\t\t\"action\": qsmBlockData.save_pages_action,\r\n\t\t\t\t\t\t\t\"quiz_id\": res.quizID,\r\n\t\t\t\t\t\t\t\"nonce\": qsmBlockData.saveNonce,\r\n\t\t\t\t\t\t\t\"post_id\": res.quizPostID,\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t\tnewPage.append( 'pages[0][]', question_id );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][id]', 1 );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][quizID]', res.quizID );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][pagekey]', qsmUniqid() );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][hide_prevbtn]', 0 );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][questions][]', question_id );\r\n\r\n\r\n\t\t\t\t\t\t//create a page\r\n\t\t\t\t\t\tapiFetch( {\r\n\t\t\t\t\t\t\turl: qsmBlockData.ajax_url,\r\n\t\t\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\t\t\tbody: newPage\r\n\t\t\t\t\t\t} ).then( ( pageResponse ) => {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ( 'success' == pageResponse.status ) {\r\n\t\t\t\t\t\t\t\t//set new quiz\r\n\t\t\t\t\t\t\t\tinitializeQuizAttributes( res.quizID );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}).catch(\r\n\t\t\t\t\t( error ) => {\r\n\t\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t\t\r\n\t\t\t} \r\n\r\n\t\t\t//create notice\r\n\t\t\tcreateNotice( res.status, res.msg, {\r\n\t\t\t\tisDismissible: true,\r\n\t\t\t\ttype: 'snackbar',\r\n\t\t\t} );\r\n\t\t} ).catch(\r\n\t\t\t( error ) => {\r\n\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t} );\r\n\t\t\t}\r\n\t\t);\r\n\t \r\n\t}\r\n\r\n\t/**\r\n\t * Inner Blocks\r\n\t */\r\n\tconst blockProps = useBlockProps();\r\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\r\n\t\ttemplate: quizTemplate,\r\n\t\tallowedBlocks : [\r\n\t\t\t'qsm/quiz-page'\r\n\t\t]\r\n\t} );\r\n\t\r\n\r\n\treturn (\r\n\t<>\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t setQuizAttributes( val, 'quiz_name') }\r\n\t\t\tclassName='qsm-no-mb'\r\n\t\t/>\r\n\t\t{\r\n\t\t\t( ! qsmIsEmpty( quizID ) || '0' != quizID ) && \r\n\t\t\t

\r\n\t\t\t\t\r\n\t\t\t\t\t{ __( 'Advance Quiz Settings', 'quiz-master-next' ) }\r\n\t\t\t\t\r\n\t\t\t

\r\n\t\t}\r\n\t\t
\r\n\t
\r\n\t{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? \r\n
{ quizPlaceholder() }
\r\n\t:\r\n\t
\r\n\t}\r\n\t\r\n\t\r\n\t);\r\n}\r\n","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n//Match array of object values and return array of cooresponding matching keys \r\nexport const qsmMatchingValueKeyArray = ( values, obj ) => {\r\n\tif ( qsmIsEmpty( obj ) || ! Array.isArray( values ) ) {\r\n\t\treturn values;\r\n\t}\r\n\treturn values.map( ( val ) => Object.keys(obj).find( key => obj[key] == val) );\r\n}\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//Generate random number\r\nexport const qsmGenerateRandomKey = (length) => {\r\n const charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n let key = \"\";\r\n\r\n // Generate random bytes\r\n const values = new Uint8Array(length);\r\n window.crypto.getRandomValues(values);\r\n\r\n for (let i = 0; i < length; i++) {\r\n // Use the random byte to index into the charset\r\n key += charset[values[i] % charset.length];\r\n }\r\n\r\n return key;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const id = qsmGenerateRandomKey(8);\r\n return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(7) }`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { registerBlockType } from '@wordpress/blocks';\r\nimport './style.scss';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { qsmBlockIcon } from './component/icon';\r\nimport { createHigherOrderComponent } from '@wordpress/compose';\r\n\r\nconst save = ( props ) => null;\r\nregisterBlockType( metadata.name, {\r\n\ticon: qsmBlockIcon,\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n\tsave: save,\r\n} );\r\n\r\n\r\nconst withMyPluginControls = createHigherOrderComponent( ( BlockEdit ) => {\r\n\treturn ( props ) => {\r\n\t\tconst { name, className, attributes, setAttributes, isSelected, clientId, context } = props;\r\n\t\tif ( 'core/group' !== name ) {\r\n\t\t\treturn ;\r\n\t\t}\r\n\r\n\t\tconsole.log(\"props\",props);\r\n\t\treturn (\r\n\t\t\t<>\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t);\r\n\t};\r\n}, 'withMyPluginControls' );\r\n\r\nwp.hooks.addFilter(\r\n\t'editor.BlockEdit',\r\n\t'my-plugin/with-inspector-controls',\r\n\twithMyPluginControls\r\n);","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"compose\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkqsm\"] = self[\"webpackChunkqsm\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], function() { return __webpack_require__(\"./src/index.js\"); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useState","useEffect","Button","TextControl","ToggleControl","SelectControl","CheckboxControl","RadioControl","TextareaControl","qsmIsEmpty","qsmStripTags","noop","InputComponent","className","quizAttr","setAttributes","data","onChangeFunc","_quizAttr$id","_quizAttr$id2","_quizAttr$id3","_quizAttr$id4","_quizAttr$id5","processData","defaultvalue","default","options","type","length","label","help","newData","id","createElement","Fragment","checked","onChange","value","val","__nextHasNoMarginBottom","selected","Icon","qsmBlockIcon","icon","width","height","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","warningIcon","stroke","strokeWidth","strokeLinecap","strokeLinejoin","apiFetch","decodeEntities","InspectorControls","InnerBlocks","useBlockProps","store","blockEditorStore","useInnerBlocksProps","noticesStore","useDispatch","useSelect","editorStore","PanelBody","Placeholder","ExternalLink","__experimentalVStack","VStack","qsmFormData","qsmUniqid","qsmValueOrDefault","qsmDecodeHtml","Edit","props","qsmBlockData","attributes","isSelected","clientId","createNotice","globalQuizsetting","quizID","postID","quizList","setQuizList","QSMQuizList","quizMessage","setQuizMessage","error","msg","createQuiz","setCreateQuiz","saveQuiz","setSaveQuiz","showAdvanceOption","setShowAdvanceOption","quizTemplate","setQuizTemplate","quizOptions","isSavingPage","select","isAutosavingPost","isSavingPost","getBlock","shouldSetQSMAttr","is_pro_activated","setTimeout","addUpgradePopupHtml","hasQuiz","forEach","quizElement","initializeQuizAttributes","undefined","modalEl","document","getElementById","path","method","then","res","bodyEl","status","insertAdjacentHTML","result","catch","console","log","quiz_id","parseInt","post_id","qpages","quizTemp","page","questions","question_arr","question","answers","answer","aIndex","push","optionID","content","points","isCorrect","caption","questionID","question_id","question_type_new","answerEditor","settings","title","question_title","description","question_name","required","hint","hints","correctAnswerInfo","question_answer_info","category","multicategories","commentBox","comments","matchAnswer","featureImageID","featureImageSrc","pageID","pageKey","pagekey","hidePrevBtn","hide_prevbtn","quizPlaceholder","instructions","disabled","variant","onClick","spacing","quiz_name","setQuizAttributes","map","qSetting","key","createNewQuiz","attr_name","newAttr","getQuizDataToSave","blocks","innerBlocks","quizDataToSave","quiz","pages","pageSNo","block","name","questionBlocks","questionBlock","questionAttr","answerOptionBlocks","answerOptionBlock","answerAttr","answerContent","ans","isChanged","item","quizData","JSON","stringify","nonce","saveNonce","body","isDismissible","message","qsm_new_quiz_nonce","append","newQuestion","response","newPage","save_pages_action","quizPostID","url","ajax_url","pageResponse","blockProps","innerBlocksProps","template","allowedBlocks","initialOpen","post_status","href","quiz_settings_url","qsmUniqueArray","arr","Array","isArray","filter","index","indexOf","qsmMatchingValueKeyArray","values","obj","Object","keys","find","html","txt","innerHTML","qsmSanitizeName","toLowerCase","replace","text","div","innerText","FormData","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmGenerateRandomKey","charset","Uint8Array","window","crypto","getRandomValues","i","prefix","random","defaultValue","registerBlockType","metadata","createHigherOrderComponent","save","edit","withMyPluginControls","BlockEdit","context","wp","hooks","addFilter"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/page/index.asset.php b/blocks/build/page/index.asset.php index 5a2b29b90..23561557e 100644 --- a/blocks/build/page/index.asset.php +++ b/blocks/build/page/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'a6a7c8c48015f8b1bc61'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '491b4cba078ca130db1c'); diff --git a/blocks/build/page/index.js b/blocks/build/page/index.js index 035c9ecdf..7ee478b11 100644 --- a/blocks/build/page/index.js +++ b/blocks/build/page/index.js @@ -1 +1,360 @@ -!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,l=(window.wp.apiFetch,window.wp.blockEditor),a=window.wp.components;const i=e=>null==e||""===e;var o=JSON.parse('{"u2":"qsm/quiz-page"}');(0,e.registerBlockType)(o.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:o,attributes:r,setAttributes:s,isSelected:c,clientId:u,context:m}=e,{pageID:d,pageKey:w,hidePrevBtn:p}=(m["quiz-master-next/quizID"],r),[g,q]=(0,t.useState)(qsmBlockData.globalQuizsetting),B=(0,l.useBlockProps)();return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(l.InspectorControls,null,(0,t.createElement)(a.PanelBody,{title:(0,n.__)("Page settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(a.TextControl,{label:(0,n.__)("Page Name","quiz-master-next"),value:w,onChange:e=>s({pageKey:e})}),(0,t.createElement)(a.ToggleControl,{label:(0,n.__)("Hide Previous Button?","quiz-master-next"),checked:!i(p)&&"1"==p,onChange:()=>s({hidePrevBtn:i(p)||"1"!=p?1:0})}))),(0,t.createElement)("div",{...B},(0,t.createElement)(l.InnerBlocks,{allowedBlocks:["qsm/quiz-question"]})))}})}(); \ No newline at end of file +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/helper.js": +/*!***********************!*\ + !*** ./src/helper.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, +/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, +/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, +/* harmony export */ qsmGenerateRandomKey: function() { return /* binding */ qsmGenerateRandomKey; }, +/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, +/* harmony export */ qsmMatchingValueKeyArray: function() { return /* binding */ qsmMatchingValueKeyArray; }, +/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, +/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, +/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } +/* harmony export */ }); +//Check if undefined, null, empty +const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; + +//Get Unique array values +const qsmUniqueArray = arr => { + if (qsmIsEmpty(arr) || !Array.isArray(arr)) { + return arr; + } + return arr.filter((val, index, arr) => arr.indexOf(val) === index); +}; + +//Match array of object values and return array of cooresponding matching keys +const qsmMatchingValueKeyArray = (values, obj) => { + if (qsmIsEmpty(obj) || !Array.isArray(values)) { + return values; + } + return values.map(val => Object.keys(obj).find(key => obj[key] == val)); +}; + +//Decode htmlspecialchars +const qsmDecodeHtml = html => { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; +}; +const qsmSanitizeName = name => { + if (qsmIsEmpty(name)) { + name = ''; + } else { + name = name.toLowerCase().replace(/ /g, '_'); + name = name.replace(/\W/g, ''); + } + return name; +}; + +// Remove anchor tags from text content. +const qsmStripTags = text => { + let div = document.createElement("div"); + div.innerHTML = qsmDecodeHtml(text); + return div.innerText; +}; + +//prepare form data +const qsmFormData = (obj = false) => { + let newData = new FormData(); + //add to check if api call from editor + newData.append('qsm_block_api_call', '1'); + if (false !== obj) { + for (let k in obj) { + if (obj.hasOwnProperty(k)) { + newData.append(k, obj[k]); + } + } + } + return newData; +}; + +//add objecyt to form data +const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { + if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { + return data; + } + for (let key in valueObj) { + if (valueObj.hasOwnProperty(key)) { + let value = valueObj[key]; + if ('object' === value) { + qsmAddObjToFormData(formKey + '[' + key + ']', value, data); + } else { + data.append(formKey + '[' + key + ']', valueObj[key]); + } + } + } + return data; +}; + +//Generate random number +const qsmGenerateRandomKey = length => { + const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let key = ""; + + // Generate random bytes + const values = new Uint8Array(length); + window.crypto.getRandomValues(values); + for (let i = 0; i < length; i++) { + // Use the random byte to index into the charset + key += charset[values[i] % charset.length]; + } + return key; +}; + +//generate uiniq id +const qsmUniqid = (prefix = "", random = false) => { + const id = qsmGenerateRandomKey(8); + return `${prefix}${id}${random ? `.${qsmGenerateRandomKey(7)}` : ""}`; +}; + +//return data if not empty otherwise default value +const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; + +/***/ }), + +/***/ "./src/page/edit.js": +/*!**************************!*\ + !*** ./src/page/edit.js ***! + \**************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": function() { return /* binding */ Edit; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); + + + + + + + +function Edit(props) { + //check for QSM initialize data + if ('undefined' === typeof qsmBlockData) { + return null; + } + const { + className, + attributes, + setAttributes, + isSelected, + clientId, + context + } = props; + const quizID = context['quiz-master-next/quizID']; + const { + pageID, + pageKey, + hidePrevBtn + } = attributes; + const [qsmPageAttr, setQsmPageAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.globalQuizsetting); + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page settings', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page Name', 'quiz-master-next'), + value: pageKey, + onChange: pageKey => setAttributes({ + pageKey + }) + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToggleControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hide Previous Button?', 'quiz-master-next'), + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn, + onChange: () => setAttributes({ + hidePrevBtn: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn ? 0 : 1 + }) + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { + allowedBlocks: ['qsm/quiz-question'] + }))); +} + +/***/ }), + +/***/ "@wordpress/api-fetch": +/*!**********************************!*\ + !*** external ["wp","apiFetch"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["apiFetch"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "./src/page/block.json": +/*!*****************************!*\ + !*** ./src/page/block.json ***! + \*****************************/ +/***/ (function(module) { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-page","version":"0.1.0","title":"Page","category":"widgets","parent":["qsm/quiz"],"icon":"text-page","description":"QSM Quiz Page","attributes":{"pageID":{"type":"string","default":"0"},"pageKey":{"type":"string","default":""},"hidePrevBtn":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/quizAttr"],"providesContext":{"quiz-master-next/pageID":"pageID"},"example":{},"supports":{"html":false,"multiple":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { +/*!***************************!*\ + !*** ./src/page/index.js ***! + \***************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/page/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/page/block.json"); + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { + /** + * @see ./edit.js + */ + edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] +}); +}(); +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/build/page/index.js.map b/blocks/build/page/index.js.map new file mode 100644 index 000000000..e7baf7212 --- /dev/null +++ b/blocks/build/page/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"page/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;;AAErG;AACO,MAAMC,cAAc,GAAKC,GAAG,IAAM;EACxC,IAAKH,UAAU,CAAEG,GAAI,CAAC,IAAI,CAAEC,KAAK,CAACC,OAAO,CAAEF,GAAI,CAAC,EAAG;IAClD,OAAOA,GAAG;EACX;EACA,OAAOA,GAAG,CAACG,MAAM,CAAE,CAAEC,GAAG,EAAEC,KAAK,EAAEL,GAAG,KAAMA,GAAG,CAACM,OAAO,CAAEF,GAAI,CAAC,KAAKC,KAAM,CAAC;AACzE,CAAC;;AAED;AACO,MAAME,wBAAwB,GAAGA,CAAEC,MAAM,EAAEC,GAAG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;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCC,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAE1B,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/page/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/page/index.js"],"sourcesContent":["//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n//Match array of object values and return array of cooresponding matching keys \r\nexport const qsmMatchingValueKeyArray = ( values, obj ) => {\r\n\tif ( qsmIsEmpty( obj ) || ! Array.isArray( values ) ) {\r\n\t\treturn values;\r\n\t}\r\n\treturn values.map( ( val ) => Object.keys(obj).find( key => obj[key] == val) );\r\n}\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//Generate random number\r\nexport const qsmGenerateRandomKey = (length) => {\r\n const charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n let key = \"\";\r\n\r\n // Generate random bytes\r\n const values = new Uint8Array(length);\r\n window.crypto.getRandomValues(values);\r\n\r\n for (let i = 0; i < length; i++) {\r\n // Use the random byte to index into the charset\r\n key += charset[values[i] % charset.length];\r\n }\r\n\r\n return key;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const id = qsmGenerateRandomKey(8);\r\n return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(7) }`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tInspectorControls,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n} from '@wordpress/block-editor';\r\nimport {\r\n\tPanelBody,\r\n\tPanelRow,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tRangeControl,\r\n\tRadioControl,\r\n\tSelectControl,\r\n} from '@wordpress/components';\r\nimport { qsmIsEmpty } from '../helper';\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\t\r\n\tconst {\r\n\t\tpageID,\r\n\t\tpageKey,\r\n\t\thidePrevBtn,\r\n\t} = attributes;\r\n\r\n\tconst [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting );\r\n\t\r\n\tconst blockProps = useBlockProps();\r\n\r\n\treturn (\r\n\t<>\r\n\t\r\n\t\t\r\n\t\t\t setAttributes( { pageKey } ) }\r\n\t\t\t/>\r\n\t\t\t setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) }\r\n\t\t\t/>\r\n\t\t\r\n\t\t\r\n\t\r\n\t
\r\n\t\t\r\n\t
\r\n\t\r\n\t);\r\n}\r\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\n\r\nregisterBlockType( metadata.name, {\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n} );\r\n"],"names":["qsmIsEmpty","data","qsmUniqueArray","arr","Array","isArray","filter","val","index","indexOf","qsmMatchingValueKeyArray","values","obj","map","Object","keys","find","key","qsmDecodeHtml","html","txt","document","createElement","innerHTML","value","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","div","innerText","qsmFormData","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmGenerateRandomKey","length","charset","Uint8Array","window","crypto","getRandomValues","i","qsmUniqid","prefix","random","id","qsmValueOrDefault","defaultValue","__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","quizID","pageID","pageKey","hidePrevBtn","qsmPageAttr","setQsmPageAttr","globalQuizsetting","blockProps","Fragment","title","initialOpen","label","onChange","checked","allowedBlocks","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/question/block.json b/blocks/build/question/block.json index ec6d70c6f..86bbe78b8 100644 --- a/blocks/build/question/block.json +++ b/blocks/build/question/block.json @@ -93,7 +93,12 @@ }, "example": {}, "supports": { - "html": false + "html": false, + "anchor": true, + "className": true, + "interactivity": { + "clientNavigation": true + } }, "textdomain": "main-block", "editorScript": "file:./index.js", diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php index 8b63bfc8d..f561fdc4e 100644 --- a/blocks/build/question/index.asset.php +++ b/blocks/build/question/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'dcd1877a00a779b25a17'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '79942d734c1eedd39da1'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 1ff899231..152936b1f 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -1,5 +1,1343 @@ -!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch,l=e.n(r),i=window.wp.blockEditor,o=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,p=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),_=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=_(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],E=(0,n.__)("Featured image"),x=(0,n.__)("Set featured image"),C=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media."));var w=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:l}=(0,s.useDispatch)(o.store),p=(0,a.useRef)(),[_,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:w,mediaUpload:y}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function b(e){y({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){l("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(w)||"object"!=typeof w||q({id:e,width:w.media_details.width,height:w.media_details.height,url:w.source_url,alt_text:w.alt_text,slug:w.slug})),()=>{t=!1}}),[w]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( -// Translators: %s: The selected image alt text. -(0,n.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,n.sprintf)( -// Translators: %s: The selected image filename. -(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:C},(0,a.createElement)(i.MediaUpload,{title:E,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:p,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),_&&(0,a.createElement)(c.Spinner,null),!e&&!_&&x),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),p.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:b})),value:e})))},y=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[p,_]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,E]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,C)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},B(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},B(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},y)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(o)||p||(_(!0),l()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:o,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;l()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(E(e.result),w(e.result),s(""),u(0),t(a,x(term.id)),_(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:o,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||p},y)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},b=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(b.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){var r;if("undefined"==typeof qsmBlockData)return null;const{className:m,attributes:u,setAttributes:f,isSelected:E,clientId:x,context:C}=e,b=(0,s.useSelect)((e=>E||e("core/block-editor").hasSelectedInnerBlock(x,!0))),k=C["quiz-master-next/quizID"],{quiz_name:B,post_id:v,rest_nonce:D}=C["quiz-master-next/quizAttr"],{createNotice:I}=(C["quiz-master-next/pageID"],(0,s.useDispatch)(o.store)),{getBlockRootClientId:z,getBlockIndex:N}=(0,s.useSelect)(i.store),{insertBlock:S}=(0,s.useDispatch)(i.store),{isChanged:T=!1,questionID:A,type:F,description:P,title:O,correctAnswerInfo:M,commentBox:R,category:L,multicategories:U=[],hint:H,featureImageID:Q,featureImageSrc:j,answers:W,answerEditor:Z,matchAnswer:$,required:G,settings:J={}}=u,K="1"==qsmBlockData.is_pro_activated,V=e=>14{let e=J?.file_upload_type||qsmBlockData.file_upload_type.default;return d(e)?[]:e.split(",")};(0,a.useEffect)((()=>{let e=!0;if(e&&(d(A)||"0"==A||!d(A)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(A,x))){let e=h({id:null,rest_nonce:D,quizID:k,quiz_name:B,postID:v,answerEditor:q(Z,"text"),type:q(F,"0"),name:_(q(P)),question_title:q(O),answerInfo:_(q(M)),comments:q(R,"1"),hint:q(H),category:q(L),multicategories:[],required:q(G,0),answers:W,page:0,featureImageID:Q,featureImageSrc:j,matchAnswer:null});l()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;f({questionID:t})}})).catch((e=>{console.log("error",e),I("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&E&&!1===T&&f({isChanged:!0}),()=>{e=!1}}),[A,F,P,O,M,R,L,U,H,Q,j,W,Z,$,G,J]);const ee=(0,i.useBlockProps)({className:b?" in-editing-mode":""}),te=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=te(e,t);a=[...a,...n]}return p(a)},ae=["12","7","3","5","14"].includes(F)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"";return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>(()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);S(a,N(x)+1,z(x),!0)})()}),(0,a.createElement)(c.ToolbarButton,{icon:"welcome-add-page",label:(0,n.__)("Add New Page","quiz-master-next"),onClick:()=>(()=>{const e=(0,t.createBlock)("qsm/quiz-page"),a=z(x),n=N(a)+1,r=z(a);S(e,n,r,!0)})()}))),V(F)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+A),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...ee},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+O))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+A),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:F||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||K||!["15","16","17"].includes(e))f({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[F])?"":qsmBlockData.question_type_description[F]+" "+ae,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug,disabled:K&&V(e.slug)},e.name))))))),["0","4","1","10","13"].includes(F)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:Z||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>f({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d(G)&&"1"==G,onChange:()=>f({required:d(G)||"1"!=G?1:0})})),"11"==F&&(0,a.createElement)(c.PanelBody,{title:(0,n.__)("File Settings","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{type:"number",label:qsmBlockData.file_upload_limit.heading,value:null!==(r=J?.file_upload_limit)&&void 0!==r?r:qsmBlockData.file_upload_limit.default,onChange:e=>f({settings:{...J,file_upload_limit:e}})}),(0,a.createElement)("label",{className:"qsm-inspector-label"},qsmBlockData.file_upload_type.heading),Object.keys(qsmBlockData.file_upload_type.options).map((e=>{return(0,a.createElement)(c.CheckboxControl,{key:"filetype-"+e,label:X[e],checked:(t=e,Y().includes(t)),onChange:()=>(e=>{let t=Y();t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),t=t.join(","),f({settings:{...J,file_upload_type:t}})})(e)});var t}))),(0,a.createElement)(y,{isCategorySelected:e=>U.includes(e),setUnsetCatgory:(e,t)=>{let a=d(U)||0===U.length?d(L)?[]:[L]:U;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{te(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=te(e,t);a=[...a,...n]}a=p(a),f({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(w,{featureImageID:Q,onUpdateImage:e=>{f({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{f({featureImageID:void 0,featureImageSrc:void 0})}})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:R||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>f({commentBox:e}),__nextHasNoMarginBottom:!0}))),(0,a.createElement)("div",{...ee},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:O,onChange:e=>f({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),b&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here","quiz-master-next"),value:_(P),onChange:e=>f({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(F)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:_(M),onChange:e=>f({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Hint","quiz-master-next"),"aria-label":(0,n.__)("Hint","quiz-master-next"),placeholder:(0,n.__)("hint goes here","quiz-master-next"),value:H,onChange:e=>f({hint:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-hint"})))))}})}(); \ No newline at end of file +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/component/FeaturedImage.js": +/*!****************************************!*\ + !*** ./src/component/FeaturedImage.js ***! + \****************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks"); +/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/blob */ "@wordpress/blob"); +/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blob__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); +/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); + +/** + * WordPress dependencies + */ + + + + + + + + + + +const ALLOWED_MEDIA_TYPES = ['image']; + +// Used when labels from post type were not yet loaded or when they are not present. +const DEFAULT_FEATURE_IMAGE_LABEL = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Featured image'); +const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Set featured image'); +const instructions = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('To edit the featured image, you need permission to upload media.')); +const FeaturedImage = ({ + featureImageID, + onUpdateImage, + onRemoveImage +}) => { + const { + createNotice + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__.store); + const toggleRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const [isLoading, setIsLoading] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const [media, setMedia] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(undefined); + const { + mediaFeature, + mediaUpload + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(select => { + const { + getMedia + } = select(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_8__.store); + return { + mediaFeature: (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(media) && !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(featureImageID) && getMedia(featureImageID), + mediaUpload: select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.store).getSettings().mediaUpload + }; + }, []); + + /**Set media data */ + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetQSMAttr = true; + if (shouldSetQSMAttr) { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(mediaFeature) && 'object' === typeof mediaFeature) { + setMedia({ + id: featureImageID, + width: mediaFeature.media_details.width, + height: mediaFeature.media_details.height, + url: mediaFeature.source_url, + alt_text: mediaFeature.alt_text, + slug: mediaFeature.slug + }); + } + } + + //cleanup + return () => { + shouldSetQSMAttr = false; + }; + }, [mediaFeature]); + function onDropFiles(filesList) { + mediaUpload({ + allowedTypes: ['image'], + filesList, + onFileChange([image]) { + if ((0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_4__.isBlobURL)(image?.url)) { + setIsLoading(true); + return; + } + onUpdateImage(image); + setIsLoading(false); + }, + onError(message) { + createNotice('error', message, { + isDismissible: true, + type: 'snackbar' + }); + } + }); + } + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "editor-post-featured-image" + }, media && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + id: `editor-post-featured-image-${featureImageID}-describedby`, + className: "hidden" + }, media.alt_text && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)( + // Translators: %s: The selected image alt text. + (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)( + // Translators: %s: The selected image filename. + (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('The current image has no alternative text. The file name is: %s'), media.slug)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.MediaUploadCheck, { + fallback: instructions + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.MediaUpload, { + title: DEFAULT_FEATURE_IMAGE_LABEL, + onSelect: media => { + setMedia(media); + onUpdateImage(media); + }, + unstableFeaturedImageFlow: true, + allowedTypes: ALLOWED_MEDIA_TYPES, + modalClass: "editor-post-featured-image__media-modal", + render: ({ + open + }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "editor-post-featured-image__container" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { + ref: toggleRef, + className: !featureImageID ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', + onClick: open, + "aria-label": !featureImageID ? null : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Edit or replace the image'), + "aria-describedby": !featureImageID ? null : `editor-post-featured-image-${featureImageID}-describedby` + }, !!featureImageID && media && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ResponsiveWrapper, { + naturalWidth: media.width, + naturalHeight: media.height, + isInline: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + src: media.url, + alt: media.alt_text + })), isLoading && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Spinner, null), !featureImageID && !isLoading && DEFAULT_SET_FEATURE_IMAGE_LABEL), !!featureImageID && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.__experimentalHStack, { + className: "editor-post-featured-image__actions" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { + className: "editor-post-featured-image__action", + onClick: open + // Prefer that screen readers use the .editor-post-featured-image__preview button. + , + "aria-hidden": "true" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Replace')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { + className: "editor-post-featured-image__action", + onClick: () => { + onRemoveImage(); + toggleRef.current.focus(); + } + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Remove'))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.DropZone, { + onFilesDrop: onDropFiles + })), + value: featureImageID + }))); +}; +/* harmony default export */ __webpack_exports__["default"] = (FeaturedImage); + +/***/ }), + +/***/ "./src/component/SelectAddCategory.js": +/*!********************************************!*\ + !*** ./src/component/SelectAddCategory.js ***! + \********************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); + +/** + * Select or add a category + */ + + + + + +const SelectAddCategory = ({ + isCategorySelected, + setUnsetCatgory +}) => { + //whether showing add category form + const [showForm, setShowForm] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + //new category name + const [formCatName, setFormCatName] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(''); + //new category prent id + const [formCatParent, setFormCatParent] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(0); + //new category adding start status + const [addingNewCategory, setAddingNewCategory] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + //error + const [newCategoryError, setNewCategoryError] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + //category list + const [categories, setCategories] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData?.hierarchicalCategoryList); + + //get category id-details object + const getCategoryIdDetailsObject = categories => { + let catObj = {}; + categories.forEach(cat => { + catObj[cat.id] = cat; + if (0 < cat.children.length) { + let childCategory = getCategoryIdDetailsObject(cat.children); + catObj = { + ...catObj, + ...childCategory + }; + } + }); + return catObj; + }; + + //category id wise details + const [categoryIdDetails, setCategoryIdDetails] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)((0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmIsEmpty)(qsmBlockData?.hierarchicalCategoryList) ? {} : getCategoryIdDetailsObject(qsmBlockData.hierarchicalCategoryList)); + const addNewCategoryLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Category ', 'quiz-master-next'); + const noParentOption = `— ${(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Parent Category ', 'quiz-master-next')} —`; + + //Add new category + const onAddCategory = async event => { + event.preventDefault(); + if (newCategoryError || (0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmIsEmpty)(formCatName) || addingNewCategory) { + return; + } + setAddingNewCategory(true); + + //create a page + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + url: qsmBlockData.ajax_url, + method: 'POST', + body: (0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmFormData)({ + 'action': 'save_new_category', + 'name': formCatName, + 'parent': formCatParent + }) + }).then(res => { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmIsEmpty)(res.term_id)) { + let term_id = res.term_id; + //console.log("save_new_category",res); + //set category list + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/quiz/hierarchical-category-list', + method: 'POST' + }).then(res => { + // console.log("new categorieslist", res); + if ('success' == res.status) { + setCategories(res.result); + setCategoryIdDetails(res.result); + //set form + setFormCatName(''); + setFormCatParent(0); + //set category selected + setUnsetCatgory(term_id, getCategoryIdDetailsObject(term.id)); + setAddingNewCategory(false); + } + }); + } + }); + }; + + //get category name array + const getCategoryNameArray = categories => { + let cats = []; + categories.forEach(cat => { + cats.push(cat.name); + if (0 < cat.children.length) { + let childCategory = getCategoryNameArray(cat.children); + cats = [...cats, ...childCategory]; + } + }); + return cats; + }; + + //check if category name already exists and set new category name + const checkSetNewCategory = (catName, categories) => { + categories = getCategoryNameArray(categories); + console.log("categories", categories); + if (categories.includes(catName)) { + setNewCategoryError(catName); + } else { + setNewCategoryError(false); + setFormCatName(catName); + } + // categories.forEach( cat => { + // if ( cat.name == catName ) { + // matchName = true; + // return false; + // } else if ( 0 < cat.children.length ) { + // checkSetNewCategory( catName, cat.children ) + // } + // }); + + // if ( matchName ) { + // setNewCategoryError( matchName ); + // } else { + // setNewCategoryError( matchName ); + // setFormCatName( catName ); + // } + }; + + const renderTerms = categories => { + return categories.map(term => { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + key: term.id, + className: "editor-post-taxonomies__hierarchical-terms-choice" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.CheckboxControl, { + label: term.name, + checked: isCategorySelected(term.id), + onChange: () => setUnsetCatgory(term.id, categoryIdDetails) + }), !!term.children.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "editor-post-taxonomies__hierarchical-terms-subchoices" + }, renderTerms(term.children))); + }); + }; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Categories', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "editor-post-taxonomies__hierarchical-terms-list", + tabIndex: "0", + role: "group", + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Categories', 'quiz-master-next') + }, renderTerms(categories)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "qsm-ptb-1" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { + variant: "link", + onClick: () => setShowForm(!showForm) + }, addNewCategoryLabel)), showForm && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("form", { + onSubmit: onAddCategory + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Flex, { + direction: "column", + gap: "1" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.TextControl, { + __nextHasNoMarginBottom: true, + className: "editor-post-taxonomies__hierarchical-terms-input", + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Category Name', 'quiz-master-next'), + value: formCatName, + onChange: formCatName => checkSetNewCategory(formCatName, categories), + required: true + }), 0 < categories.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.TreeSelect, { + __nextHasNoMarginBottom: true, + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Parent Category', 'quiz-master-next'), + noOptionLabel: noParentOption, + onChange: id => setFormCatParent(id), + selectedId: formCatParent, + tree: categories + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FlexItem, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { + variant: "secondary", + type: "submit", + className: "editor-post-taxonomies__hierarchical-terms-submit", + disabled: newCategoryError || addingNewCategory + }, addNewCategoryLabel)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FlexItem, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { + className: "qsm-error-text" + }, false !== newCategoryError && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Category ', 'quiz-master-next') + newCategoryError + (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)(' already exists.', 'quiz-master-next')))))); +}; +/* harmony default export */ __webpack_exports__["default"] = (SelectAddCategory); + +/***/ }), + +/***/ "./src/component/icon.js": +/*!*******************************!*\ + !*** ./src/component/icon.js ***! + \*******************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ answerOptionBlockIcon: function() { return /* binding */ answerOptionBlockIcon; }, +/* harmony export */ qsmBlockIcon: function() { return /* binding */ qsmBlockIcon; }, +/* harmony export */ questionBlockIcon: function() { return /* binding */ questionBlockIcon; }, +/* harmony export */ warningIcon: function() { return /* binding */ warningIcon; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); + + +//QSM Quiz Block +const qsmBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "24", + height: "24", + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + width: "24", + height: "24", + rx: "3", + fill: "black" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z", + fill: "white" + })) +}); + +//Question Block +const questionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "25", + height: "25", + viewBox: "0 0 25 25", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + x: "0.102539", + y: "0.101562", + width: "24", + height: "24", + rx: "4.68852", + fill: "#ADADAD" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z", + fill: "white" + })) +}); + +//Answer option Block +const answerOptionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "24", + height: "24", + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { + width: "24", + height: "24", + rx: "4.21657", + fill: "#ADADAD" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z", + fill: "white" + })) +}); + +//Warning icon +const warningIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { + icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + width: "54", + height: "54", + viewBox: "0 0 54 54", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z", + stroke: "#B45309", + strokeWidth: "1.65929", + strokeLinecap: "round", + strokeLinejoin: "round" + })) +}); + +/***/ }), + +/***/ "./src/helper.js": +/*!***********************!*\ + !*** ./src/helper.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, +/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, +/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, +/* harmony export */ qsmGenerateRandomKey: function() { return /* binding */ qsmGenerateRandomKey; }, +/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, +/* harmony export */ qsmMatchingValueKeyArray: function() { return /* binding */ qsmMatchingValueKeyArray; }, +/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, +/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, +/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, +/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, +/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } +/* harmony export */ }); +//Check if undefined, null, empty +const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; + +//Get Unique array values +const qsmUniqueArray = arr => { + if (qsmIsEmpty(arr) || !Array.isArray(arr)) { + return arr; + } + return arr.filter((val, index, arr) => arr.indexOf(val) === index); +}; + +//Match array of object values and return array of cooresponding matching keys +const qsmMatchingValueKeyArray = (values, obj) => { + if (qsmIsEmpty(obj) || !Array.isArray(values)) { + return values; + } + return values.map(val => Object.keys(obj).find(key => obj[key] == val)); +}; + +//Decode htmlspecialchars +const qsmDecodeHtml = html => { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return txt.value; +}; +const qsmSanitizeName = name => { + if (qsmIsEmpty(name)) { + name = ''; + } else { + name = name.toLowerCase().replace(/ /g, '_'); + name = name.replace(/\W/g, ''); + } + return name; +}; + +// Remove anchor tags from text content. +const qsmStripTags = text => { + let div = document.createElement("div"); + div.innerHTML = qsmDecodeHtml(text); + return div.innerText; +}; + +//prepare form data +const qsmFormData = (obj = false) => { + let newData = new FormData(); + //add to check if api call from editor + newData.append('qsm_block_api_call', '1'); + if (false !== obj) { + for (let k in obj) { + if (obj.hasOwnProperty(k)) { + newData.append(k, obj[k]); + } + } + } + return newData; +}; + +//add objecyt to form data +const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { + if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { + return data; + } + for (let key in valueObj) { + if (valueObj.hasOwnProperty(key)) { + let value = valueObj[key]; + if ('object' === value) { + qsmAddObjToFormData(formKey + '[' + key + ']', value, data); + } else { + data.append(formKey + '[' + key + ']', valueObj[key]); + } + } + } + return data; +}; + +//Generate random number +const qsmGenerateRandomKey = length => { + const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let key = ""; + + // Generate random bytes + const values = new Uint8Array(length); + window.crypto.getRandomValues(values); + for (let i = 0; i < length; i++) { + // Use the random byte to index into the charset + key += charset[values[i] % charset.length]; + } + return key; +}; + +//generate uiniq id +const qsmUniqid = (prefix = "", random = false) => { + const id = qsmGenerateRandomKey(8); + return `${prefix}${id}${random ? `.${qsmGenerateRandomKey(7)}` : ""}`; +}; + +//return data if not empty otherwise default value +const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; + +/***/ }), + +/***/ "./src/question/edit.js": +/*!******************************!*\ + !*** ./src/question/edit.js ***! + \******************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": function() { return /* binding */ Edit; } +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); +/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _component_FeaturedImage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../component/FeaturedImage */ "./src/component/FeaturedImage.js"); +/* harmony import */ var _component_SelectAddCategory__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../component/SelectAddCategory */ "./src/component/SelectAddCategory.js"); +/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../component/icon */ "./src/component/icon.js"); +/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); + + + + + + + + + + + + + + +//check for duplicate questionID attr +const isQuestionIDReserved = (questionIDCheck, clientIdCheck) => { + const blocksClientIds = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.select)('core/block-editor').getClientIdsWithDescendants(); + return (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(blocksClientIds) ? false : blocksClientIds.some(blockClientId => { + const { + questionID + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.select)('core/block-editor').getBlockAttributes(blockClientId); + //different Client Id but same questionID attribute means duplicate + return clientIdCheck !== blockClientId && questionID === questionIDCheck; + }); +}; + +/** + * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array + * + */ +function Edit(props) { + var _settings$file_upload; + //check for QSM initialize data + if ('undefined' === typeof qsmBlockData) { + return null; + } + const { + className, + attributes, + setAttributes, + isSelected, + clientId, + context + } = props; + + /** https://github.com/WordPress/gutenberg/issues/22282 */ + const isParentOfSelectedBlock = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => isSelected || select('core/block-editor').hasSelectedInnerBlock(clientId, true)); + const quizID = context['quiz-master-next/quizID']; + const { + quiz_name, + post_id, + rest_nonce + } = context['quiz-master-next/quizAttr']; + const pageID = context['quiz-master-next/pageID']; + const { + createNotice + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__.store); + + //Get finstion to find index of blocks + const { + getBlockRootClientId, + getBlockIndex + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.store); + + //Get funstion to insert block + const { + insertBlock + } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.store); + const { + isChanged = false, + //use in editor only to detect if any change occur in this block + questionID, + type, + description, + title, + correctAnswerInfo, + commentBox, + category, + multicategories = [], + hint, + featureImageID, + featureImageSrc, + answers, + answerEditor, + matchAnswer, + required, + settings = {} + } = attributes; + + //Variable to decide if correct answer info input field should be available + const [enableCorrectAnsInfo, setEnableCorrectAnsInfo] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(correctAnswerInfo)); + //Advance Question modal + const [isOpenAdvanceQModal, setIsOpenAdvanceQModal] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const proActivated = '1' == qsmBlockData.is_pro_activated; + const isAdvanceQuestionType = qtype => 14 < parseInt(qtype); + + //Available file types + const fileTypes = qsmBlockData.file_upload_type.options; + + //Get selected file types + const selectedFileTypes = () => { + let file_types = settings?.file_upload_type || qsmBlockData.file_upload_type.default; + return (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(file_types) ? [] : file_types.split(','); + }; + + //Is file type checked + const isCheckedFileType = fileType => selectedFileTypes().includes(fileType); + + //Set file type + const setFileTypes = fileType => { + let file_types = selectedFileTypes(); + if (file_types.includes(fileType)) { + file_types = file_types.filter(file_type => file_type != fileType); + } else { + file_types.push(fileType); + } + file_types = file_types.join(','); + setAttributes({ + settings: { + ...settings, + file_upload_type: file_types + } + }); + }; + + /**Generate question id if not set or in case duplicate questionID ***/ + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetID = true; + if (shouldSetID) { + if ((0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(questionID) || '0' == questionID || !(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(questionID) && isQuestionIDReserved(questionID, clientId)) { + //create a question + let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmFormData)({ + "id": null, + "rest_nonce": rest_nonce, + "quizID": quizID, + "quiz_name": quiz_name, + "postID": post_id, + "answerEditor": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(answerEditor, 'text'), + "type": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(type, '0'), + "name": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(description)), + "question_title": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(title), + "answerInfo": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(correctAnswerInfo)), + "comments": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(commentBox, '1'), + "hint": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(hint), + "category": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(category), + "multicategories": [], + "required": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(required, 0), + "answers": answers, + "page": 0, + "featureImageID": featureImageID, + "featureImageSrc": featureImageSrc, + "matchAnswer": null + }); + + //AJAX call + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: '/quiz-survey-master/v1/questions', + method: 'POST', + body: newQuestion + }).then(response => { + if ('success' == response.status) { + let question_id = response.id; + setAttributes({ + questionID: question_id + }); + } + }).catch(error => { + console.log('error', error); + createNotice('error', error.message, { + isDismissible: true, + type: 'snackbar' + }); + }); + } + } + + //cleanup + return () => { + shouldSetID = false; + }; + }, []); + + //detect change in question + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + let shouldSetChanged = true; + if (shouldSetChanged && isSelected && false === isChanged) { + setAttributes({ + isChanged: true + }); + } + + //cleanup + return () => { + shouldSetChanged = false; + }; + }, [questionID, type, description, title, correctAnswerInfo, commentBox, category, multicategories, hint, featureImageID, featureImageSrc, answers, answerEditor, matchAnswer, required, settings]); + + //add classes + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({ + className: isParentOfSelectedBlock ? ' in-editing-mode' : '' + }); + const QUESTION_TEMPLATE = [['qsm/quiz-answer-option', { + optionID: '0' + }], ['qsm/quiz-answer-option', { + optionID: '1' + }]]; + + //Get category ancestor + const getCategoryAncestors = (termId, categories) => { + let parents = []; + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(categories[termId]) && '0' != categories[termId]['parent']) { + termId = categories[termId]['parent']; + parents.push(termId); + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(categories[termId]) && '0' != categories[termId]['parent']) { + let ancestor = getCategoryAncestors(termId, categories); + parents = [...parents, ...ancestor]; + } + } + return (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmUniqueArray)(parents); + }; + + //check if a category is selected + const isCategorySelected = termId => multicategories.includes(termId); + + //set or unset category + const setUnsetCatgory = (termId, categories) => { + let multiCat = (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(multicategories) || 0 === multicategories.length ? (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(category) ? [] : [category] : multicategories; + + //Case: category unselected + if (multiCat.includes(termId)) { + //remove category if already set + multiCat = multiCat.filter(catID => catID != termId); + let children = []; + //check for if any child is selcted + multiCat.forEach(childCatID => { + //get ancestors of category + let ancestorIds = getCategoryAncestors(childCatID, categories); + //given unselected category is an ancestor of selected category + if (ancestorIds.includes(termId)) { + //remove category if already set + multiCat = multiCat.filter(catID => catID != childCatID); + } + }); + } else { + //add category if not set + multiCat.push(termId); + //get ancestors of category + let ancestorIds = getCategoryAncestors(termId, categories); + //select all ancestor + multiCat = [...multiCat, ...ancestorIds]; + } + multiCat = (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmUniqueArray)(multiCat); + setAttributes({ + category: '', + multicategories: [...multiCat] + }); + }; + + //Notes relation to question type + const notes = ['12', '7', '3', '5', '14'].includes(type) ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Note: Add only correct answer options with their respective points score.', 'quiz-master-next') : ''; + + //set Question type + const setQuestionType = qtype => { + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(MicroModal) && !proActivated && ['15', '16', '17'].includes(qtype)) { + //Show modal for advance question type + let modalEl = document.getElementById('modal-advanced-question-type'); + if (!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(modalEl)) { + MicroModal.show('modal-advanced-question-type'); + } + } else if (proActivated && isAdvanceQuestionType(qtype)) { + setIsOpenAdvanceQModal(true); + } else { + setAttributes({ + type: qtype + }); + } + }; + + //insert new Question + const insertNewQuestion = () => { + if ((0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(props?.name)) { + console.log("block name not found"); + return true; + } + const blockToInsert = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__.createBlock)(props.name); + const selectBlockOnInsert = true; + insertBlock(blockToInsert, getBlockIndex(clientId) + 1, getBlockRootClientId(clientId), selectBlockOnInsert); + }; + + //insert new Question + const insertNewPage = () => { + const blockToInsert = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__.createBlock)('qsm/quiz-page'); + const currentPageClientID = getBlockRootClientId(clientId); + const newPageIndex = getBlockIndex(currentPageClientID) + 1; + const qsmBlockClientID = getBlockRootClientId(currentPageClientID); + const selectBlockOnInsert = true; + insertBlock(blockToInsert, newPageIndex, qsmBlockClientID, selectBlockOnInsert); + }; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToolbarGroup, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToolbarButton, { + icon: "plus-alt2", + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Question', 'quiz-master-next'), + onClick: () => insertNewQuestion() + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToolbarButton, { + icon: "welcome-add-page", + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Page', 'quiz-master-next'), + onClick: () => insertNewPage() + }))), isOpenAdvanceQModal && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Modal, { + contentLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Use QSM Editor for Advanced Question', 'quiz-master-next'), + className: "qsm-advance-q-modal", + isDismissible: false, + size: "small", + __experimentalHideHeader: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "qsm-modal-body" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", { + className: "qsm-title" + }, (0,_component_icon__WEBPACK_IMPORTED_MODULE_10__.warningIcon)(), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("br", null), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Use QSM editor for Advanced Question', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { + className: "qsm-description" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.", "quiz-master-next")), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "qsm-modal-btn-wrapper" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { + variant: "secondary", + onClick: () => setIsOpenAdvanceQModal(false) + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Cancel', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { + variant: "primary", + onClick: () => {} + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ExternalLink, { + href: qsmBlockData.quiz_settings_url + '&quiz_id=' + quizID + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add Question from quiz editor', 'quiz-master-next')))))), isAdvanceQuestionType(type) ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question settings', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", { + className: "block-editor-block-card__title" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('ID', 'quiz-master-next') + ': ' + questionID), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advanced Question Type', 'quiz-master-next')))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h4", { + className: 'qsm-question-title qsm-error-text' + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advanced Question Type : ', 'quiz-master-next') + title), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Edit question in QSM ', 'quiz-master-next'), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ExternalLink, { + href: qsmBlockData.quiz_settings_url + '&quiz_id=' + quizID + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('editor', 'quiz-master-next'))))) : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question settings', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", { + className: "block-editor-block-card__title" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('ID', 'quiz-master-next') + ': ' + questionID), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + label: qsmBlockData.question_type.label, + value: type || qsmBlockData.question_type.default, + onChange: type => setQuestionType(type), + help: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(qsmBlockData.question_type_description[type]) ? '' : qsmBlockData.question_type_description[type] + ' ' + notes, + __nextHasNoMarginBottom: true + }, !(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(qsmBlockData.question_type.options) && qsmBlockData.question_type.options.map(qtypes => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("optgroup", { + label: qtypes.category, + key: "qtypes" + qtypes.category + }, qtypes.types.map(qtype => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("option", { + value: qtype.slug, + key: "qtype" + qtype.slug + }, qtype.name))))), ['0', '4', '1', '10', '13'].includes(type) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + label: qsmBlockData.answerEditor.label, + value: answerEditor || qsmBlockData.answerEditor.default, + options: qsmBlockData.answerEditor.options, + onChange: answerEditor => setAttributes({ + answerEditor + }), + __nextHasNoMarginBottom: true + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Required', 'quiz-master-next'), + checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(required) && '1' == required, + onChange: () => setAttributes({ + required: !(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(required) && '1' == required ? 0 : 1 + }) + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show Correct Answer Info', 'quiz-master-next'), + checked: enableCorrectAnsInfo, + onChange: () => setEnableCorrectAnsInfo(!enableCorrectAnsInfo) + })), '11' == type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('File Settings', 'quiz-master-next'), + initialOpen: false + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + type: "number", + label: qsmBlockData.file_upload_limit.heading, + value: (_settings$file_upload = settings?.file_upload_limit) !== null && _settings$file_upload !== void 0 ? _settings$file_upload : qsmBlockData.file_upload_limit.default, + onChange: limit => setAttributes({ + settings: { + ...settings, + file_upload_limit: limit + } + }) + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", { + className: "qsm-inspector-label" + }, qsmBlockData.file_upload_type.heading), Object.keys(qsmBlockData.file_upload_type.options).map(filetype => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.CheckboxControl, { + key: 'filetype-' + filetype, + label: fileTypes[filetype], + checked: isCheckedFileType(filetype), + onChange: () => setFileTypes(filetype) + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_SelectAddCategory__WEBPACK_IMPORTED_MODULE_9__["default"], { + isCategorySelected: isCategorySelected, + setUnsetCatgory: setUnsetCatgory + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hint', 'quiz-master-next'), + initialOpen: false + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { + label: "", + value: hint, + onChange: hint => setAttributes({ + hint: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmStripTags)(hint) + }) + })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: qsmBlockData.commentBox.heading, + initialOpen: false + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { + label: qsmBlockData.commentBox.label, + value: commentBox || qsmBlockData.commentBox.default, + options: qsmBlockData.commentBox.options, + onChange: commentBox => setAttributes({ + commentBox + }), + __nextHasNoMarginBottom: true + })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Featured image', 'quiz-master-next'), + initialOpen: true + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_FeaturedImage__WEBPACK_IMPORTED_MODULE_8__["default"], { + featureImageID: featureImageID, + onUpdateImage: mediaDetails => { + setAttributes({ + featureImageID: mediaDetails.id, + featureImageSrc: mediaDetails.url + }); + }, + onRemoveImage: id => { + setAttributes({ + featureImageID: undefined, + featureImageSrc: undefined + }); + } + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { + tagName: "h4", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Type your question here', 'quiz-master-next'), + value: title, + onChange: title => setAttributes({ + title: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmStripTags)(title) + }), + allowedFormats: [], + withoutInteractiveFormatting: true, + className: 'qsm-question-title' + }), isParentOfSelectedBlock && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { + tagName: "p", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Description goes here... (optional)', 'quiz-master-next'), + value: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmDecodeHtml)(description), + onChange: description => setAttributes({ + description + }), + className: 'qsm-question-description', + __unstableEmbedURLOnPaste: true, + __unstableAllowPrefixTransformations: true + }), !['8', '11', '6', '9'].includes(type) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { + allowedBlocks: ['qsm/quiz-answer-option'], + template: QUESTION_TEMPLATE + }), enableCorrectAnsInfo && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { + tagName: "p", + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), + "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct answer info goes here', 'quiz-master-next'), + value: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmDecodeHtml)(correctAnswerInfo), + onChange: correctAnswerInfo => setAttributes({ + correctAnswerInfo + }), + className: 'qsm-question-correct-answer-info', + __unstableEmbedURLOnPaste: true, + __unstableAllowPrefixTransformations: true + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { + icon: "plus-alt2", + onClick: () => insertNewQuestion(), + variant: "secondary", + className: "add-new-question-btn" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Question', 'quiz-master-next')))))); +} + +/***/ }), + +/***/ "@wordpress/api-fetch": +/*!**********************************!*\ + !*** external ["wp","apiFetch"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["apiFetch"]; + +/***/ }), + +/***/ "@wordpress/blob": +/*!******************************!*\ + !*** external ["wp","blob"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blob"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ (function(module) { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/core-data": +/*!**********************************!*\ + !*** external ["wp","coreData"] ***! + \**********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["coreData"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/hooks": +/*!*******************************!*\ + !*** external ["wp","hooks"] ***! + \*******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["hooks"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ (function(module) { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "@wordpress/notices": +/*!*********************************!*\ + !*** external ["wp","notices"] ***! + \*********************************/ +/***/ (function(module) { + +module.exports = window["wp"]["notices"]; + +/***/ }), + +/***/ "./src/question/block.json": +/*!*********************************!*\ + !*** ./src/question/block.json ***! + \*********************************/ +/***/ (function(module) { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-question","version":"0.1.0","title":"Question","category":"widgets","parent":["qsm/quiz-page"],"icon":"move","description":"QSM Quiz Question","attributes":{"isChanged":{"type":"string","default":false},"questionID":{"type":"string","default":"0"},"type":{"type":"string","default":"0"},"description":{"type":"string","source":"html","selector":"p","default":""},"title":{"type":"string","default":""},"correctAnswerInfo":{"type":"string","source":"html","selector":"p","default":""},"commentBox":{"type":"string","default":"1"},"category":{"type":"number"},"multicategories":{"type":"array"},"hint":{"type":"string"},"featureImageID":{"type":"number"},"featureImageSrc":{"type":"string"},"answers":{"type":"array"},"answerEditor":{"type":"string","default":"text"},"matchAnswer":{"type":"string","default":"random"},"required":{"type":"string","default":"0"},"media":{"type":"object"},"settings":{"type":"object"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/quizAttr"],"providesContext":{"quiz-master-next/questionID":"questionID","quiz-master-next/questionType":"type","quiz-master-next/answerType":"answerEditor","quiz-master-next/questionChanged":"isChanged"},"example":{},"supports":{"html":false,"anchor":true,"className":true,"interactivity":{"clientNavigation":true}},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { +/*!*******************************!*\ + !*** ./src/question/index.js ***! + \*******************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/question/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/question/block.json"); +/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../component/icon */ "./src/component/icon.js"); + + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { + icon: _component_icon__WEBPACK_IMPORTED_MODULE_3__.questionBlockIcon, + /** + * @see ./edit.js + */ + edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], + __experimentalLabel(attributes, { + context + }) { + const { + title + } = attributes; + const customName = attributes?.metadata?.name; + const hasContent = title?.length > 0; + + // In the list view, use the question title as the label. + // If the title is empty, fall back to the default label. + if (context === 'list-view' && (customName || hasContent)) { + return customName || title; + } + } +}); +}(); +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/build/question/index.js.map b/blocks/build/question/index.js.map new file mode 100644 index 000000000..d24d91dd2 --- /dev/null +++ b/blocks/build/question/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"question/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAC8C;AACE;AASjB;AACa;AACqB;AACN;AACgC;AAK1D;AACyB;AACnB;AAEvC,MAAM2B,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG5B,mDAAE,CAAE,gBAAiB,CAAC;AAC1D,MAAM6B,+BAA+B,GAAG7B,mDAAE,CAAE,oBAAqB,CAAC;AAElE,MAAM8B,YAAY,GACjBC,iEAAA,YACG/B,mDAAE,CACH,kEACD,CACE,CACH;AAED,MAAMgC,aAAa,GAAGA,CAAE;EACvBC,cAAc;EACdC,aAAa;EACbC;AACD,CAAC,KAAM;EACN,MAAM;IAA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;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AACkB;AAEtDmW,oEAAiB,CAAEC,6CAAa,EAAE;EACjC7L,IAAI,EAACM,8DAAiB;EACtB;AACD;AACA;EACCwL,IAAI,EAAE5G,6CAAI;EACV6G,mBAAmBA,CAAE1G,UAAU,EAAE;IAAEI;EAAQ,CAAC,EAAG;IAC9C,MAAM;MAAE7L;IAAM,CAAC,GAAGyL,UAAU;IAE5B,MAAM2G,UAAU,GAAG3G,UAAU,EAAEwG,QAAQ,EAAExN,IAAI;IAC7C,MAAM4N,UAAU,GAAGrS,KAAK,EAAEmD,MAAM,GAAG,CAAC;;IAEpC;IACA;IACA,IAAK0I,OAAO,KAAK,WAAW,KAAMuG,UAAU,IAAIC,UAAU,CAAE,EAAG;MAC9D,OAAOD,UAAU,IAAIpS,KAAK;IAC3B;EACD;AACD,CAAE,CAAC,C","sources":["webpack://qsm/./src/component/FeaturedImage.js","webpack://qsm/./src/component/SelectAddCategory.js","webpack://qsm/./src/component/icon.js","webpack://qsm/./src/helper.js","webpack://qsm/./src/question/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blob\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"hooks\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/question/index.js"],"sourcesContent":["/**\r\n * WordPress dependencies\r\n */\r\nimport { __, sprintf } from '@wordpress/i18n';\r\nimport { applyFilters } from '@wordpress/hooks';\r\nimport {\r\n\tDropZone,\r\n\tButton,\r\n\tSpinner,\r\n\tResponsiveWrapper,\r\n\twithNotices,\r\n\twithFilters,\r\n\t__experimentalHStack as HStack,\r\n} from '@wordpress/components';\r\nimport { isBlobURL } from '@wordpress/blob';\r\nimport { useState, useRef, useEffect } from '@wordpress/element';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect, select, withDispatch, withSelect } from '@wordpress/data';\r\nimport {\r\n\tMediaUpload,\r\n\tMediaUploadCheck,\r\n\tstore as blockEditorStore,\r\n} from '@wordpress/block-editor';\r\nimport { store as coreStore } from '@wordpress/core-data';\r\nimport { qsmIsEmpty } from '../helper';\r\n\r\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\r\n\r\n// Used when labels from post type were not yet loaded or when they are not present.\r\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\r\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\r\n\r\nconst instructions = (\r\n\t

\r\n\t\t{ __(\r\n\t\t\t'To edit the featured image, you need permission to upload media.'\r\n\t\t) }\r\n\t

\r\n);\r\n\r\nconst FeaturedImage = ( {\r\n\tfeatureImageID,\r\n\tonUpdateImage,\r\n\tonRemoveImage\r\n} ) => {\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\tconst toggleRef = useRef();\r\n\tconst [ isLoading, setIsLoading ] = useState( false );\r\n\tconst [ media, setMedia ] = useState( undefined );\r\n\tconst { mediaFeature, mediaUpload } = useSelect( ( select ) => {\r\n\t\tconst { getMedia } = select( coreStore );\r\n\t\t\treturn {\r\n\t\t\t\tmediaFeature: qsmIsEmpty( media ) && ! qsmIsEmpty( featureImageID ) && getMedia( featureImageID ),\r\n\t\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload \r\n\t\t\t};\r\n\t}, [] );\r\n\r\n\t/**Set media data */\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetQSMAttr = true;\r\n\t\tif ( shouldSetQSMAttr ) {\r\n\t\t\tif ( ! qsmIsEmpty( mediaFeature ) && 'object' === typeof mediaFeature ) {\r\n\t\t\t\tsetMedia({\r\n\t\t\t\t\tid: featureImageID,\r\n\t\t\t\t\twidth: mediaFeature.media_details.width, \r\n\t\t\t\t\theight: mediaFeature.media_details.height, \r\n\t\t\t\t\turl: mediaFeature.source_url,\r\n\t\t\t\t\talt_text: mediaFeature.alt_text,\r\n\t\t\t\t\tslug: mediaFeature.slug\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetQSMAttr = false;\r\n\t\t};\r\n\t\t\r\n\t}, [ mediaFeature ] );\r\n\r\n\tfunction onDropFiles( filesList ) {\r\n\t\tmediaUpload( {\r\n\t\t\tallowedTypes: [ 'image' ],\r\n\t\t\tfilesList,\r\n\t\t\tonFileChange( [ image ] ) {\r\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\r\n\t\t\t\t\tsetIsLoading( true );\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tonUpdateImage( image );\r\n\t\t\t\tsetIsLoading( false );\r\n\t\t\t},\r\n\t\t\tonError( message ) {\r\n\t\t\t\tcreateNotice( 'error', message, {\r\n\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t} );\r\n\t\t\t},\r\n\t\t} );\r\n\t}\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t{ media && (\r\n\t\t\t\t\r\n\t\t\t\t\t{ media.alt_text &&\r\n\t\t\t\t\t\tsprintf(\r\n\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\r\n\t\t\t\t\t\t\t__( 'Current image: %s' ),\r\n\t\t\t\t\t\t\tmedia.alt_text\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t\t{ ! media.alt_text &&\r\n\t\t\t\t\t\tsprintf(\r\n\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\r\n\t\t\t\t\t\t\t__(\r\n\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\r\n\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\tmedia.slug\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t
\r\n\t\t\t) }\r\n\t\t\t\r\n\t\t\t\t { \r\n\t\t\t\t\t\tsetMedia( media );\r\n\t\t\t\t\t\tonUpdateImage( media );\r\n\t\t\t\t\t} }\r\n\t\t\t\t\tunstableFeaturedImageFlow\r\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\r\n\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\r\n\t\t\t\t\trender={ ( { open } ) => (\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t{ !! featureImageID && media && (\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\t\t{ isLoading && }\r\n\t\t\t\t\t\t\t\t{ ! featureImageID &&\r\n\t\t\t\t\t\t\t\t\t! isLoading &&\r\n\t\t\t\t\t\t\t\t\t(\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t{ !! featureImageID && (\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\r\n\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\r\n\t\t\t\t\t\t\t\t\t\t} }\r\n\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t) }\r\n\t\t\t\t\tvalue={ featureImageID }\r\n\t\t\t\t/>\r\n\t\t\t
\r\n\t\t
\r\n\t);\r\n}\r\n\r\nexport default FeaturedImage;","/**\r\n * Select or add a category\r\n */\r\nimport { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tPanelBody,\r\n Button,\r\n TreeSelect,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tRangeControl,\r\n\tRadioControl,\r\n\tSelectControl,\r\n\tCheckboxControl,\r\n Flex,\r\n FlexItem,\r\n} from '@wordpress/components';\r\nimport { qsmIsEmpty, qsmFormData } from '../helper';\r\n\r\nconst SelectAddCategory = ({\r\n isCategorySelected,\r\n setUnsetCatgory\r\n}) => {\r\n\r\n //whether showing add category form\r\n\tconst [ showForm, setShowForm ] = useState( false );\r\n //new category name\r\n const [ formCatName, setFormCatName ] = useState( '' );\r\n //new category prent id\r\n const [ formCatParent, setFormCatParent ] = useState( 0 );\r\n //new category adding start status\r\n const [ addingNewCategory, setAddingNewCategory ] = useState( false );\r\n //error\r\n const [ newCategoryError, setNewCategoryError ] = useState( false );\r\n //category list \r\n const [ categories, setCategories ] = useState( qsmBlockData?.hierarchicalCategoryList );\r\n\r\n //get category id-details object \r\n const getCategoryIdDetailsObject = ( categories ) => {\r\n let catObj = {};\r\n categories.forEach( cat => {\r\n catObj[ cat.id ] = cat;\r\n if ( 0 < cat.children.length ) {\r\n let childCategory = getCategoryIdDetailsObject( cat.children );\r\n catObj = { ...catObj, ...childCategory };\r\n }\r\n });\r\n return catObj;\r\n }\r\n\r\n //category id wise details\r\n const [ categoryIdDetails, setCategoryIdDetails ] = useState( qsmIsEmpty( qsmBlockData?.hierarchicalCategoryList ) ? {} : getCategoryIdDetailsObject( qsmBlockData.hierarchicalCategoryList ) );\r\n\r\n const addNewCategoryLabel = __( 'Add New Category ', 'quiz-master-next' );\r\n const noParentOption = `— ${ __( 'Parent Category ', 'quiz-master-next' ) } —`;\r\n\r\n //Add new category\r\n const onAddCategory = async ( event ) => {\r\n\t\tevent.preventDefault();\r\n\t\tif ( newCategoryError || qsmIsEmpty( formCatName ) || addingNewCategory ) {\r\n\t\t\treturn;\r\n\t\t}\r\n setAddingNewCategory( true );\r\n\r\n //create a page\r\n apiFetch( {\r\n url: qsmBlockData.ajax_url,\r\n method: 'POST',\r\n body: qsmFormData({\r\n 'action': 'save_new_category',\r\n 'name': formCatName,\r\n 'parent': formCatParent \r\n })\r\n } ).then( ( res ) => {\r\n if ( ! qsmIsEmpty( res.term_id ) ) {\r\n let term_id = res.term_id;\r\n //console.log(\"save_new_category\",res);\r\n //set category list\r\n apiFetch( {\r\n path: '/quiz-survey-master/v1/quiz/hierarchical-category-list',\r\n method: 'POST'\r\n } ).then( ( res ) => {\r\n // console.log(\"new categorieslist\", res);\r\n if ( 'success' == res.status ) {\r\n setCategories( res.result );\r\n setCategoryIdDetails( res.result );\r\n //set form\r\n setFormCatName( '' );\r\n setFormCatParent( 0 );\r\n //set category selected\r\n setUnsetCatgory( term_id, getCategoryIdDetailsObject( term.id ) );\r\n setAddingNewCategory( false );\r\n }\r\n });\r\n \r\n }\r\n \r\n });\r\n }\r\n\r\n //get category name array\r\n const getCategoryNameArray = ( categories ) => {\r\n let cats = [];\r\n categories.forEach( cat => {\r\n cats.push( cat.name );\r\n if ( 0 < cat.children.length ) {\r\n let childCategory = getCategoryNameArray( cat.children );\r\n cats = [ ...cats, ...childCategory ];\r\n }\r\n });\r\n return cats;\r\n }\r\n\r\n //check if category name already exists and set new category name\r\n const checkSetNewCategory = ( catName, categories ) => {\r\n categories = getCategoryNameArray( categories );\r\n console.log( \"categories\", categories );\r\n if ( categories.includes( catName ) ) {\r\n setNewCategoryError( catName );\r\n } else {\r\n setNewCategoryError( false );\r\n setFormCatName( catName );\r\n }\r\n // categories.forEach( cat => {\r\n // if ( cat.name == catName ) {\r\n // matchName = true;\r\n // return false;\r\n // } else if ( 0 < cat.children.length ) {\r\n // checkSetNewCategory( catName, cat.children )\r\n // }\r\n // });\r\n \r\n // if ( matchName ) {\r\n // setNewCategoryError( matchName );\r\n // } else {\r\n // setNewCategoryError( matchName );\r\n // setFormCatName( catName );\r\n // }\r\n }\r\n\r\n const renderTerms = ( categories ) => {\r\n\t\treturn categories.map( ( term ) => {\r\n\t\t\treturn (\r\n\t\t\t\t\r\n\t\t\t\t\t setUnsetCatgory( term.id, categoryIdDetails ) }\r\n />\r\n\t\t\t\t\t{ !! term.children.length && (\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t{ renderTerms( term.children ) }\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t) }\r\n\t\t\t\t
\r\n\t\t\t);\r\n\t\t} );\r\n\t};\r\n \r\n return(\r\n \r\n \r\n\t\t\t\t{ renderTerms( categories ) }\r\n\t\t\t
\r\n
\r\n \r\n
\r\n { showForm && (\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t checkSetNewCategory( formCatName, categories ) }\r\n\t\t\t\t\t\t\trequired\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t{ 0 < categories.length && (\r\n\t\t\t\t\t\t\t setFormCatParent( id ) }\r\n\t\t\t\t\t\t\t\tselectedId={ formCatParent }\r\n\t\t\t\t\t\t\t\ttree={ categories }\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t{ addNewCategoryLabel }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n \r\n

\r\n { false !== newCategoryError && __( 'Category ', 'quiz-master-next' ) + newCategoryError + __( ' already exists.', 'quiz-master-next' ) }\r\n

\r\n
\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t) }\r\n\t\t\r\n );\r\n}\r\n\r\nexport default SelectAddCategory;","import { Icon } from '@wordpress/components';\r\n//QSM Quiz Block\r\nexport const qsmBlockIcon = () => (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Warning icon\r\nexport const warningIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n//Match array of object values and return array of cooresponding matching keys \r\nexport const qsmMatchingValueKeyArray = ( values, obj ) => {\r\n\tif ( qsmIsEmpty( obj ) || ! Array.isArray( values ) ) {\r\n\t\treturn values;\r\n\t}\r\n\treturn values.map( ( val ) => Object.keys(obj).find( key => obj[key] == val) );\r\n}\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//Generate random number\r\nexport const qsmGenerateRandomKey = (length) => {\r\n const charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n let key = \"\";\r\n\r\n // Generate random bytes\r\n const values = new Uint8Array(length);\r\n window.crypto.getRandomValues(values);\r\n\r\n for (let i = 0; i < length; i++) {\r\n // Use the random byte to index into the charset\r\n key += charset[values[i] % charset.length];\r\n }\r\n\r\n return key;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const id = qsmGenerateRandomKey(8);\r\n return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(7) }`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tInspectorControls,\r\n\tRichText,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n\tstore as blockEditorStore,\r\n\tBlockControls,\r\n} from '@wordpress/block-editor';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect, select } from '@wordpress/data';\r\nimport { createBlock } from '@wordpress/blocks';\r\nimport {\r\n\tPanelBody,\r\n\tToggleControl,\r\n\tSelectControl,\r\n\tToolbarGroup, \r\n\tToolbarButton,\r\n\tTextControl,\r\n\tCheckboxControl,\r\n\tFormTokenField,\r\n\tButton,\r\n\tExternalLink,\r\n\tModal\r\n} from '@wordpress/components';\r\nimport FeaturedImage from '../component/FeaturedImage';\r\nimport SelectAddCategory from '../component/SelectAddCategory';\r\nimport { warningIcon } from \"../component/icon\";\r\nimport { qsmIsEmpty, qsmStripTags, qsmFormData, qsmValueOrDefault, qsmDecodeHtml, qsmUniqueArray, qsmMatchingValueKeyArray } from '../helper';\r\n\r\n\r\n//check for duplicate questionID attr\r\nconst isQuestionIDReserved = ( questionIDCheck, clientIdCheck ) => {\r\n const blocksClientIds = select( 'core/block-editor' ).getClientIdsWithDescendants();\r\n return qsmIsEmpty( blocksClientIds ) ? false : blocksClientIds.some( ( blockClientId ) => {\r\n const { questionID } = select( 'core/block-editor' ).getBlockAttributes( blockClientId );\r\n\t\t//different Client Id but same questionID attribute means duplicate\r\n return clientIdCheck !== blockClientId && questionID === questionIDCheck;\r\n } );\r\n};\r\n\r\n/**\r\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\r\n * \r\n */\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\t\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\r\n\r\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\r\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\tconst {\r\n\t\tquiz_name,\r\n\t\tpost_id,\r\n\t\trest_nonce\r\n\t} = context['quiz-master-next/quizAttr'];\r\n\tconst pageID = context['quiz-master-next/pageID'];\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\r\n\t//Get finstion to find index of blocks\r\n\tconst { \r\n\t\tgetBlockRootClientId, \r\n\t\tgetBlockIndex \r\n\t} = useSelect( blockEditorStore );\r\n\r\n\t//Get funstion to insert block\r\n\tconst {\r\n\t\tinsertBlock\r\n\t} = useDispatch( blockEditorStore );\r\n\r\n\tconst {\r\n\t\tisChanged = false,//use in editor only to detect if any change occur in this block\r\n\t\tquestionID,\r\n\t\ttype,\r\n\t\tdescription,\r\n\t\ttitle,\r\n\t\tcorrectAnswerInfo,\r\n\t\tcommentBox,\r\n\t\tcategory,\r\n\t\tmulticategories=[],\r\n\t\thint,\r\n\t\tfeatureImageID,\r\n\t\tfeatureImageSrc,\r\n\t\tanswers,\r\n\t\tanswerEditor,\r\n\t\tmatchAnswer,\r\n\t\trequired,\r\n\t\tsettings={},\r\n\t} = attributes;\r\n\t\r\n\t//Variable to decide if correct answer info input field should be available \r\n\tconst [ enableCorrectAnsInfo, setEnableCorrectAnsInfo ] = useState( ! qsmIsEmpty( correctAnswerInfo ) );\r\n\t//Advance Question modal\r\n\tconst [ isOpenAdvanceQModal, setIsOpenAdvanceQModal ] = useState( false );\r\n\r\n\tconst proActivated = ( '1' == qsmBlockData.is_pro_activated );\r\n\tconst isAdvanceQuestionType = ( qtype ) => 14 < parseInt( qtype );\r\n\r\n\t//Available file types\r\n\tconst fileTypes = qsmBlockData.file_upload_type.options;\r\n\r\n\t//Get selected file types\r\n\tconst selectedFileTypes = () => {\r\n\t\tlet file_types = settings?.file_upload_type || qsmBlockData.file_upload_type.default;\r\n\t\treturn qsmIsEmpty( file_types ) ? [] : file_types.split(',');\r\n\t}\r\n\r\n\t//Is file type checked\r\n\tconst isCheckedFileType = ( fileType ) => selectedFileTypes().includes( fileType );\r\n\r\n\t//Set file type\r\n\tconst setFileTypes = ( fileType ) => {\r\n\t\tlet file_types = selectedFileTypes();\r\n\t\tif ( file_types.includes( fileType ) ) {\r\n\t\t\tfile_types = file_types.filter( file_type => file_type != fileType );\r\n\t\t} else {\r\n\t\t\tfile_types.push( fileType );\r\n\t\t}\r\n\t\tfile_types = file_types.join(',');\r\n\t\tsetAttributes({\r\n\t\t\tsettings:{\r\n\t\t\t\t...settings,\r\n\t\t\t\tfile_upload_type: file_types\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\t\r\n\t/**Generate question id if not set or in case duplicate questionID ***/\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetID = true;\r\n\t\tif ( shouldSetID ) {\r\n\t\t\r\n\t\t\tif ( qsmIsEmpty( questionID ) || '0' == questionID || ( ! qsmIsEmpty( questionID ) && isQuestionIDReserved( questionID, clientId ) ) ) {\r\n\t\t\t\t\r\n\t\t\t\t//create a question\r\n\t\t\t\tlet newQuestion = qsmFormData( {\r\n\t\t\t\t\t\"id\": null,\r\n\t\t\t\t\t\"rest_nonce\": rest_nonce,\r\n\t\t\t\t\t\"quizID\": quizID,\r\n\t\t\t\t\t\"quiz_name\": quiz_name,\r\n\t\t\t\t\t\"postID\": post_id,\r\n\t\t\t\t\t\"answerEditor\": qsmValueOrDefault( answerEditor, 'text' ),\r\n\t\t\t\t\t\"type\": qsmValueOrDefault( type , '0' ),\r\n\t\t\t\t\t\"name\": qsmDecodeHtml( qsmValueOrDefault( description ) ),\r\n\t\t\t\t\t\"question_title\": qsmValueOrDefault( title ),\r\n\t\t\t\t\t\"answerInfo\": qsmDecodeHtml( qsmValueOrDefault( correctAnswerInfo ) ),\r\n\t\t\t\t\t\"comments\": qsmValueOrDefault( commentBox, '1' ),\r\n\t\t\t\t\t\"hint\": qsmValueOrDefault( hint ),\r\n\t\t\t\t\t\"category\": qsmValueOrDefault( category ),\r\n\t\t\t\t\t\"multicategories\": [],\r\n\t\t\t\t\t\"required\": qsmValueOrDefault( required, 0 ),\r\n\t\t\t\t\t\"answers\": answers,\r\n\t\t\t\t\t\"page\": 0,\r\n\t\t\t\t\t\"featureImageID\": featureImageID,\r\n\t\t\t\t\t\"featureImageSrc\": featureImageSrc,\r\n\t\t\t\t\t\"matchAnswer\": null,\r\n\t\t\t\t} );\r\n\r\n\t\t\t\t//AJAX call\r\n\t\t\t\tapiFetch( {\r\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\r\n\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\tbody: newQuestion\r\n\t\t\t\t} ).then( ( response ) => {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ( 'success' == response.status ) {\r\n\t\t\t\t\t\tlet question_id = response.id;\r\n\t\t\t\t\t\tsetAttributes( { questionID: question_id } );\r\n\t\t\t\t\t}\r\n\t\t\t\t}).catch(\r\n\t\t\t\t\t( error ) => {\r\n\t\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetID = false;\r\n\t\t};\r\n\t\t\r\n\t}, [] );\r\n\r\n\t//detect change in question\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetChanged = true;\r\n\t\tif ( shouldSetChanged && isSelected && false === isChanged ) {\r\n\t\t\t\r\n\t\t\tsetAttributes( { isChanged: true } );\r\n\t\t}\r\n\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetChanged = false;\r\n\t\t};\r\n\t}, [\r\n\t\tquestionID,\r\n\t\ttype,\r\n\t\tdescription,\r\n\t\ttitle,\r\n\t\tcorrectAnswerInfo,\r\n\t\tcommentBox,\r\n\t\tcategory,\r\n\t\tmulticategories,\r\n\t\thint,\r\n\t\tfeatureImageID,\r\n\t\tfeatureImageSrc,\r\n\t\tanswers,\r\n\t\tanswerEditor,\r\n\t\tmatchAnswer,\r\n\t\trequired,\r\n\t\tsettings,\r\n\t] )\r\n\r\n\t//add classes\r\n\tconst blockProps = useBlockProps( {\r\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\r\n\t} );\r\n\r\n\tconst QUESTION_TEMPLATE = [\r\n\t\t[\r\n\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t{\r\n\t\t\t\toptionID:'0'\r\n\t\t\t}\r\n\t\t],\r\n\t\t[\r\n\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t{\r\n\t\t\t\toptionID:'1'\r\n\t\t\t}\r\n\t\t]\r\n\r\n\t];\r\n\r\n\t//Get category ancestor\r\n\tconst getCategoryAncestors = ( termId, categories ) => {\r\n\t\tlet parents = [];\r\n\t\tif ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) {\r\n\t\t\ttermId = categories[ termId ]['parent'];\r\n\t\t\tparents.push( termId );\r\n\t\t\tif ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) {\r\n\t\t\t\tlet ancestor = getCategoryAncestors( termId, categories );\r\n\t\t\t\tparents = [ ...parents, ...ancestor ];\r\n\t\t\t}\r\n\t\t} \r\n\t\t\r\n\t\treturn qsmUniqueArray( parents );\r\n\t }\r\n\r\n\t//check if a category is selected\r\n\tconst isCategorySelected = ( termId ) => multicategories.includes( termId );\r\n\r\n\t//set or unset category\r\n\tconst setUnsetCatgory = ( termId, categories ) => {\r\n\t\tlet multiCat = ( qsmIsEmpty( multicategories ) || 0 === multicategories.length ) ? ( qsmIsEmpty( category ) ? [] : [ category ] ) : multicategories;\r\n\t\t\r\n\t\t//Case: category unselected\r\n\t\tif ( multiCat.includes( termId ) ) {\r\n\t\t\t//remove category if already set\r\n\t\t\tmultiCat = multiCat.filter( catID => catID != termId );\r\n\t\t\tlet children = [];\r\n\t\t\t//check for if any child is selcted \r\n\t\t\tmultiCat.forEach( childCatID => {\r\n\t\t\t\t//get ancestors of category\r\n\t\t\t\tlet ancestorIds = getCategoryAncestors( childCatID, categories );\r\n\t\t\t\t//given unselected category is an ancestor of selected category\r\n\t\t\t\tif ( ancestorIds.includes( termId ) ) {\r\n\t\t\t\t\t//remove category if already set\r\n\t\t\t\t\tmultiCat = multiCat.filter( catID => catID != childCatID );\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t//add category if not set\r\n\t\t\tmultiCat.push( termId );\r\n\t\t\t//get ancestors of category\r\n\t\t\tlet ancestorIds = getCategoryAncestors( termId, categories );\r\n\t\t\t//select all ancestor\r\n\t\t\tmultiCat = [ ...multiCat, ...ancestorIds ];\r\n\t\t}\r\n\r\n\t\tmultiCat = qsmUniqueArray( multiCat );\r\n\r\n\t\tsetAttributes({ \r\n\t\t\tcategory: '',\r\n\t\t\tmulticategories: [ ...multiCat ]\r\n\t\t});\r\n\t}\r\n\r\n\t//Notes relation to question type\r\n\tconst notes = ['12','7','3','5','14'].includes( type ) ? __( 'Note: Add only correct answer options with their respective points score.', 'quiz-master-next' ) : '';\r\n\r\n\t//set Question type\r\n\tconst setQuestionType = ( qtype ) => {\r\n\t\tif ( ! qsmIsEmpty( MicroModal ) && ! proActivated && ['15', '16', '17'].includes( qtype ) ) {\r\n\t\t\t//Show modal for advance question type\r\n\t\t\tlet modalEl = document.getElementById('modal-advanced-question-type');\r\n\t\t\tif ( ! qsmIsEmpty( modalEl ) ) {\r\n\t\t\t\tMicroModal.show('modal-advanced-question-type');\r\n\t\t\t}\r\n\t\t} else if ( proActivated && isAdvanceQuestionType( qtype ) ) {\r\n\t\t\tsetIsOpenAdvanceQModal( true );\r\n\t\t} else {\r\n\t\t\tsetAttributes( { type: qtype } );\r\n\t\t}\r\n\t}\r\n\r\n\t//insert new Question\r\n\tconst insertNewQuestion = () => {\r\n\t\tif ( qsmIsEmpty( props?.name )) {\r\n\t\t\tconsole.log(\"block name not found\");\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tconst blockToInsert = createBlock( props.name );\r\n\t\r\n\t\tconst selectBlockOnInsert = true;\r\n\t\tinsertBlock(\r\n\t\t\tblockToInsert,\r\n\t\t\tgetBlockIndex( clientId ) + 1,\r\n\t\t\tgetBlockRootClientId( clientId ),\r\n\t\t\tselectBlockOnInsert\r\n\t\t);\r\n\t}\r\n\r\n\t//insert new Question\r\n\tconst insertNewPage = () => {\r\n\t\tconst blockToInsert = createBlock( 'qsm/quiz-page' );\r\n\t\tconst currentPageClientID = getBlockRootClientId( clientId );\r\n\t\tconst newPageIndex = getBlockIndex( currentPageClientID ) + 1;\r\n\t\tconst qsmBlockClientID = getBlockRootClientId( currentPageClientID );\r\n\t\tconst selectBlockOnInsert = true;\r\n\t\tinsertBlock(\r\n\t\t\tblockToInsert,\r\n\t\t\tnewPageIndex,\r\n\t\t\tqsmBlockClientID,\r\n\t\t\tselectBlockOnInsert\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t<>\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t insertNewQuestion() }\r\n\t\t\t\t/>\r\n\t\t\t\t insertNewPage() }\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t\r\n\t{ isOpenAdvanceQModal && (\r\n\t\t\r\n\t\t\t
\r\n\t\t\t\t

\r\n\t\t\t\t\t{ warningIcon() }\r\n\t\t\t\t\t
\r\n\t\t\t\t\t{ __( 'Use QSM editor for Advanced Question', 'quiz-master-next' ) }\r\n\t\t\t\t

\r\n\t\t\t\t

\r\n\t\t\t\t\t{ __( \"Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.\", \"quiz-master-next\" ) }\r\n\t\t\t\t

\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t\r\n\t\t
\r\n\t) }\r\n\t { isAdvanceQuestionType( type ) ? (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\r\n\t\t\t\t\t

{ __( 'Advanced Question Type', 'quiz-master-next' ) }

\r\n\t\t\t\t
\r\n\t\t\t
\t\r\n\t\t\t
\r\n\t\t\t

{ __( 'Advanced Question Type : ', 'quiz-master-next' ) + title }

\r\n\t\t\t

\r\n\t\t\t{ __( 'Edit question in QSM ', 'quiz-master-next' ) }\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t
\r\n\t\t\r\n\t\t):(\r\n\t\t<>\r\n\t\t\r\n\t\t\t\r\n\t\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\r\n\t\t\t{ /** Question Type **/ }\r\n\t\t\t\r\n\t\t\t\t\tsetQuestionType( type )\r\n\t\t\t\t}\r\n\t\t\t\thelp={ qsmIsEmpty( qsmBlockData.question_type_description[ type ] ) ? '' : qsmBlockData.question_type_description[ type ]+' '+notes }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t>\r\n\t\t\t\t{\r\n\t\t\t\t! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \r\n\t\t\t\t\t(\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tqtypes.types.map( qtype => \r\n\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t)\r\n\t\t\t\t\t)\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t{/**Answer Type */}\r\n\t\t\t{\r\n\t\t\t\t['0','4','1','10','13'].includes( type ) && \r\n\t\t\t\t\r\n\t\t\t\t\t\tsetAttributes( { answerEditor } )\r\n\t\t\t\t\t}\r\n\t\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\t setAttributes( { required : ( ( ! qsmIsEmpty( required ) && '1' == required ) ? 0 : 1 ) } ) }\r\n\t\t\t/>\r\n\t\t\t setEnableCorrectAnsInfo( ! enableCorrectAnsInfo ) }\r\n\t\t\t/>\r\n\t\t\t
\r\n\t\t\t{/**File Upload */}\r\n\t\t\t{ '11' == type && (\r\n\t\t\t\t\r\n\t\t\t\t{/**Upload Limit */}\r\n\t\t\t\t setAttributes( { settings:{\r\n\t\t\t\t\t\t...settings,\r\n\t\t\t\t\t\tfile_upload_limit: limit\r\n\t\t\t\t\t} } ) }\r\n\t\t\t\t/>\r\n\t\t\t\t{/**Allowed File Type */}\r\n\t\t\t\t\r\n\t\t\t\t{\r\n\t\t\t\t\tObject.keys( qsmBlockData.file_upload_type.options ).map( filetype => (\r\n\t\t\t\t\t\t setFileTypes( filetype ) }\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t) )\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t)}\r\n\t\t\t{/**Categories */}\r\n\t\t\t\r\n\t\t\t{/**Hint */}\r\n\t\t\t\r\n\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\r\n\t\t\t/>\r\n\t\t\t\r\n\t\t\t{/**Comment Box */}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\tsetAttributes( { commentBox } )\r\n\t\t\t\t}\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t\t\r\n\t\t\t{/**Feature Image */}\r\n\t\t\t\r\n\t\t\t\t {\r\n\t\t\t\t\tsetAttributes({ \r\n\t\t\t\t\t\tfeatureImageID: mediaDetails.id,\r\n\t\t\t\t\t\tfeatureImageSrc: mediaDetails.url\r\n\t\t\t\t\t});\r\n\t\t\t\t} }\r\n\t\t\t\tonRemoveImage={ ( id ) => {\r\n\t\t\t\t\tsetAttributes({ \r\n\t\t\t\t\t\tfeatureImageID: undefined,\r\n\t\t\t\t\t\tfeatureImageSrc: undefined,\r\n\t\t\t\t\t});\r\n\t\t\t\t} }\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t
\r\n\t\t
\r\n\t\t\t setAttributes( { title: qsmStripTags( title ) } ) }\r\n\t\t\t\tallowedFormats={ [ ] }\r\n\t\t\t\twithoutInteractiveFormatting\r\n\t\t\t\tclassName={ 'qsm-question-title' }\r\n\t\t\t/>\r\n\t\t\t{\r\n\t\t\t\tisParentOfSelectedBlock && \r\n\t\t\t\t<>\r\n\t\t\t\t setAttributes({ description }) }\r\n\t\t\t\t\tclassName={ 'qsm-question-description' }\r\n\t\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t\t/>\r\n\t\t\t\t{\r\n\t\t\t\t\t! ['8','11','6','9'].includes( type ) &&\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t{\r\n\t\t\t\t\tenableCorrectAnsInfo && (\r\n\t\t\t\t\t\t setAttributes({ correctAnswerInfo }) }\r\n\t\t\t\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\r\n\t\t\t\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t)\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t
\r\n\t\t\r\n\t\t)\r\n\t}\r\n\t\r\n\t);\r\n}\r\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blob\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"hooks\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { questionBlockIcon } from \"../component/icon\";\r\n\r\nregisterBlockType( metadata.name, {\r\n\ticon:questionBlockIcon,\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n\t__experimentalLabel( attributes, { context } ) {\r\n\t\tconst { title } = attributes;\r\n\r\n\t\tconst customName = attributes?.metadata?.name;\r\n\t\tconst hasContent = title?.length > 0;\r\n\r\n\t\t// In the list view, use the question title as the label.\r\n\t\t// If the title is empty, fall back to the default label.\r\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\r\n\t\t\treturn customName || title;\r\n\t\t}\r\n\t},\r\n} );\r\n"],"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","ResponsiveWrapper","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","useEffect","store","noticesStore","useDispatch","useSelect","select","withDispatch","withSelect","MediaUpload","MediaUploadCheck","blockEditorStore","coreStore","qsmIsEmpty","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","createElement","FeaturedImage","featureImageID","onUpdateImage","onRemoveImage","createNotice","toggleRef","isLoading","setIsLoading","media","setMedia","undefined","mediaFeature","mediaUpload","getMedia","getSettings","shouldSetQSMAttr","id","width","media_details","height","url","source_url","alt_text","slug","onDropFiles","filesList","allowedTypes","onFileChange","image","onError","message","isDismissible","type","className","fallback","title","onSelect","unstableFeaturedImageFlow","modalClass","render","open","ref","onClick","naturalWidth","naturalHeight","isInline","src","alt","current","focus","onFilesDrop","value","apiFetch","PanelBody","TreeSelect","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","CheckboxControl","Flex","FlexItem","qsmFormData","SelectAddCategory","isCategorySelected","setUnsetCatgory","showForm","setShowForm","formCatName","setFormCatName","formCatParent","setFormCatParent","addingNewCategory","setAddingNewCategory","newCategoryError","setNewCategoryError","categories","setCategories","qsmBlockData","hierarchicalCategoryList","getCategoryIdDetailsObject","catObj","forEach","cat","children","length","childCategory","categoryIdDetails","setCategoryIdDetails","addNewCategoryLabel","noParentOption","onAddCategory","event","preventDefault","ajax_url","method","body","then","res","term_id","path","status","result","term","getCategoryNameArray","cats","push","name","checkSetNewCategory","catName","console","log","includes","renderTerms","map","key","label","checked","onChange","initialOpen","tabIndex","role","variant","onSubmit","direction","gap","__nextHasNoMarginBottom","required","noOptionLabel","selectedId","tree","disabled","Icon","qsmBlockIcon","icon","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","warningIcon","stroke","strokeWidth","strokeLinecap","strokeLinejoin","data","qsmUniqueArray","arr","Array","isArray","filter","val","index","indexOf","qsmMatchingValueKeyArray","values","obj","Object","keys","find","qsmDecodeHtml","html","txt","document","innerHTML","qsmSanitizeName","toLowerCase","replace","qsmStripTags","text","div","innerText","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmGenerateRandomKey","charset","Uint8Array","window","crypto","getRandomValues","i","qsmUniqid","prefix","random","qsmValueOrDefault","defaultValue","InspectorControls","RichText","InnerBlocks","useBlockProps","BlockControls","createBlock","ToolbarGroup","ToolbarButton","FormTokenField","ExternalLink","Modal","isQuestionIDReserved","questionIDCheck","clientIdCheck","blocksClientIds","getClientIdsWithDescendants","some","blockClientId","questionID","getBlockAttributes","Edit","props","_settings$file_upload","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","hasSelectedInnerBlock","quizID","quiz_name","post_id","rest_nonce","pageID","getBlockRootClientId","getBlockIndex","insertBlock","isChanged","description","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageSrc","answers","answerEditor","matchAnswer","settings","enableCorrectAnsInfo","setEnableCorrectAnsInfo","isOpenAdvanceQModal","setIsOpenAdvanceQModal","proActivated","is_pro_activated","isAdvanceQuestionType","qtype","parseInt","fileTypes","file_upload_type","options","selectedFileTypes","file_types","default","split","isCheckedFileType","fileType","setFileTypes","file_type","join","shouldSetID","newQuestion","response","question_id","catch","error","shouldSetChanged","blockProps","QUESTION_TEMPLATE","optionID","getCategoryAncestors","termId","parents","ancestor","multiCat","catID","childCatID","ancestorIds","notes","setQuestionType","MicroModal","modalEl","getElementById","show","insertNewQuestion","blockToInsert","selectBlockOnInsert","insertNewPage","currentPageClientID","newPageIndex","qsmBlockClientID","Fragment","contentLabel","size","__experimentalHideHeader","href","quiz_settings_url","question_type","help","question_type_description","qtypes","types","file_upload_limit","heading","limit","filetype","mediaDetails","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit","__experimentalLabel","customName","hasContent"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/style-index.css b/blocks/build/style-index.css index 8b1378917..74830d632 100644 --- a/blocks/build/style-index.css +++ b/blocks/build/style-index.css @@ -1 +1,11 @@ +/*!***************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! + \***************************************************************************************************************************************************************************************************************************************/ +/** + * The following styles get applied both on the front of your site + * and in the editor. + * + * Replace them with your own styles or remove the file completely. + */ +/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/blocks/build/style-index.css.map b/blocks/build/style-index.css.map new file mode 100644 index 000000000..69cae5f30 --- /dev/null +++ b/blocks/build/style-index.css.map @@ -0,0 +1 @@ +{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA,C","sources":["webpack://qsm/./src/style.scss"],"sourcesContent":["/**\r\n * The following styles get applied both on the front of your site\r\n * and in the editor.\r\n *\r\n * Replace them with your own styles or remove the file completely.\r\n */\r\n\r\n// .wp-block-qsm-main-block {\r\n// \tbackground-color: #21759b;\r\n// \tcolor: #fff;\r\n// \tpadding: 2px;\r\n// }\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/src/answer-option/index.js b/blocks/src/answer-option/index.js index aba09df25..88d1ce300 100644 --- a/blocks/src/answer-option/index.js +++ b/blocks/src/answer-option/index.js @@ -5,6 +5,18 @@ import { answerOptionBlockIcon } from "../component/icon"; registerBlockType( metadata.name, { icon: answerOptionBlockIcon, + __experimentalLabel( attributes, { context } ) { + const { content } = attributes; + + const customName = attributes?.metadata?.name; + const hasContent = content?.length > 0; + + // In the list view, use the answer content as the label. + // If the content is empty, fall back to the default label. + if ( context === 'list-view' && ( customName || hasContent ) ) { + return customName || content; + } + }, merge( attributes, attributesToMerge ) { return { content: diff --git a/blocks/src/component/icon.js b/blocks/src/component/icon.js index 88266e4a3..7da1edec6 100644 --- a/blocks/src/component/icon.js +++ b/blocks/src/component/icon.js @@ -33,4 +33,15 @@ export const answerOptionBlockIcon = () => ( ) } /> +); + +//Warning icon +export const warningIcon = () => ( + ( + + + + ) } + /> ); \ No newline at end of file diff --git a/blocks/src/edit.js b/blocks/src/edit.js index af8aa38c2..cfa74765a 100644 --- a/blocks/src/edit.js +++ b/blocks/src/edit.js @@ -675,7 +675,7 @@ export default function Edit( props ) { ( ! qsmIsEmpty( quizID ) || '0' != quizID ) &&

{ __( 'Advance Quiz Settings', 'quiz-master-next' ) } @@ -684,7 +684,7 @@ export default function Edit( props ) { { ( qsmIsEmpty( quizID ) || '0' == quizID ) ? - quizPlaceholder() +

{ quizPlaceholder() }
:
} diff --git a/blocks/src/editor.scss b/blocks/src/editor.scss index 6f5e82551..c31081b7b 100644 --- a/blocks/src/editor.scss +++ b/blocks/src/editor.scss @@ -81,9 +81,18 @@ .qsm-question-correct-answer-info, .qsm-question-hint { font-size: 1rem; + color: $qsm_primary_color; } /*Question options*/ + .wp-block-qsm-quiz-answer-option{ + input:disabled{ + border-color: inherit; + } + input[type="radio"]:disabled, input[type="checkbox"]:disabled{ + opacity: 1; + } + } .qsm-question-answer-option{ color: $qsm_primary_color; font-size: 0.9rem; @@ -96,5 +105,27 @@ color: $qsm_primary_color; } } + + .add-new-question-btn{ + margin-top: 2rem; + } } + +.qsm-advance-q-modal{ + text-align: center; + justify-content: center; + max-width: 580px; + .qsm-title{ + margin-top: 0; + } + .qsm-modal-btn-wrapper{ + display: flex; + gap: 1rem; + justify-content: center; + .components-external-link{ + color: #ffffff; + text-decoration: none; + } + } +} \ No newline at end of file diff --git a/blocks/src/index.js b/blocks/src/index.js index 5553a6a0c..dd01cde3b 100644 --- a/blocks/src/index.js +++ b/blocks/src/index.js @@ -3,6 +3,7 @@ import './style.scss'; import Edit from './edit'; import metadata from './block.json'; import { qsmBlockIcon } from './component/icon'; +import { createHigherOrderComponent } from '@wordpress/compose'; const save = ( props ) => null; registerBlockType( metadata.name, { @@ -13,3 +14,26 @@ registerBlockType( metadata.name, { edit: Edit, save: save, } ); + + +const withMyPluginControls = createHigherOrderComponent( ( BlockEdit ) => { + return ( props ) => { + const { name, className, attributes, setAttributes, isSelected, clientId, context } = props; + if ( 'core/group' !== name ) { + return ; + } + + console.log("props",props); + return ( + <> + + + ); + }; +}, 'withMyPluginControls' ); + +wp.hooks.addFilter( + 'editor.BlockEdit', + 'my-plugin/with-inspector-controls', + withMyPluginControls +); \ No newline at end of file diff --git a/blocks/src/question/block.json b/blocks/src/question/block.json index 00f5b641d..36be9515a 100644 --- a/blocks/src/question/block.json +++ b/blocks/src/question/block.json @@ -87,7 +87,12 @@ }, "example": {}, "supports": { - "html": false + "html": false, + "anchor": true, + "className": true, + "interactivity": { + "clientNavigation": true + } }, "textdomain": "main-block", "editorScript": "file:./index.js", diff --git a/blocks/src/question/edit.js b/blocks/src/question/edit.js index e442e453d..7240aad41 100644 --- a/blocks/src/question/edit.js +++ b/blocks/src/question/edit.js @@ -21,9 +21,13 @@ import { TextControl, CheckboxControl, FormTokenField, + Button, + ExternalLink, + Modal } from '@wordpress/components'; import FeaturedImage from '../component/FeaturedImage'; import SelectAddCategory from '../component/SelectAddCategory'; +import { warningIcon } from "../component/icon"; import { qsmIsEmpty, qsmStripTags, qsmFormData, qsmValueOrDefault, qsmDecodeHtml, qsmUniqueArray, qsmMatchingValueKeyArray } from '../helper'; @@ -92,6 +96,11 @@ export default function Edit( props ) { settings={}, } = attributes; + //Variable to decide if correct answer info input field should be available + const [ enableCorrectAnsInfo, setEnableCorrectAnsInfo ] = useState( ! qsmIsEmpty( correctAnswerInfo ) ); + //Advance Question modal + const [ isOpenAdvanceQModal, setIsOpenAdvanceQModal ] = useState( false ); + const proActivated = ( '1' == qsmBlockData.is_pro_activated ); const isAdvanceQuestionType = ( qtype ) => 14 < parseInt( qtype ); @@ -302,6 +311,8 @@ export default function Edit( props ) { if ( ! qsmIsEmpty( modalEl ) ) { MicroModal.show('modal-advanced-question-type'); } + } else if ( proActivated && isAdvanceQuestionType( qtype ) ) { + setIsOpenAdvanceQModal( true ); } else { setAttributes( { type: qtype } ); } @@ -355,6 +366,39 @@ export default function Edit( props ) { /> + { isOpenAdvanceQModal && ( + +
+

+ { warningIcon() } +
+ { __( 'Use QSM editor for Advanced Question', 'quiz-master-next' ) } +

+

+ { __( "Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.", "quiz-master-next" ) } +

+
+ + +
+
+ +
+ ) } { isAdvanceQuestionType( type ) ? ( <> @@ -365,6 +409,14 @@ export default function Edit( props ) {

{ __( 'Advanced Question Type : ', 'quiz-master-next' ) + title }

+

+ { __( 'Edit question in QSM ', 'quiz-master-next' ) } + +

):( @@ -389,7 +441,7 @@ export default function Edit( props ) { { qtypes.types.map( qtype => ( - + ) ) } @@ -416,6 +468,11 @@ export default function Edit( props ) { checked={ ! qsmIsEmpty( required ) && '1' == required } onChange={ () => setAttributes( { required : ( ( ! qsmIsEmpty( required ) && '1' == required ) ? 0 : 1 ) } ) } /> + setEnableCorrectAnsInfo( ! enableCorrectAnsInfo ) } + /> {/**File Upload */} { '11' == type && ( @@ -451,6 +508,26 @@ export default function Edit( props ) { isCategorySelected={ isCategorySelected } setUnsetCatgory={ setUnsetCatgory } /> + {/**Hint */} + + setAttributes( { hint: qsmStripTags( hint ) } ) } + /> + + {/**Comment Box */} + + + setAttributes( { commentBox } ) + } + __nextHasNoMarginBottom + /> + {/**Feature Image */} - {/**Comment Box */} - - - setAttributes( { commentBox } ) - } - __nextHasNoMarginBottom - /> -
setAttributes({ description }) } className={ 'qsm-question-description' } @@ -515,29 +580,29 @@ export default function Edit( props ) { template={ QUESTION_TEMPLATE } /> } - - setAttributes({ correctAnswerInfo }) } - className={ 'qsm-question-correct-answer-info' } - __unstableEmbedURLOnPaste - __unstableAllowPrefixTransformations - /> - setAttributes( { hint: qsmStripTags( hint ) } ) } - allowedFormats={ [ ] } - withoutInteractiveFormatting - className={ 'qsm-question-hint' } - /> + { + enableCorrectAnsInfo && ( + setAttributes({ correctAnswerInfo }) } + className={ 'qsm-question-correct-answer-info' } + __unstableEmbedURLOnPaste + __unstableAllowPrefixTransformations + /> + ) + } + }
diff --git a/blocks/src/question/index.js b/blocks/src/question/index.js index ebcf48040..e1f92e3cc 100644 --- a/blocks/src/question/index.js +++ b/blocks/src/question/index.js @@ -9,4 +9,16 @@ registerBlockType( metadata.name, { * @see ./edit.js */ edit: Edit, + __experimentalLabel( attributes, { context } ) { + const { title } = attributes; + + const customName = attributes?.metadata?.name; + const hasContent = title?.length > 0; + + // In the list view, use the question title as the label. + // If the title is empty, fall back to the default label. + if ( context === 'list-view' && ( customName || hasContent ) ) { + return customName || title; + } + }, } ); From b1418c0ffbe94dbdef64f97362d51032cd7e0f0e Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Wed, 20 Mar 2024 10:23:57 +0530 Subject: [PATCH 23/27] update qsm block build --- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 938 +------------- blocks/build/answer-option/index.js.map | 1 - blocks/build/index.asset.php | 2 +- blocks/build/index.css | 117 +- blocks/build/index.css.map | 1 - blocks/build/index.js | 1322 +------------------ blocks/build/index.js.map | 1 - blocks/build/page/index.asset.php | 2 +- blocks/build/page/index.js | 361 +----- blocks/build/page/index.js.map | 1 - blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 1348 +------------------- blocks/build/question/index.js.map | 1 - blocks/build/style-index.css | 10 - blocks/build/style-index.css.map | 1 - 16 files changed, 13 insertions(+), 4097 deletions(-) delete mode 100644 blocks/build/answer-option/index.js.map delete mode 100644 blocks/build/index.css.map delete mode 100644 blocks/build/index.js.map delete mode 100644 blocks/build/page/index.js.map delete mode 100644 blocks/build/question/index.js.map delete mode 100644 blocks/build/style-index.css.map diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index 1baa202b2..2b8a2bc74 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'e57f925605ba8567c314'); + array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => '86bb3e6490c0563af58b'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index 435c85504..2ef84a3af 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -1,937 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./node_modules/@wordpress/icons/build-module/library/image.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@wordpress/icons/build-module/library/image.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/primitives */ "@wordpress/primitives"); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - -/** - * WordPress dependencies - */ - -const image = (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.SVG, { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.Path, { - d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" -})); -/* harmony default export */ __webpack_exports__["default"] = (image); -//# sourceMappingURL=image.js.map - -/***/ }), - -/***/ "./src/answer-option/edit.js": -/*!***********************************!*\ - !*** ./src/answer-option/edit.js ***! - \***********************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); -/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/escape-html */ "@wordpress/escape-html"); -/* harmony import */ var _wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _component_ImageType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../component/ImageType */ "./src/component/ImageType.js"); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - - - - - - - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId, - context, - mergeBlocks, - onReplace, - onRemove - } = props; - const quizID = context['quiz-master-next/quizID']; - const pageID = context['quiz-master-next/pageID']; - const questionID = context['quiz-master-next/questionID']; - const questionType = context['quiz-master-next/questionType']; - const answerType = context['quiz-master-next/answerType']; - const questionChanged = context['quiz-master-next/questionChanged']; - const name = 'qsm/quiz-answer-option'; - const { - optionID, - content, - caption, - points, - isCorrect - } = attributes; - const { - selectBlock - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); - - //Use to to update block attributes using clientId - const { - updateBlockAttributes - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); - const questionClientID = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { - //get parent gutena form clientIds - let questionClientID = select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store).getBlockParentsByBlockName(clientId, 'qsm/quiz-question', true); - return (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionClientID) ? '' : questionClientID[0]; - }, [clientId]); - - //detect change in question - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetChanged = true; - if (shouldSetChanged && isSelected && !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionClientID) && false === questionChanged) { - updateBlockAttributes(questionClientID, { - isChanged: true - }); - } - - //cleanup - return () => { - shouldSetChanged = false; - }; - }, [content, caption, points, isCorrect]); - - /**Initialize block from server */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(content) && (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_6__.isURL)(content) && (-1 !== content.indexOf('https://') || -1 !== content.indexOf('http://')) && ['rich', 'text'].includes(answerType)) { - setAttributes({ - content: '', - caption: '' - }); - } - } - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, [answerType]); - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)({ - className: isSelected ? ' is-highlighted ' : '' - }); - const inputType = ['4', '10'].includes(questionType) ? "checkbox" : "radio"; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Settings', 'quiz-master-next'), - initialOpen: true - }, /**Image answer option */ - 'image' === answerType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - type: "text", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Caption', 'quiz-master-next'), - value: caption, - onChange: caption => setAttributes({ - caption: (0,_wordpress_escape_html__WEBPACK_IMPORTED_MODULE_3__.escapeAttribute)(caption) - }) - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - type: "number", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Points', 'quiz-master-next'), - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer points', 'quiz-master-next'), - value: points, - onChange: points => setAttributes({ - points - }) - }), ['0', '4', '1', '10', '2'].includes(questionType) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct', 'quiz-master-next'), - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(isCorrect) && '1' == isCorrect, - onChange: () => setAttributes({ - isCorrect: !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(isCorrect) && '1' == isCorrect ? 0 : 1 - }) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.__experimentalHStack, { - className: "edit-post-document-actions__title", - spacing: 1, - justify: "left" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("input", { - type: inputType, - disabled: true, - readOnly: true, - tabIndex: "-1" - }), /**Text answer option*/ - !['rich', 'image'].includes(answerType) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer options', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question answer', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Your Answer', 'quiz-master-next'), - value: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmStripTags)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(content)), - onChange: content => setAttributes({ - content: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmStripTags)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(content)) - }), - onSplit: (value, isOriginal) => { - let newAttributes; - if (isOriginal || value) { - newAttributes = { - ...attributes, - content: value - }; - } - const block = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__.createBlock)(name, newAttributes); - if (isOriginal) { - block.clientId = clientId; - } - return block; - }, - onMerge: mergeBlocks, - onReplace: onReplace, - onRemove: onRemove, - allowedFormats: [], - withoutInteractiveFormatting: true, - className: 'qsm-question-answer-option', - identifier: "text" - }), /**Rich Text answer option */ - 'rich' === answerType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Answer options', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question answer', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Your Answer', 'quiz-master-next'), - value: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(content)), - onChange: content => setAttributes({ - content - }), - onSplit: (value, isOriginal) => { - let newAttributes; - if (isOriginal || value) { - newAttributes = { - ...attributes, - content: value - }; - } - const block = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_8__.createBlock)(name, newAttributes); - if (isOriginal) { - block.clientId = clientId; - } - return block; - }, - onMerge: mergeBlocks, - onReplace: onReplace, - onRemove: onRemove, - className: 'qsm-question-answer-option', - identifier: "text", - __unstableEmbedURLOnPaste: true, - __unstableAllowPrefixTransformations: true - }), /**Image answer option */ - 'image' === answerType && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_ImageType__WEBPACK_IMPORTED_MODULE_9__["default"], { - url: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_6__.isURL)(content) ? content : '', - caption: caption, - setURLCaption: (url, caption) => setAttributes({ - content: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_6__.isURL)(url) ? url : '', - caption: caption - }) - })))); -} - -/***/ }), - -/***/ "./src/component/ImageType.js": -/*!************************************!*\ - !*** ./src/component/ImageType.js ***! - \************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ ImageType: function() { return /* binding */ ImageType; }, -/* harmony export */ isExternalImage: function() { return /* binding */ isExternalImage; }, -/* harmony export */ pickRelevantMediaFiles: function() { return /* binding */ pickRelevantMediaFiles; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blob */ "@wordpress/blob"); -/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/@wordpress/icons/build-module/library/image.js"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - -/** - * Image Component: Upload, Use media, external image url - */ - - - - - - - - - - -const pickRelevantMediaFiles = (image, size) => { - const imageProps = Object.fromEntries(Object.entries(image !== null && image !== void 0 ? image : {}).filter(([key]) => ['alt', 'id', 'link', 'caption'].includes(key))); - imageProps.url = image?.sizes?.[size]?.url || image?.media_details?.sizes?.[size]?.source_url || image.url; - return imageProps; -}; - -/** - * Is the URL a temporary blob URL? A blob URL is one that is used temporarily - * while the image is being uploaded and will not have an id yet allocated. - * - * @param {number=} id The id of the image. - * @param {string=} url The url of the image. - * - * @return {boolean} Is the URL a Blob URL - */ -const isTemporaryImage = (id, url) => !id && (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.isBlobURL)(url); - -/** - * Is the url for the image hosted externally. An externally hosted image has no - * id and is not a blob url. - * - * @param {number=} id The id of the image. - * @param {string=} url The url of the image. - * - * @return {boolean} Is the url an externally hosted url? - */ -const isExternalImage = (id, url) => url && !id && !(0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.isBlobURL)(url); -function ImageType({ - url = '', - caption = '', - alt = '', - setURLCaption -}) { - const ALLOWED_MEDIA_TYPES = ['image']; - const [id, setId] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); - const [temporaryURL, setTemporaryURL] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(); - const ref = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(); - const { - imageDefaultSize, - mediaUpload - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useSelect)(select => { - const { - getSettings - } = select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); - const settings = getSettings(); - return { - imageDefaultSize: settings.imageDefaultSize, - mediaUpload: settings.mediaUpload - }; - }, []); - const { - createErrorNotice - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_6__.store); - function onUploadError(message) { - createErrorNotice(message, { - type: 'snackbar' - }); - setURLCaption(undefined, undefined); - setTemporaryURL(undefined); - } - function onSelectImage(media) { - if (!media || !media.url) { - setURLCaption(undefined, undefined); - return; - } - if ((0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.isBlobURL)(media.url)) { - setTemporaryURL(media.url); - return; - } - setTemporaryURL(); - let mediaAttributes = pickRelevantMediaFiles(media, imageDefaultSize); - setId(mediaAttributes.id); - setURLCaption(mediaAttributes.url, mediaAttributes.caption); - } - function onSelectURL(newURL) { - if (newURL !== url) { - setURLCaption(newURL, caption); - } - } - let isTemp = isTemporaryImage(id, url); - - // Upload a temporary image on mount. - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (!isTemp) { - return; - } - const file = (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.getBlobByURL)(url); - if (file) { - mediaUpload({ - filesList: [file], - onFileChange: ([img]) => { - onSelectImage(img); - }, - allowedTypes: ALLOWED_MEDIA_TYPES, - onError: message => { - isTemp = false; - onUploadError(message); - } - }); - } - }, []); - - // If an image is temporary, revoke the Blob url when it is uploaded (and is - // no longer temporary). - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (isTemp) { - setTemporaryURL(url); - return; - } - (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_1__.revokeBlobURL)(temporaryURL); - }, [isTemp, url]); - const isExternal = isExternalImage(id, url); - const src = isExternal ? url : undefined; - const mediaPreview = !!url && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { - alt: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Edit image'), - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Edit image'), - className: 'edit-image-preview', - src: url - }); - let img = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { - src: temporaryURL || url, - alt: "", - className: "qsm-answer-option-image", - style: { - width: '200', - height: 'auto' - } - }), temporaryURL && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Spinner, null)); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figure", null, (0,_helper__WEBPACK_IMPORTED_MODULE_8__.qsmIsEmpty)(url) ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaPlaceholder, { - icon: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.BlockIcon, { - icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__["default"] - }), - onSelect: onSelectImage, - onSelectURL: onSelectURL, - onError: onUploadError, - accept: "image/*", - allowedTypes: ALLOWED_MEDIA_TYPES, - value: { - id, - src - }, - mediaPreview: mediaPreview, - disableMediaButtons: temporaryURL || url - }) : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.BlockControls, { - group: "other" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaReplaceFlow, { - mediaId: id, - mediaURL: url, - allowedTypes: ALLOWED_MEDIA_TYPES, - accept: "image/*", - onSelect: onSelectImage, - onSelectURL: onSelectURL, - onError: onUploadError - })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", null, img))); -} -/* harmony default export */ __webpack_exports__["default"] = (ImageType); - -/***/ }), - -/***/ "./src/component/icon.js": -/*!*******************************!*\ - !*** ./src/component/icon.js ***! - \*******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ answerOptionBlockIcon: function() { return /* binding */ answerOptionBlockIcon; }, -/* harmony export */ qsmBlockIcon: function() { return /* binding */ qsmBlockIcon; }, -/* harmony export */ questionBlockIcon: function() { return /* binding */ questionBlockIcon; }, -/* harmony export */ warningIcon: function() { return /* binding */ warningIcon; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); - - -//QSM Quiz Block -const qsmBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "3", - fill: "black" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z", - fill: "white" - })) -}); - -//Question Block -const questionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "25", - height: "25", - viewBox: "0 0 25 25", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "0.102539", - y: "0.101562", - width: "24", - height: "24", - rx: "4.68852", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z", - fill: "white" - })) -}); - -//Answer option Block -const answerOptionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "4.21657", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z", - fill: "white" - })) -}); - -//Warning icon -const warningIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "54", - height: "54", - viewBox: "0 0 54 54", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z", - stroke: "#B45309", - strokeWidth: "1.65929", - strokeLinecap: "round", - strokeLinejoin: "round" - })) -}); - -/***/ }), - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, -/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmGenerateRandomKey: function() { return /* binding */ qsmGenerateRandomKey; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmMatchingValueKeyArray: function() { return /* binding */ qsmMatchingValueKeyArray; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; - -//Get Unique array values -const qsmUniqueArray = arr => { - if (qsmIsEmpty(arr) || !Array.isArray(arr)) { - return arr; - } - return arr.filter((val, index, arr) => arr.indexOf(val) === index); -}; - -//Match array of object values and return array of cooresponding matching keys -const qsmMatchingValueKeyArray = (values, obj) => { - if (qsmIsEmpty(obj) || !Array.isArray(values)) { - return values; - } - return values.map(val => Object.keys(obj).find(key => obj[key] == val)); -}; - -//Decode htmlspecialchars -const qsmDecodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; -}; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from text content. -const qsmStripTags = text => { - let div = document.createElement("div"); - div.innerHTML = qsmDecodeHtml(text); - return div.innerText; -}; - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - //add to check if api call from editor - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//add objecyt to form data -const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { - if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { - return data; - } - for (let key in valueObj) { - if (valueObj.hasOwnProperty(key)) { - let value = valueObj[key]; - if ('object' === value) { - qsmAddObjToFormData(formKey + '[' + key + ']', value, data); - } else { - data.append(formKey + '[' + key + ']', valueObj[key]); - } - } - } - return data; -}; - -//Generate random number -const qsmGenerateRandomKey = length => { - const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - let key = ""; - - // Generate random bytes - const values = new Uint8Array(length); - window.crypto.getRandomValues(values); - for (let i = 0; i < length; i++) { - // Use the random byte to index into the charset - key += charset[values[i] % charset.length]; - } - return key; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const id = qsmGenerateRandomKey(8); - return `${prefix}${id}${random ? `.${qsmGenerateRandomKey(7)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "react": -/*!************************!*\ - !*** external "React" ***! - \************************/ -/***/ (function(module) { - -module.exports = window["React"]; - -/***/ }), - -/***/ "@wordpress/blob": -/*!******************************!*\ - !*** external ["wp","blob"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blob"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/escape-html": -/*!************************************!*\ - !*** external ["wp","escapeHtml"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["escapeHtml"]; - -/***/ }), - -/***/ "@wordpress/html-entities": -/*!**************************************!*\ - !*** external ["wp","htmlEntities"] ***! - \**************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["htmlEntities"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "@wordpress/notices": -/*!*********************************!*\ - !*** external ["wp","notices"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["notices"]; - -/***/ }), - -/***/ "@wordpress/primitives": -/*!************************************!*\ - !*** external ["wp","primitives"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["primitives"]; - -/***/ }), - -/***/ "@wordpress/url": -/*!*****************************!*\ - !*** external ["wp","url"] ***! - \*****************************/ -/***/ (function(module) { - -module.exports = window["wp"]["url"]; - -/***/ }), - -/***/ "./src/answer-option/block.json": -/*!**************************************!*\ - !*** ./src/answer-option/block.json ***! - \**************************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-answer-option","version":"0.1.0","title":"Answer Option","category":"widgets","parent":["qsm/quiz-question"],"icon":"remove","description":"QSM Quiz answer option","attributes":{"optionID":{"type":"string","default":"0"},"content":{"type":"string","default":""},"caption":{"type":"string","default":""},"points":{"type":"string","default":"0"},"isCorrect":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/quizAttr","quiz-master-next/questionID","quiz-master-next/questionType","quiz-master-next/answerType","quiz-master-next/questionChanged"],"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!************************************!*\ - !*** ./src/answer-option/index.js ***! - \************************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/answer-option/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/answer-option/block.json"); -/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../component/icon */ "./src/component/icon.js"); - - - - -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { - icon: _component_icon__WEBPACK_IMPORTED_MODULE_3__.answerOptionBlockIcon, - __experimentalLabel(attributes, { - context - }) { - const { - content - } = attributes; - const customName = attributes?.metadata?.name; - const hasContent = content?.length > 0; - - // In the list view, use the answer content as the label. - // If the content is empty, fall back to the default label. - if (context === 'list-view' && (customName || hasContent)) { - return customName || content; - } - }, - merge(attributes, attributesToMerge) { - return { - content: (attributes.content || '') + (attributesToMerge.content || '') - }; - }, - edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] -}); -}(); -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,i=window.wp.htmlEntities,o=window.wp.escapeHtml,a=window.wp.blockEditor,l=window.wp.data,r=window.wp.url,c=window.wp.components,s=window.wp.blob,u=window.React,m=window.wp.primitives,d=(0,u.createElement)(m.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,u.createElement)(m.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),p=window.wp.notices;const w=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},E=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText};var h=function({url:e="",caption:i="",alt:o="",setURLCaption:r}){const u=["image"],[m,g]=(0,t.useState)(null),[E,h]=(0,t.useState)(),{imageDefaultSize:x,mediaUpload:f}=((0,t.useRef)(),(0,l.useSelect)((e=>{const{getSettings:t}=e(a.store),n=t();return{imageDefaultSize:n.imageDefaultSize,mediaUpload:n.mediaUpload}}),[])),{createErrorNotice:_}=(0,l.useDispatch)(p.store);function v(e){_(e,{type:"snackbar"}),r(void 0,void 0),h(void 0)}function q(e){if(!e||!e.url)return void r(void 0,void 0);if((0,s.isBlobURL)(e.url))return void h(e.url);h();let t=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));return n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e.url,n})(e,x);g(t.id),r(t.url,t.caption)}function b(t){t!==e&&r(t,i)}let z=((e,t)=>!e&&(0,s.isBlobURL)(t))(m,e);(0,t.useEffect)((()=>{if(!z)return;const t=(0,s.getBlobByURL)(e);t&&f({filesList:[t],onFileChange:([e])=>{q(e)},allowedTypes:u,onError:e=>{z=!1,v(e)}})}),[]),(0,t.useEffect)((()=>{z?h(e):(0,s.revokeBlobURL)(E)}),[z,e]);const R=((e,t)=>t&&!e&&!(0,s.isBlobURL)(t))(m,e)?e:void 0,L=!!e&&(0,t.createElement)("img",{alt:(0,n.__)("Edit image"),title:(0,n.__)("Edit image"),className:"edit-image-preview",src:e});let B=(0,t.createElement)(t.Fragment,null,(0,t.createElement)("img",{src:E||e,alt:"",className:"qsm-answer-option-image",style:{width:"200",height:"auto"}}),E&&(0,t.createElement)(c.Spinner,null));return(0,t.createElement)("figure",null,w(e)?(0,t.createElement)(a.MediaPlaceholder,{icon:(0,t.createElement)(a.BlockIcon,{icon:d}),onSelect:q,onSelectURL:b,onError:v,accept:"image/*",allowedTypes:u,value:{id:m,src:R},mediaPreview:L,disableMediaButtons:E||e}):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.BlockControls,{group:"other"},(0,t.createElement)(a.MediaReplaceFlow,{mediaId:m,mediaURL:e,allowedTypes:u,accept:"image/*",onSelect:q,onSelectURL:b,onError:v})),(0,t.createElement)("div",null,B)))},x=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(x.u2,{icon:()=>(0,t.createElement)(c.Icon,{icon:()=>(0,t.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("rect",{width:"24",height:"24",rx:"4.21657",fill:"#ADADAD"}),(0,t.createElement)("path",{d:"M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z",fill:"white"}))}),__experimentalLabel(e,{context:t}){const{content:n}=e,i=e?.metadata?.name;if("list-view"===t&&(i||n?.length>0))return i||n},merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(s){if("undefined"==typeof qsmBlockData)return null;const{className:u,attributes:m,setAttributes:d,isSelected:p,clientId:x,context:f,mergeBlocks:_,onReplace:v,onRemove:q}=s,b=(f["quiz-master-next/quizID"],f["quiz-master-next/pageID"],f["quiz-master-next/questionID"],f["quiz-master-next/questionType"]),z=f["quiz-master-next/answerType"],R=f["quiz-master-next/questionChanged"],L="qsm/quiz-answer-option",{optionID:B,content:k,caption:S,points:C,isCorrect:y}=m,{selectBlock:U}=(0,l.useDispatch)(a.store),{updateBlockAttributes:T}=(0,l.useDispatch)(a.store),D=(0,l.useSelect)((e=>{let t=e(a.store).getBlockParentsByBlockName(x,"qsm/quiz-question",!0);return w(t)?"":t[0]}),[x]);(0,t.useEffect)((()=>{let e=!0;return e&&p&&!w(D)&&!1===R&&T(D,{isChanged:!0}),()=>{e=!1}}),[k,S,C,y]),(0,t.useEffect)((()=>{let e=!0;return e&&(w(k)||!(0,r.isURL)(k)||-1===k.indexOf("https://")&&-1===k.indexOf("http://")||!["rich","text"].includes(z)||d({content:"",caption:""})),()=>{e=!1}}),[z]);const I=(0,a.useBlockProps)({className:p?" is-highlighted ":""}),A=["4","10"].includes(b)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.InspectorControls,null,(0,t.createElement)(c.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},"image"===z&&(0,t.createElement)(c.TextControl,{type:"text",label:(0,n.__)("Caption","quiz-master-next"),value:S,onChange:e=>d({caption:(0,o.escapeAttribute)(e)})}),(0,t.createElement)(c.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:C,onChange:e=>d({points:e})}),["0","4","1","10","2"].includes(b)&&(0,t.createElement)(c.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!w(y)&&"1"==y,onChange:()=>d({isCorrect:w(y)||"1"!=y?1:0})}))),(0,t.createElement)("div",{...I},(0,t.createElement)(c.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:A,disabled:!0,readOnly:!0,tabIndex:"-1"}),!["rich","image"].includes(z)&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:E((0,i.decodeEntities)(k)),onChange:e=>d({content:E((0,i.decodeEntities)(e))}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(L,i);return n&&(o.clientId=x),o},onMerge:_,onReplace:v,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}),"rich"===z&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:g((0,i.decodeEntities)(k)),onChange:e=>d({content:e}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(L,i);return n&&(o.clientId=x),o},onMerge:_,onReplace:v,onRemove:q,className:"qsm-question-answer-option",identifier:"text",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),"image"===z&&(0,t.createElement)(h,{url:(0,r.isURL)(k)?k:"",caption:S,setURLCaption:(e,t)=>d({content:(0,r.isURL)(e)?e:"",caption:t})}))))}})}(); \ No newline at end of file diff --git a/blocks/build/answer-option/index.js.map b/blocks/build/answer-option/index.js.map deleted file mode 100644 index 331e84a34..000000000 --- a/blocks/build/answer-option/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"answer-option/index.js","mappings":";;;;;;;;;;;;;;;AAAsC;AACtC;AACA;AACA;AACkD;AAClD,cAAc,oDAAa,CAAC,sDAAG;AAC/B;AACA;AACA,CAAC,EAAE,oDAAa,CAAC,uDAAI;AACrB;AACA,CAAC;AACD,+DAAe,KAAK,EAAC;AACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACZqC;AACoB;AACC;AACD;AAMxB;AACgC;AAC1B;AAMR;AACiB;AACD;AACqB;AACrD,SAASwB,IAAIA,CAAEC,KAAK,EAAG;EAErC;EACA,IAAK,WAAW,KAAK,OAAOC,YAAY,EAAG;IAC1C,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,UAAU;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,WAAW;IAAEC,SAAS;IACpGC;EAAS,CAAC,GAAGV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AAa,EAAE;EACjCpH,IAAI,EAAEgE,kEAAqB;EAC3BqD,mBAAmBA,CAAE5L,UAAU,EAAE;IAAEI;EAAQ,CAAC,EAAG;IAC9C,MAAM;MAAEY;IAAQ,CAAC,GAAGhB,UAAU;IAE9B,MAAM6L,UAAU,GAAG7L,UAAU,EAAE2L,QAAQ,EAAE7K,IAAI;IAC7C,MAAMgL,UAAU,GAAG9K,OAAO,EAAE8J,MAAM,GAAG,CAAC;;IAEtC;IACA;IACA,IAAK1K,OAAO,KAAK,WAAW,KAAMyL,UAAU,IAAIC,UAAU,CAAE,EAAG;MAC9D,OAAOD,UAAU,IAAI7K,OAAO;IAC7B;EACD,CAAC;EACD+K,KAAKA,CAAE/L,UAAU,EAAEgM,iBAAiB,EAAG;IACtC,OAAO;MACNhL,OAAO,EACN,CAAEhB,UAAU,CAACgB,OAAO,IAAI,EAAE,KACxBgL,iBAAiB,CAAChL,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACDiL,IAAI,EAAErM,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./node_modules/@wordpress/icons/build-module/library/image.js","webpack://qsm/./src/answer-option/edit.js","webpack://qsm/./src/component/ImageType.js","webpack://qsm/./src/component/icon.js","webpack://qsm/./src/helper.js","webpack://qsm/external window \"React\"","webpack://qsm/external window [\"wp\",\"blob\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"escapeHtml\"]","webpack://qsm/external window [\"wp\",\"htmlEntities\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/external window [\"wp\",\"primitives\"]","webpack://qsm/external window [\"wp\",\"url\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/answer-option/index.js"],"sourcesContent":["import { createElement } from \"react\";\n/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\nconst image = createElement(SVG, {\n viewBox: \"0 0 24 24\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, createElement(Path, {\n d: \"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z\"\n}));\nexport default image;\n//# sourceMappingURL=image.js.map","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport { decodeEntities } from '@wordpress/html-entities';\r\nimport { escapeAttribute } from \"@wordpress/escape-html\";\r\nimport {\r\n\tInspectorControls,\r\n\tstore as blockEditorStore,\r\n\tRichText,\r\n\tuseBlockProps,\r\n} from '@wordpress/block-editor';\r\nimport { useDispatch, useSelect, select } from '@wordpress/data';\r\nimport { isURL } from '@wordpress/url';\r\nimport {\r\n\tPanelBody,\r\n\tTextControl,\r\n\tToggleControl,\r\n\t__experimentalHStack as HStack,\r\n} from '@wordpress/components';\r\nimport { createBlock } from '@wordpress/blocks';\r\nimport ImageType from '../component/ImageType';\r\nimport { qsmIsEmpty, qsmStripTags, qsmDecodeHtml } from '../helper';\r\nexport default function Edit( props ) {\r\n\t\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context, mergeBlocks, onReplace,\r\nonRemove } = props;\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\tconst pageID = context['quiz-master-next/pageID'];\r\n\tconst questionID = context['quiz-master-next/questionID'];\r\n\tconst questionType = context['quiz-master-next/questionType'];\r\n\tconst answerType = context['quiz-master-next/answerType'];\r\n\tconst questionChanged = context['quiz-master-next/questionChanged'];\r\n\r\n\tconst name = 'qsm/quiz-answer-option';\r\n\tconst {\r\n\t\toptionID,\r\n\t\tcontent,\r\n\t\tcaption,\r\n\t\tpoints,\r\n\t\tisCorrect\r\n\t} = attributes;\r\n\r\n\tconst {\r\n\t\tselectBlock,\r\n\t} = useDispatch( blockEditorStore );\r\n\r\n\t//Use to to update block attributes using clientId\r\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\r\n\r\n\tconst questionClientID = useSelect(\r\n\t\t( select ) => {\r\n\t\t\t//get parent gutena form clientIds\r\n\t\t\tlet questionClientID = select( blockEditorStore ).getBlockParentsByBlockName( clientId,'qsm/quiz-question', true );\r\n\t\t\treturn qsmIsEmpty( questionClientID ) ? '': questionClientID[0];\r\n\t\t},\r\n\t\t[ clientId ]\r\n\t);\r\n\r\n\t//detect change in question\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetChanged = true;\r\n\t\tif ( shouldSetChanged && isSelected && ! qsmIsEmpty( questionClientID ) && false === questionChanged ) {\r\n\t\t\tupdateBlockAttributes( questionClientID, { isChanged: true } );\r\n\t\t}\r\n\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetChanged = false;\r\n\t\t};\r\n\t}, [\r\n\t\tcontent,\r\n\t\tcaption,\r\n\t\tpoints,\r\n\t\tisCorrect\r\n\t] )\r\n\r\n\t/**Initialize block from server */\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetQSMAttr = true;\r\n\t\tif ( shouldSetQSMAttr ) {\r\n\t\t\tif ( ! qsmIsEmpty( content ) && isURL( content ) && ( -1 !== content.indexOf('https://') || -1 !== content.indexOf('http://') ) && ['rich','text'].includes( answerType ) ) {\r\n\t\t\t\tsetAttributes({\r\n\t\t\t\t\tcontent:'',\r\n\t\t\t\t\tcaption:''\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetQSMAttr = false;\r\n\t\t};\r\n\t\t\r\n\t}, [ answerType ] );\r\n\r\n\tconst blockProps = useBlockProps( {\r\n\t\tclassName: isSelected ? ' is-highlighted ': '',\r\n\t} );\r\n\r\n\tconst inputType = ['4','10'].includes( questionType ) ? \"checkbox\":\"radio\";\r\n\t\r\n\treturn (\r\n\t<>\r\n\t\r\n\t\t\r\n\t\t\t{ /**Image answer option */\r\n\t\t\t\t'image' === answerType &&\r\n\t\t\t\t setAttributes( { caption: escapeAttribute( caption ) } ) }\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\t setAttributes( { points } ) }\r\n\t\t\t/>\r\n\t\t\t{\r\n\t\t\t\t['0','4','1','10', '2'].includes( questionType ) &&\r\n\t\t\t\t setAttributes( { isCorrect : ( ( ! qsmIsEmpty( isCorrect ) && '1' == isCorrect ) ? 0 : 1 ) } ) }\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\r\n\t\r\n\t
\r\n\t\t\r\n \t\t\r\n\t\t{ /**Text answer option*/\r\n\t\t\t! ['rich','image'].includes( answerType ) && \r\n\t\t\t setAttributes( { content: qsmStripTags( decodeEntities( content ) ) } ) }\r\n\t\t\t\tonSplit={ ( value, isOriginal ) => {\r\n\t\t\t\t\tlet newAttributes;\r\n\r\n\t\t\t\t\tif ( isOriginal || value ) {\r\n\t\t\t\t\t\tnewAttributes = {\r\n\t\t\t\t\t\t\t...attributes,\r\n\t\t\t\t\t\t\tcontent: value,\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst block = createBlock( name, newAttributes );\r\n\r\n\t\t\t\t\tif ( isOriginal ) {\r\n\t\t\t\t\t\tblock.clientId = clientId;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn block;\r\n\t\t\t\t} }\r\n\t\t\t\tonMerge={ mergeBlocks }\r\n\t\t\t\tonReplace={ onReplace }\r\n\t\t\t\tonRemove={ onRemove }\r\n\t\t\t\tallowedFormats={ [ ] }\r\n\t\t\t\twithoutInteractiveFormatting\r\n\t\t\t\tclassName={ 'qsm-question-answer-option' }\r\n\t\t\t\tidentifier='text'\r\n\t\t\t/>\r\n\t\t}\r\n\t\t{ /**Rich Text answer option */\r\n\t\t 'rich' === answerType && \r\n\t\t\t setAttributes( { content } ) }\r\n\t\t\t\tonSplit={ ( value, isOriginal ) => {\r\n\t\t\t\t\tlet newAttributes;\r\n\r\n\t\t\t\t\tif ( isOriginal || value ) {\r\n\t\t\t\t\t\tnewAttributes = {\r\n\t\t\t\t\t\t\t...attributes,\r\n\t\t\t\t\t\t\tcontent: value,\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst block = createBlock( name, newAttributes );\r\n\r\n\t\t\t\t\tif ( isOriginal ) {\r\n\t\t\t\t\t\tblock.clientId = clientId;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn block;\r\n\t\t\t\t} }\r\n\t\t\t\tonMerge={ mergeBlocks }\r\n\t\t\t\tonReplace={ onReplace }\r\n\t\t\t\tonRemove={ onRemove }\r\n\t\t\t\tclassName={ 'qsm-question-answer-option' }\r\n\t\t\t\tidentifier='text'\r\n\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t/>\r\n\t\t}\r\n\t\t{ /**Image answer option */\r\n\t\t\t'image' === answerType &&\r\n\t\t\t setAttributes({\r\n\t\t\t\tcontent: isURL( url ) ? url: '',\r\n\t\t\t\tcaption: caption\r\n\t\t\t}) }\r\n\t\t\t/>\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t
\r\n\t\r\n\t);\r\n}\r\n","/**\r\n * Image Component: Upload, Use media, external image url\r\n */\r\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\r\nimport {\r\n\tButton,\r\n\tSpinner,\r\n} from '@wordpress/components';\r\nimport { useDispatch, useSelect } from '@wordpress/data';\r\nimport {\r\n\tBlockControls,\r\n\tBlockIcon,\r\n\tMediaReplaceFlow,\r\n\tMediaPlaceholder,\r\n\tstore as blockEditorStore,\r\n} from '@wordpress/block-editor';\r\nimport { useEffect, useRef, useState } from '@wordpress/element';\r\nimport { __ } from '@wordpress/i18n';\r\nimport { image as icon } from '@wordpress/icons';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { isURL } from '@wordpress/url';\r\nimport { qsmIsEmpty } from '../helper';\r\n\r\nexport const pickRelevantMediaFiles = ( image, size ) => {\r\n\tconst imageProps = Object.fromEntries(\r\n\t\tObject.entries( image ?? {} ).filter( ( [ key ] ) =>\r\n\t\t\t[ 'alt', 'id', 'link', 'caption' ].includes( key )\r\n\t\t)\r\n\t);\r\n\r\n\timageProps.url =\r\n\t\timage?.sizes?.[ size ]?.url ||\r\n\t\timage?.media_details?.sizes?.[ size ]?.source_url ||\r\n\t\timage.url;\r\n\treturn imageProps;\r\n};\r\n\r\n/**\r\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\r\n * while the image is being uploaded and will not have an id yet allocated.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the URL a Blob URL\r\n */\r\nconst isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );\r\n\r\n/**\r\n * Is the url for the image hosted externally. An externally hosted image has no\r\n * id and is not a blob url.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the url an externally hosted url?\r\n */\r\nexport const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\r\n\r\n\r\nexport function ImageType( {\r\n\turl = '',\r\n\tcaption = '',\r\n\talt = '',\r\n\tsetURLCaption,\r\n} ) {\r\n\t\r\n\tconst ALLOWED_MEDIA_TYPES = [ 'image' ];\r\n\tconst [ id, setId ] = useState( null );\r\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\r\n\r\n\tconst ref = useRef();\r\n\tconst { imageDefaultSize, mediaUpload } = useSelect( ( select ) => {\r\n\t\tconst { getSettings } = select( blockEditorStore );\r\n\t\tconst settings = getSettings();\r\n\t\treturn {\r\n\t\t\timageDefaultSize: settings.imageDefaultSize,\r\n\t\t\tmediaUpload: settings.mediaUpload,\r\n\t\t};\r\n\t}, [] );\r\n\r\n\tconst { createErrorNotice } = useDispatch( noticesStore );\r\n\tfunction onUploadError( message ) {\r\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\r\n\t\tsetURLCaption( undefined, undefined );\r\n\t\tsetTemporaryURL( undefined );\r\n\t}\r\n\r\n\tfunction onSelectImage( media ) {\r\n\t\tif ( ! media || ! media.url ) {\r\n\t\t\tsetURLCaption( undefined, undefined );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif ( isBlobURL( media.url ) ) {\r\n\t\t\tsetTemporaryURL( media.url );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tsetTemporaryURL();\r\n\r\n\t\tlet mediaAttributes = pickRelevantMediaFiles( media, imageDefaultSize );\r\n\t\tsetId( mediaAttributes.id );\r\n\t\tsetURLCaption( mediaAttributes.url, mediaAttributes.caption );\r\n\t}\r\n\r\n\tfunction onSelectURL( newURL ) {\r\n\t\tif ( newURL !== url ) {\r\n\t\t\tsetURLCaption( newURL, caption );\r\n\t\t}\r\n\t}\r\n\r\n\tlet isTemp = isTemporaryImage( id, url );\r\n\r\n\t// Upload a temporary image on mount.\r\n\tuseEffect( () => {\r\n\t\tif ( ! isTemp ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst file = getBlobByURL( url );\r\n\r\n\t\tif ( file ) {\r\n\t\t\tmediaUpload( {\r\n\t\t\t\tfilesList: [ file ],\r\n\t\t\t\tonFileChange: ( [ img ] ) => {\r\n\t\t\t\t\tonSelectImage( img );\r\n\t\t\t\t},\r\n\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\r\n\t\t\t\tonError: ( message ) => {\r\n\t\t\t\t\tisTemp = false;\r\n\t\t\t\t\tonUploadError( message );\r\n\t\t\t\t},\r\n\t\t\t} );\r\n\t\t}\r\n\t}, [] );\r\n\r\n\t// If an image is temporary, revoke the Blob url when it is uploaded (and is\r\n\t// no longer temporary).\r\n\tuseEffect( () => {\r\n\t\tif ( isTemp ) {\r\n\t\t\tsetTemporaryURL( url );\r\n\t\t\treturn;\r\n\t\t}\r\n\t\trevokeBlobURL( temporaryURL );\r\n\t}, [ isTemp, url ] );\r\n\r\n\tconst isExternal = isExternalImage( id, url );\r\n\tconst src = isExternal ? url : undefined;\r\n\tconst mediaPreview = !! url && (\r\n\t\t\r\n\t);\r\n\r\n\tlet img = (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t{ temporaryURL && }\r\n\t\t\r\n\t);\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t{ qsmIsEmpty( url ) ? (\r\n\t\t\t\t }\r\n\t\t\t\t\tonSelect={ onSelectImage }\r\n\t\t\t\t\tonSelectURL={ onSelectURL }\r\n\t\t\t\t\tonError={ onUploadError }\r\n\t\t\t\t\taccept=\"image/*\"\r\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\r\n\t\t\t\t\tvalue={ { id, src } }\r\n\t\t\t\t\tmediaPreview={ mediaPreview }\r\n\t\t\t\t\tdisableMediaButtons={ temporaryURL || url }\r\n\t\t\t\t/>\r\n\t\t\t) : (\r\n\t\t\t<>\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t
{ img }
\r\n\t\t\t\r\n\t\t\t) }\r\n\t\t
\r\n\t);\r\n}\r\n\r\nexport default ImageType;\r\n","import { Icon } from '@wordpress/components';\r\n//QSM Quiz Block\r\nexport const qsmBlockIcon = () => (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Warning icon\r\nexport const warningIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n//Match array of object values and return array of cooresponding matching keys \r\nexport const qsmMatchingValueKeyArray = ( values, obj ) => {\r\n\tif ( qsmIsEmpty( obj ) || ! Array.isArray( values ) ) {\r\n\t\treturn values;\r\n\t}\r\n\treturn values.map( ( val ) => Object.keys(obj).find( key => obj[key] == val) );\r\n}\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//Generate random number\r\nexport const qsmGenerateRandomKey = (length) => {\r\n const charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n let key = \"\";\r\n\r\n // Generate random bytes\r\n const values = new Uint8Array(length);\r\n window.crypto.getRandomValues(values);\r\n\r\n for (let i = 0; i < length; i++) {\r\n // Use the random byte to index into the charset\r\n key += charset[values[i] % charset.length];\r\n }\r\n\r\n return key;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const id = qsmGenerateRandomKey(8);\r\n return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(7) }`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blob\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"escapeHtml\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","module.exports = window[\"wp\"][\"primitives\"];","module.exports = window[\"wp\"][\"url\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { answerOptionBlockIcon } from \"../component/icon\";\r\n\r\nregisterBlockType( metadata.name, {\r\n\ticon: answerOptionBlockIcon,\r\n\t__experimentalLabel( attributes, { context } ) {\r\n\t\tconst { content } = attributes;\r\n\r\n\t\tconst customName = attributes?.metadata?.name;\r\n\t\tconst hasContent = content?.length > 0;\r\n\r\n\t\t// In the list view, use the answer content as the label.\r\n\t\t// If the content is empty, fall back to the default label.\r\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\r\n\t\t\treturn customName || content;\r\n\t\t}\r\n\t},\r\n\tmerge( attributes, attributesToMerge ) {\r\n\t\treturn {\r\n\t\t\tcontent:\r\n\t\t\t\t( attributes.content || '' ) +\r\n\t\t\t\t( attributesToMerge.content || '' ),\r\n\t\t};\r\n\t},\r\n\tedit: Edit,\r\n} );\r\n"],"names":["__","useState","useEffect","decodeEntities","escapeAttribute","InspectorControls","store","blockEditorStore","RichText","useBlockProps","useDispatch","useSelect","select","isURL","PanelBody","TextControl","ToggleControl","__experimentalHStack","HStack","createBlock","ImageType","qsmIsEmpty","qsmStripTags","qsmDecodeHtml","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","mergeBlocks","onReplace","onRemove","quizID","pageID","questionID","questionType","answerType","questionChanged","name","optionID","content","caption","points","isCorrect","selectBlock","updateBlockAttributes","questionClientID","getBlockParentsByBlockName","shouldSetChanged","isChanged","shouldSetQSMAttr","indexOf","includes","blockProps","inputType","createElement","Fragment","title","initialOpen","type","label","value","onChange","help","checked","spacing","justify","disabled","readOnly","tabIndex","tagName","placeholder","onSplit","isOriginal","newAttributes","block","onMerge","allowedFormats","withoutInteractiveFormatting","identifier","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","url","setURLCaption","getBlobByURL","isBlobURL","revokeBlobURL","Button","Spinner","BlockControls","BlockIcon","MediaReplaceFlow","MediaPlaceholder","useRef","image","icon","noticesStore","pickRelevantMediaFiles","size","imageProps","Object","fromEntries","entries","filter","key","sizes","media_details","source_url","isTemporaryImage","id","isExternalImage","alt","ALLOWED_MEDIA_TYPES","setId","temporaryURL","setTemporaryURL","ref","imageDefaultSize","mediaUpload","getSettings","settings","createErrorNotice","onUploadError","message","undefined","onSelectImage","media","mediaAttributes","onSelectURL","newURL","isTemp","file","filesList","onFileChange","img","allowedTypes","onError","isExternal","src","mediaPreview","style","width","height","onSelect","accept","disableMediaButtons","group","mediaId","mediaURL","Icon","qsmBlockIcon","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","warningIcon","stroke","strokeWidth","strokeLinecap","strokeLinejoin","data","qsmUniqueArray","arr","Array","isArray","val","index","qsmMatchingValueKeyArray","values","obj","map","keys","find","html","txt","document","innerHTML","qsmSanitizeName","toLowerCase","replace","text","div","innerText","qsmFormData","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmGenerateRandomKey","length","charset","Uint8Array","window","crypto","getRandomValues","i","qsmUniqid","prefix","random","qsmValueOrDefault","defaultValue","registerBlockType","metadata","__experimentalLabel","customName","hasContent","merge","attributesToMerge","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index fcc253b7e..8857aa170 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '5cf62a5252dcf32b6416'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '9c4f482f975570876da5'); diff --git a/blocks/build/index.css b/blocks/build/index.css index 5e09f7bc5..a877bdc3d 100644 --- a/blocks/build/index.css +++ b/blocks/build/index.css @@ -1,116 +1 @@ -/*!****************************************************************************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! - \****************************************************************************************************************************************************************************************************************************************/ -/** - * The following styles get applied inside the editor only. - * - * Replace them with your own styles or remove the file completely. - */ -.block-editor-block-inspector .qsm-inspector-label { - font-size: 11px; - font-weight: 500; - line-height: 1.4; - text-transform: uppercase; - display: inline-block; - margin-bottom: 0.5rem; - padding: 0px; -} -.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value { - padding-left: 0.5rem; -} -.block-editor-block-inspector .qsm-inspector-label-value { - font-weight: 400; - text-transform: capitalize; -} -.block-editor-block-inspector .qsm-no-mb { - margin-bottom: 0; -} - -.qsm-placeholder-select-create-quiz { - display: flex; - gap: 1rem; - align-items: center; - margin-bottom: 1rem; -} -.qsm-placeholder-select-create-quiz .components-base-control { - max-width: 50%; -} - -.qsm-ptb-1 { - padding: 1rem 0; -} - -.qsm-error-text { - color: #FD3E3E; -} - -.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset { - flex-direction: column; -} -.editor-styles-wrapper .qsm-advance-settings { - display: flex; - flex-direction: column; - gap: 2rem; -} - -.qsm-placeholder-quiz-create-form { - width: 75%; -} -.qsm-placeholder-quiz-create-form .components-button { - width: -moz-fit-content; - width: fit-content; -} - -.wp-block-qsm-quiz-question { - /*Question Title*/ - /*Question description*/ - /*Question options*/ - /*Question block in editing mode*/ -} -.wp-block-qsm-quiz-question .qsm-question-title { - color: #1f8cbe; - font-size: 1.38rem; -} -.wp-block-qsm-quiz-question .qsm-question-description, -.wp-block-qsm-quiz-question .qsm-question-correct-answer-info, -.wp-block-qsm-quiz-question .qsm-question-hint { - font-size: 1rem; - color: #666666; -} -.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input:disabled { - border-color: inherit; -} -.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=radio]:disabled, .wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=checkbox]:disabled { - opacity: 1; -} -.wp-block-qsm-quiz-question .qsm-question-answer-option { - color: #666666; - font-size: 0.9rem; - margin-left: 1rem; -} -.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title { - color: #666666; -} -.wp-block-qsm-quiz-question .add-new-question-btn { - margin-top: 2rem; -} - -.qsm-advance-q-modal { - text-align: center; - justify-content: center; - max-width: 580px; -} -.qsm-advance-q-modal .qsm-title { - margin-top: 0; -} -.qsm-advance-q-modal .qsm-modal-btn-wrapper { - display: flex; - gap: 1rem; - justify-content: center; -} -.qsm-advance-q-modal .qsm-modal-btn-wrapper .components-external-link { - color: #ffffff; - text-decoration: none; -} - -/*# sourceMappingURL=index.css.map*/ \ No newline at end of file +.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.editor-styles-wrapper .qsm-advance-settings{display:flex;flex-direction:column;gap:2rem}.qsm-placeholder-quiz-create-form{width:75%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{color:#666;font-size:1rem}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input:disabled{border-color:inherit}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=checkbox]:disabled,.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=radio]:disabled{opacity:1}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666}.wp-block-qsm-quiz-question .add-new-question-btn{margin-top:2rem}.qsm-advance-q-modal{justify-content:center;max-width:580px;text-align:center}.qsm-advance-q-modal .qsm-title{margin-top:0}.qsm-advance-q-modal .qsm-modal-btn-wrapper{display:flex;gap:1rem;justify-content:center}.qsm-advance-q-modal .qsm-modal-btn-wrapper .components-external-link{color:#fff;text-decoration:none} diff --git a/blocks/build/index.css.map b/blocks/build/index.css.map deleted file mode 100644 index 99daf30c7..000000000 --- a/blocks/build/index.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAUI;EACI;EACA;EACA;EACA;EACA;EACA;EACA;AAJR;AAKQ;EACI;AAHZ;AAMI;EACI;EACA;AAJR;AAOI;EACI;AALR;;AAQA;EACI;EACA;EACA;EACA;AALJ;AAMI;EACI;AAJR;;AAQA;EACI;AALJ;;AAQA;EACI;AALJ;;AAWQ;EACI;AARZ;AAYI;EACI;EACA;EACA;AAVR;;AAcA;EACI;AAXJ;AAYI;EACI;EAAA;AAVR;;AAcA;EACI;EAMA;EAQA;EAeA;AArCJ;AASI;EACI,cAnEiB;EAoEjB;AAPR;AAWI;;;EAGI;EACA,cA7Ea;AAoErB;AAcQ;EACI;AAZZ;AAcQ;EACI;AAZZ;AAeI;EACI,cA1Fa;EA2Fb;EACA;AAbR;AAkBQ;EACI,cAlGS;AAkFrB;AAoBI;EACI;AAlBR;;AAuBA;EACI;EACA;EACA;AApBJ;AAqBI;EACI;AAnBR;AAqBI;EACI;EACA;EACA;AAnBR;AAoBQ;EACI;EACA;AAlBZ,C","sources":["webpack://qsm/./src/editor.scss"],"sourcesContent":["/**\r\n * The following styles get applied inside the editor only.\r\n *\r\n * Replace them with your own styles or remove the file completely.\r\n */\r\n\r\n $qsm_primary_color: #666666;\r\n $qsm_wp_primary_color : #1f8cbe;\r\n\r\n.block-editor-block-inspector{\r\n .qsm-inspector-label{\r\n font-size: 11px;\r\n font-weight: 500;\r\n line-height: 1.4;\r\n text-transform: uppercase;\r\n display: inline-block;\r\n margin-bottom: 0.5rem;\r\n padding: 0px;\r\n .qsm-inspector-label-value{\r\n padding-left: 0.5rem;\r\n }\r\n }\r\n .qsm-inspector-label-value{\r\n font-weight: 400; \r\n text-transform: capitalize;\r\n }\r\n\r\n .qsm-no-mb{\r\n margin-bottom: 0;\r\n }\r\n}\r\n.qsm-placeholder-select-create-quiz{\r\n display: flex;\r\n gap: 1rem;\r\n align-items: center;\r\n margin-bottom: 1rem;\r\n .components-base-control{\r\n max-width: 50%;\r\n }\r\n}\r\n\r\n.qsm-ptb-1{\r\n padding: 1rem 0;\r\n}\r\n\r\n.qsm-error-text{\r\n color: #FD3E3E;\r\n}\r\n\r\n//Create or select quiz placeholder\r\n.editor-styles-wrapper {\r\n .qsm-placeholder-wrapper{\r\n .components-placeholder__fieldset {\r\n flex-direction: column;\r\n }\r\n }\r\n\r\n .qsm-advance-settings{\r\n display: flex;\r\n flex-direction: column;\r\n gap: 2rem;\r\n }\r\n}\r\n\r\n.qsm-placeholder-quiz-create-form{\r\n width: 75%;\r\n .components-button{\r\n width: fit-content;\r\n }\r\n}\r\n\r\n.wp-block-qsm-quiz-question {\r\n /*Question Title*/\r\n .qsm-question-title {\r\n color: $qsm_wp_primary_color;\r\n font-size: 1.38rem;\r\n }\r\n\r\n /*Question description*/\r\n .qsm-question-description, \r\n .qsm-question-correct-answer-info,\r\n .qsm-question-hint {\r\n font-size: 1rem;\r\n color: $qsm_primary_color;\r\n }\r\n\r\n /*Question options*/\r\n .wp-block-qsm-quiz-answer-option{\r\n input:disabled{\r\n border-color: inherit;\r\n }\r\n input[type=\"radio\"]:disabled, input[type=\"checkbox\"]:disabled{\r\n opacity: 1;\r\n }\r\n }\r\n .qsm-question-answer-option{\r\n color: $qsm_primary_color;\r\n font-size: 0.9rem;\r\n margin-left: 1rem;\r\n }\r\n\r\n /*Question block in editing mode*/\r\n &.in-editing-mode{\r\n .qsm-question-title{\r\n color: $qsm_primary_color;\r\n }\r\n }\r\n\r\n .add-new-question-btn{\r\n margin-top: 2rem;\r\n }\r\n \r\n}\r\n\r\n.qsm-advance-q-modal{\r\n text-align: center;\r\n justify-content: center;\r\n max-width: 580px;\r\n .qsm-title{\r\n margin-top: 0;\r\n }\r\n .qsm-modal-btn-wrapper{\r\n display: flex;\r\n gap: 1rem;\r\n justify-content: center;\r\n .components-external-link{\r\n color: #ffffff;\r\n text-decoration: none;\r\n }\r\n }\r\n}"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/index.js b/blocks/build/index.js index 7aa029705..cb9889692 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1,1321 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/component/InputComponent.js": -/*!*****************************************!*\ - !*** ./src/component/InputComponent.js ***! - \*****************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ InputComponent; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - -/** - * Create Input component based on data provided - * id: attribute name - * type: input type - */ -const noop = () => {}; -function InputComponent({ - className = '', - quizAttr, - setAttributes, - data, - onChangeFunc = noop -}) { - var _quizAttr$id, _quizAttr$id2, _quizAttr$id3, _quizAttr$id4, _quizAttr$id5; - const processData = () => { - data.defaultvalue = data.default; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(data?.options)) { - switch (data.type) { - case 'checkbox': - if (1 === data.options.length) { - data.type = 'toggle'; - } - data.label = data.options[0].label; - break; - case 'radio': - if (1 == data.options.length) { - data.label = data.options[0].label; - data.type = 'toggle'; - } else { - data.type = 'select'; - } - break; - default: - break; - } - } - data.label = (0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(data.label) ? '' : (0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmStripTags)(data.label); - data.help = (0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(data.help) ? '' : (0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmStripTags)(data.help); - return data; - }; - const newData = processData(); - const { - id, - label = '', - type, - help = '', - options = [], - defaultvalue - } = newData; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, 'toggle' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: label, - help: help, - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(quizAttr[id]) && '1' == quizAttr[id], - onChange: () => onChangeFunc(!(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(quizAttr[id]) && '1' == quizAttr[id] ? 0 : 1, id) - }), 'select' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.SelectControl, { - label: label, - value: (_quizAttr$id = quizAttr[id]) !== null && _quizAttr$id !== void 0 ? _quizAttr$id : defaultvalue, - options: options, - onChange: val => onChangeFunc(val, id), - help: help, - __nextHasNoMarginBottom: true - }), 'number' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextControl, { - type: "number", - label: label, - value: (_quizAttr$id2 = quizAttr[id]) !== null && _quizAttr$id2 !== void 0 ? _quizAttr$id2 : defaultvalue, - onChange: val => onChangeFunc(val, id), - help: help, - __nextHasNoMarginBottom: true - }), 'text' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextControl, { - type: "text", - label: label, - value: (_quizAttr$id3 = quizAttr[id]) !== null && _quizAttr$id3 !== void 0 ? _quizAttr$id3 : defaultvalue, - onChange: val => onChangeFunc(val, id), - help: help, - __nextHasNoMarginBottom: true - }), 'textarea' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextareaControl, { - label: label, - value: (_quizAttr$id4 = quizAttr[id]) !== null && _quizAttr$id4 !== void 0 ? _quizAttr$id4 : defaultvalue, - onChange: val => onChangeFunc(val, id), - help: help, - __nextHasNoMarginBottom: true - }), 'checkbox' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.CheckboxControl, { - label: label, - help: help, - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(quizAttr[id]) && '1' == quizAttr[id], - onChange: () => onChangeFunc(!(0,_helper__WEBPACK_IMPORTED_MODULE_3__.qsmIsEmpty)(quizAttr[id]) && '1' == quizAttr[id] ? 0 : 1, id) - }), 'radio' === type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.RadioControl, { - label: label, - help: help, - selected: (_quizAttr$id5 = quizAttr[id]) !== null && _quizAttr$id5 !== void 0 ? _quizAttr$id5 : defaultvalue, - options: options, - onChange: val => onChangeFunc(val, id) - })); -} - -/***/ }), - -/***/ "./src/component/icon.js": -/*!*******************************!*\ - !*** ./src/component/icon.js ***! - \*******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ answerOptionBlockIcon: function() { return /* binding */ answerOptionBlockIcon; }, -/* harmony export */ qsmBlockIcon: function() { return /* binding */ qsmBlockIcon; }, -/* harmony export */ questionBlockIcon: function() { return /* binding */ questionBlockIcon; }, -/* harmony export */ warningIcon: function() { return /* binding */ warningIcon; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); - - -//QSM Quiz Block -const qsmBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "3", - fill: "black" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z", - fill: "white" - })) -}); - -//Question Block -const questionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "25", - height: "25", - viewBox: "0 0 25 25", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "0.102539", - y: "0.101562", - width: "24", - height: "24", - rx: "4.68852", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z", - fill: "white" - })) -}); - -//Answer option Block -const answerOptionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "4.21657", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z", - fill: "white" - })) -}); - -//Warning icon -const warningIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "54", - height: "54", - viewBox: "0 0 54 54", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z", - stroke: "#B45309", - strokeWidth: "1.65929", - strokeLinecap: "round", - strokeLinejoin: "round" - })) -}); - -/***/ }), - -/***/ "./src/edit.js": -/*!*********************!*\ - !*** ./src/edit.js ***! - \*********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); -/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); -/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./helper */ "./src/helper.js"); -/* harmony import */ var _component_InputComponent__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./component/InputComponent */ "./src/component/InputComponent.js"); -/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./component/icon */ "./src/component/icon.js"); - - - - - - - - - - - - - - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId - } = props; - const { - createNotice - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__.store); - //quiz attribute - const globalQuizsetting = qsmBlockData.globalQuizsetting; - const { - quizID, - postID, - quizAttr = globalQuizsetting - } = attributes; - - //quiz list - const [quizList, setQuizList] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.QSMQuizList); - //quiz list - const [quizMessage, setQuizMessage] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)({ - error: false, - msg: '' - }); - //whether creating a new quiz - const [createQuiz, setCreateQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //whether saving quiz - const [saveQuiz, setSaveQuiz] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //whether to show advance option - const [showAdvanceOption, setShowAdvanceOption] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //Quiz template on set Quiz ID - const [quizTemplate, setQuizTemplate] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)([]); - //Quiz Options to create attributes label, description and layout - const quizOptions = qsmBlockData.quizOptions; - - //check if page is saving - const isSavingPage = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(select => { - const { - isAutosavingPost, - isSavingPost - } = select(_wordpress_editor__WEBPACK_IMPORTED_MODULE_7__.store); - return isSavingPost() && !isAutosavingPost(); - }, []); - const { - getBlock - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); - - /**Initialize block from server */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) { - //add upgrade modal - if ('0' == qsmBlockData.is_pro_activated) { - setTimeout(() => { - addUpgradePopupHtml(); - }, 100); - } - //initialize QSM block - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizID) && 0 < quizID) { - //Check if quiz exists - let hasQuiz = false; - quizList.forEach(quizElement => { - if (quizID == quizElement.value) { - hasQuiz = true; - return true; - } - }); - if (hasQuiz) { - initializeQuizAttributes(quizID); - } else { - setAttributes({ - quizID: undefined - }); - setQuizMessage({ - error: true, - msg: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz not found. Please select an existing quiz or create a new one.', 'quiz-master-next') - }); - } - } - } - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, []); - - /**Add modal advanced-question-type */ - const addUpgradePopupHtml = () => { - let modalEl = document.getElementById('modal-advanced-question-type'); - if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(modalEl)) { - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup', - method: 'POST' - }).then(res => { - let bodyEl = document.getElementById('wpbody-content'); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(bodyEl) && 'success' == res.status) { - bodyEl.insertAdjacentHTML('afterbegin', res.result); - } - }).catch(error => { - console.log('error', error); - }); - } - }; - - /**Initialize quiz attributes: first time render only */ - const initializeQuizAttributes = quiz_id => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quiz_id) && 0 < quiz_id) { - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/structure', - method: 'POST', - data: { - quizID: quiz_id - } - }).then(res => { - if ('success' == res.status) { - setQuizMessage({ - error: false, - msg: '' - }); - let result = res.result; - setAttributes({ - quizID: parseInt(quiz_id), - postID: result.post_id, - quizAttr: { - ...quizAttr, - ...result - } - }); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(result.qpages)) { - let quizTemp = []; - result.qpages.forEach(page => { - let questions = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(page.question_arr)) { - page.question_arr.forEach(question => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(question)) { - let answers = []; - //answers options blocks - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(question.answers) && 0 < question.answers.length) { - question.answers.forEach((answer, aIndex) => { - answers.push(['qsm/quiz-answer-option', { - optionID: aIndex, - content: answer[0], - points: answer[1], - isCorrect: answer[2], - caption: (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answer[3]) - }]); - }); - } - //question blocks - questions.push(['qsm/quiz-question', { - questionID: question.question_id, - type: question.question_type_new, - answerEditor: question.settings.answerEditor, - title: question.settings.question_title, - description: question.question_name, - required: question.settings.required, - hint: question.hints, - answers: question.answers, - correctAnswerInfo: question.question_answer_info, - category: question.category, - multicategories: question.multicategories, - commentBox: question.comments, - matchAnswer: question.settings.matchAnswer, - featureImageID: question.settings.featureImageID, - featureImageSrc: question.settings.featureImageSrc, - settings: question.settings - }, answers]); - } - }); - } - quizTemp.push(['qsm/quiz-page', { - pageID: page.id, - pageKey: page.pagekey, - hidePrevBtn: page.hide_prevbtn, - quizID: page.quizID - }, questions]); - }); - setQuizTemplate(quizTemp); - } - } else { - console.log("error " + res.msg); - } - }).catch(error => { - console.log('error', error); - }); - } - }; - - /** - * - * @returns Placeholder for quiz in case quiz ID is not set - */ - const quizPlaceholder = () => { - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Placeholder, { - className: "qsm-placeholder-wrapper", - icon: _component_icon__WEBPACK_IMPORTED_MODULE_12__.qsmBlockIcon, - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz And Survey Master', 'quiz-master-next'), - instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Easily and quickly add quizzes and surveys inside the block editor.', 'quiz-master-next') - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizList) && 0 < quizList.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "qsm-placeholder-select-create-quiz" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.SelectControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('', 'quiz-master-next'), - value: quizID, - options: quizList, - onChange: quizID => initializeQuizAttributes(quizID), - disabled: createQuiz, - __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('OR', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, { - variant: "link", - onClick: () => setCreateQuiz(!createQuiz) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New', 'quiz-master-next'))), ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizList) || createQuiz) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.__experimentalVStack, { - spacing: "3", - className: "qsm-placeholder-quiz-create-form" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.TextControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), - value: quizAttr?.quiz_name || '', - onChange: val => setQuizAttributes(val, 'quiz_name') - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, { - variant: "link", - onClick: () => setShowAdvanceOption(!showAdvanceOption) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance options', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "qsm-advance-settings" - }, showAdvanceOption && quizOptions.map(qSetting => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_InputComponent__WEBPACK_IMPORTED_MODULE_11__["default"], { - key: 'qsm-settings' + qSetting.id, - data: qSetting, - quizAttr: quizAttr, - setAttributes: setAttributes, - onChangeFunc: setQuizAttributes - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, { - variant: "primary", - disabled: saveQuiz || (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizAttr.quiz_name), - onClick: () => createNewQuiz() - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Create Quiz', 'quiz-master-next'))), quizMessage.error && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { - className: "qsm-error-text" - }, quizMessage.msg))); - }; - - /** - * Set attribute value - * @param { any } value attribute value to set - * @param { string } attr_name attribute name - */ - const setQuizAttributes = (value, attr_name) => { - let newAttr = quizAttr; - newAttr[attr_name] = value; - setAttributes({ - quizAttr: { - ...newAttr - } - }); - }; - - /** - * Prepare quiz data e.g. quiz details, questions, answers etc to save - * @returns quiz data - */ - const getQuizDataToSave = () => { - let blocks = getBlock(clientId); - if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(blocks)) { - return false; - } - blocks = blocks.innerBlocks; - let quizDataToSave = { - quiz_id: quizAttr.quiz_id, - post_id: quizAttr.post_id, - quiz: {}, - pages: [], - qpages: [], - questions: [] - }; - let pageSNo = 0; - //loop through inner blocks - blocks.forEach(block => { - if ('qsm/quiz-page' === block.name) { - let pageID = block.attributes.pageID; - let questions = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(block.innerBlocks) && 0 < block.innerBlocks.length) { - let questionBlocks = block.innerBlocks; - //Question Blocks - questionBlocks.forEach(questionBlock => { - if ('qsm/quiz-question' !== questionBlock.name) { - return true; - } - let questionAttr = questionBlock.attributes; - let answerEditor = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.answerEditor, 'text'); - let answers = []; - //Answer option blocks - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionBlock.innerBlocks) && 0 < questionBlock.innerBlocks.length) { - let answerOptionBlocks = questionBlock.innerBlocks; - answerOptionBlocks.forEach(answerOptionBlock => { - if ('qsm/quiz-answer-option' !== answerOptionBlock.name) { - return true; - } - let answerAttr = answerOptionBlock.attributes; - let answerContent = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerAttr?.content); - //if rich text - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(questionAttr?.answerEditor) && 'rich' === questionAttr.answerEditor) { - answerContent = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_3__.decodeEntities)(answerContent)); - } - let ans = [answerContent, (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerAttr?.points), (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(answerAttr?.isCorrect)]; - //answer options are image type - if ('image' === answerEditor && !(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(answerAttr?.caption)) { - ans.push(answerAttr?.caption); - } - answers.push(ans); - }); - } - - //questions Data - questions.push(questionAttr.questionID); - //update question only if changes occured - if (questionAttr.isChanged) { - quizDataToSave.questions.push({ - "id": questionAttr.questionID, - "quizID": quizAttr.quiz_id, - "postID": quizAttr.post_id, - "answerEditor": answerEditor, - "type": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.type, '0'), - "name": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.description)), - "question_title": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.title), - "answerInfo": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.correctAnswerInfo)), - "comments": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.commentBox, '1'), - "hint": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.hint), - "category": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.category), - "multicategories": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.multicategories, []), - "required": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.required, 0), - "answers": answers, - "featureImageID": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.featureImageID), - "featureImageSrc": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.featureImageSrc), - "page": pageSNo, - "other_settings": { - ...(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.settings, {}), - "required": (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmValueOrDefault)(questionAttr?.required, 0) - } - }); - } - }); - } - - // pages[0][]: 2512 - // qpages[0][id]: 2 - // qpages[0][quizID]: 76 - // qpages[0][pagekey]: Ipj90nNT - // qpages[0][hide_prevbtn]: 0 - // qpages[0][questions][]: 2512 - // post_id: 111 - //page data - quizDataToSave.pages.push(questions); - quizDataToSave.qpages.push({ - 'id': pageID, - 'quizID': quizAttr.quiz_id, - 'pagekey': (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(block.attributes.pageKey) ? (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmUniqid)() : block.attributes.pageKey, - 'hide_prevbtn': block.attributes.hidePrevBtn, - 'questions': questions - }); - pageSNo++; - } - }); - - //Quiz details - quizDataToSave.quiz = { - 'quiz_name': quizAttr.quiz_name, - 'quiz_id': quizAttr.quiz_id, - 'post_id': quizAttr.post_id - }; - if (showAdvanceOption) { - ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => { - if ('undefined' !== typeof quizAttr[item] && null !== quizAttr[item]) { - quizDataToSave.quiz[item] = quizAttr[item]; - } - }); - } - return quizDataToSave; - }; - - //saving Quiz on save page - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (isSavingPage) { - let quizData = getQuizDataToSave(); - //save quiz status - setSaveQuiz(true); - quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ - 'save_entire_quiz': '1', - 'quizData': JSON.stringify(quizData), - 'qsm_block_quiz_nonce': qsmBlockData.nonce, - "nonce": qsmBlockData.saveNonce //save pages nonce - }); - - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/save_quiz', - method: 'POST', - body: quizData - }).then(res => { - //create notice - createNotice(res.status, res.msg, { - isDismissible: true, - type: 'snackbar' - }); - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - } - }, [isSavingPage]); - - /** - * Create new quiz and set quiz ID - * - */ - const createNewQuiz = () => { - if ((0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizAttr.quiz_name)) { - console.log("empty quiz_name"); - return; - } - //save quiz status - setSaveQuiz(true); - let quizData = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ - 'quiz_name': quizAttr.quiz_name, - 'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce - }); - ['form_type', 'system', 'timer_limit', 'pagination', 'enable_contact_form', 'enable_pagination_quiz', 'show_question_featured_image_in_result', 'progress_bar', 'require_log_in', 'disable_first_page', 'comment_section'].forEach(item => 'undefined' === typeof quizAttr[item] || null === quizAttr[item] ? '' : quizData.append(item, quizAttr[item])); - - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/create_quiz', - method: 'POST', - body: quizData - }).then(res => { - //save quiz status - setSaveQuiz(false); - if ('success' == res.status) { - //create a question - let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ - "id": null, - "quizID": res.quizID, - "answerEditor": "text", - "type": "0", - "name": "", - "question_title": "", - "answerInfo": "", - "comments": "1", - "hint": "", - "category": "", - "required": 0, - "answers": [], - "page": 0 - }); - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/questions', - method: 'POST', - body: newQuestion - }).then(response => { - if ('success' == response.status) { - let question_id = response.id; - - /**Page attributes required format */ - // pages[0][]: 2512 - // qpages[0][id]: 2 - // qpages[0][quizID]: 76 - // qpages[0][pagekey]: Ipj90nNT - // qpages[0][hide_prevbtn]: 0 - // qpages[0][questions][]: 2512 - // post_id: 111 - - let newPage = (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmFormData)({ - "action": qsmBlockData.save_pages_action, - "quiz_id": res.quizID, - "nonce": qsmBlockData.saveNonce, - "post_id": res.quizPostID - }); - newPage.append('pages[0][]', question_id); - newPage.append('qpages[0][id]', 1); - newPage.append('qpages[0][quizID]', res.quizID); - newPage.append('qpages[0][pagekey]', (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmUniqid)()); - newPage.append('qpages[0][hide_prevbtn]', 0); - newPage.append('qpages[0][questions][]', question_id); - - //create a page - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - url: qsmBlockData.ajax_url, - method: 'POST', - body: newPage - }).then(pageResponse => { - if ('success' == pageResponse.status) { - //set new quiz - initializeQuizAttributes(res.quizID); - } - }); - } - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - } - - //create notice - createNotice(res.status, res.msg, { - isDismissible: true, - type: 'snackbar' - }); - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - }; - - /** - * Inner Blocks - */ - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)(); - const innerBlocksProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useInnerBlocksProps)(blockProps, { - template: quizTemplate, - allowedBlocks: ['qsm/quiz-page'] - }); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", { - className: "qsm-inspector-label" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Status', 'quiz-master-next') + ':', (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { - className: "qsm-inspector-label-value" - }, quizAttr.post_status)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.TextControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Quiz Name *', 'quiz-master-next'), - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enter a name for this Quiz', 'quiz-master-next'), - value: quizAttr?.quiz_name || '', - onChange: val => setQuizAttributes(val, 'quiz_name'), - className: "qsm-no-mb" - }), (!(0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizID) || '0' != quizID) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ExternalLink, { - href: qsmBlockData.quiz_settings_url + '&quiz_id=' + quizID + '&tab=options' - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advance Quiz Settings', 'quiz-master-next'))))), (0,_helper__WEBPACK_IMPORTED_MODULE_10__.qsmIsEmpty)(quizID) || '0' == quizID ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, " ", quizPlaceholder(), " ") : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...innerBlocksProps - })); -} - -/***/ }), - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, -/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmGenerateRandomKey: function() { return /* binding */ qsmGenerateRandomKey; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmMatchingValueKeyArray: function() { return /* binding */ qsmMatchingValueKeyArray; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; - -//Get Unique array values -const qsmUniqueArray = arr => { - if (qsmIsEmpty(arr) || !Array.isArray(arr)) { - return arr; - } - return arr.filter((val, index, arr) => arr.indexOf(val) === index); -}; - -//Match array of object values and return array of cooresponding matching keys -const qsmMatchingValueKeyArray = (values, obj) => { - if (qsmIsEmpty(obj) || !Array.isArray(values)) { - return values; - } - return values.map(val => Object.keys(obj).find(key => obj[key] == val)); -}; - -//Decode htmlspecialchars -const qsmDecodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; -}; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from text content. -const qsmStripTags = text => { - let div = document.createElement("div"); - div.innerHTML = qsmDecodeHtml(text); - return div.innerText; -}; - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - //add to check if api call from editor - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//add objecyt to form data -const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { - if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { - return data; - } - for (let key in valueObj) { - if (valueObj.hasOwnProperty(key)) { - let value = valueObj[key]; - if ('object' === value) { - qsmAddObjToFormData(formKey + '[' + key + ']', value, data); - } else { - data.append(formKey + '[' + key + ']', valueObj[key]); - } - } - } - return data; -}; - -//Generate random number -const qsmGenerateRandomKey = length => { - const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - let key = ""; - - // Generate random bytes - const values = new Uint8Array(length); - window.crypto.getRandomValues(values); - for (let i = 0; i < length; i++) { - // Use the random byte to index into the charset - key += charset[values[i] % charset.length]; - } - return key; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const id = qsmGenerateRandomKey(8); - return `${prefix}${id}${random ? `.${qsmGenerateRandomKey(7)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "./src/index.js": -/*!**********************!*\ - !*** ./src/index.js ***! - \**********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss"); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edit */ "./src/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/block.json"); -/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./component/icon */ "./src/component/icon.js"); -/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); -/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_6__); - - - - - - - -const save = props => null; -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, { - icon: _component_icon__WEBPACK_IMPORTED_MODULE_5__.qsmBlockIcon, - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_3__["default"], - save: save -}); -const withMyPluginControls = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_6__.createHigherOrderComponent)(BlockEdit => { - return props => { - const { - name, - className, - attributes, - setAttributes, - isSelected, - clientId, - context - } = props; - if ('core/group' !== name) { - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(BlockEdit, { - key: "edit", - ...props - }); - } - console.log("props", props); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(BlockEdit, { - key: "edit", - ...props - })); - }; -}, 'withMyPluginControls'); -wp.hooks.addFilter('editor.BlockEdit', 'my-plugin/with-inspector-controls', withMyPluginControls); - -/***/ }), - -/***/ "./src/editor.scss": -/*!*************************!*\ - !*** ./src/editor.scss ***! - \*************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "./src/style.scss": -/*!************************!*\ - !*** ./src/style.scss ***! - \************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/compose": -/*!*********************************!*\ - !*** external ["wp","compose"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["compose"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/editor": -/*!********************************!*\ - !*** external ["wp","editor"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["editor"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/html-entities": -/*!**************************************!*\ - !*** external ["wp","htmlEntities"] ***! - \**************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["htmlEntities"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "@wordpress/notices": -/*!*********************************!*\ - !*** external ["wp","notices"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["notices"]; - -/***/ }), - -/***/ "./src/block.json": -/*!************************!*\ - !*** ./src/block.json ***! - \************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz","version":"0.1.0","title":"QSM","category":"widgets","keywords":["Quiz","QSM Quiz","Survey","form","Quiz Block"],"icon":"vault","description":"Easily and quickly add quizzes and surveys inside the block editor.","attributes":{"quizID":{"type":"number","default":0},"postID":{"type":"number"},"quizAttr":{"type":"object"}},"providesContext":{"quiz-master-next/quizID":"quizID","quiz-master-next/quizAttr":"quizAttr"},"example":{},"supports":{"html":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = __webpack_modules__; -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/chunk loaded */ -/******/ !function() { -/******/ var deferred = []; -/******/ __webpack_require__.O = function(result, chunkIds, fn, priority) { -/******/ if(chunkIds) { -/******/ priority = priority || 0; -/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; -/******/ deferred[i] = [chunkIds, fn, priority]; -/******/ return; -/******/ } -/******/ var notFulfilled = Infinity; -/******/ for (var i = 0; i < deferred.length; i++) { -/******/ var chunkIds = deferred[i][0]; -/******/ var fn = deferred[i][1]; -/******/ var priority = deferred[i][2]; -/******/ var fulfilled = true; -/******/ for (var j = 0; j < chunkIds.length; j++) { -/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) { -/******/ chunkIds.splice(j--, 1); -/******/ } else { -/******/ fulfilled = false; -/******/ if(priority < notFulfilled) notFulfilled = priority; -/******/ } -/******/ } -/******/ if(fulfilled) { -/******/ deferred.splice(i--, 1) -/******/ var r = fn(); -/******/ if (r !== undefined) result = r; -/******/ } -/******/ } -/******/ return result; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/jsonp chunk loading */ -/******/ !function() { -/******/ // no baseURI -/******/ -/******/ // object to store loaded and loading chunks -/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded -/******/ var installedChunks = { -/******/ "index": 0, -/******/ "./style-index": 0 -/******/ }; -/******/ -/******/ // no chunk on demand loading -/******/ -/******/ // no prefetching -/******/ -/******/ // no preloaded -/******/ -/******/ // no HMR -/******/ -/******/ // no HMR manifest -/******/ -/******/ __webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; }; -/******/ -/******/ // install a JSONP callback for chunk loading -/******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) { -/******/ var chunkIds = data[0]; -/******/ var moreModules = data[1]; -/******/ var runtime = data[2]; -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0; -/******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) { -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) var result = runtime(__webpack_require__); -/******/ } -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ installedChunks[chunkId][0](); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ return __webpack_require__.O(result); -/******/ } -/******/ -/******/ var chunkLoadingGlobal = self["webpackChunkqsm"] = self["webpackChunkqsm"] || []; -/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); -/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ }(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module depends on other loaded chunks and execution need to be delayed -/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], function() { return __webpack_require__("./src/index.js"); }) -/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); -/******/ -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e,t={818:function(e,t,n){var a=window.wp.element,i=window.wp.blocks,s=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),l=window.wp.htmlEntities,u=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,d=window.wp.components;const q=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},_=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},z=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let a=0;a`${e}${z(8)}${t?`.${z(7)}`:""}`,b=(e,t="")=>q(e)?t:e,w=()=>{};function v({className:e="",quizAttr:t,setAttributes:n,data:i,onChangeFunc:s=w}){var r,o,l,u,c;const m=(()=>{if(i.defaultvalue=i.default,!q(i?.options))switch(i.type){case"checkbox":1===i.options.length&&(i.type="toggle"),i.label=i.options[0].label;break;case"radio":1==i.options.length?(i.label=i.options[0].label,i.type="toggle"):i.type="select"}return i.label=q(i.label)?"":_(i.label),i.help=q(i.help)?"":_(i.help),i})(),{id:p,label:g="",type:h,help:z="",options:f=[],defaultvalue:b}=m;return(0,a.createElement)(a.Fragment,null,"toggle"===h&&(0,a.createElement)(d.ToggleControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>s(q(t[p])||"1"!=t[p]?1:0,p)}),"select"===h&&(0,a.createElement)(d.SelectControl,{label:g,value:null!==(r=t[p])&&void 0!==r?r:b,options:f,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"number"===h&&(0,a.createElement)(d.TextControl,{type:"number",label:g,value:null!==(o=t[p])&&void 0!==o?o:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"text"===h&&(0,a.createElement)(d.TextControl,{type:"text",label:g,value:null!==(l=t[p])&&void 0!==l?l:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"textarea"===h&&(0,a.createElement)(d.TextareaControl,{label:g,value:null!==(u=t[p])&&void 0!==u?u:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"checkbox"===h&&(0,a.createElement)(d.CheckboxControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>s(q(t[p])||"1"!=t[p]?1:0,p)}),"radio"===h&&(0,a.createElement)(d.RadioControl,{label:g,help:z,selected:null!==(c=t[p])&&void 0!==c?c:b,options:f,onChange:e=>s(e,p)}))}const y=()=>(0,a.createElement)(d.Icon,{icon:()=>(0,a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,a.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});var E=window.wp.compose;(0,i.registerBlockType)("qsm/quiz",{icon:y,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:_}=e,{createNotice:z}=(0,m.useDispatch)(c.store),w=qsmBlockData.globalQuizsetting,{quizID:E,postID:k,quizAttr:x=w}=n,[D,I]=(0,a.useState)(qsmBlockData.QSMQuizList),[C,B]=(0,a.useState)({error:!1,msg:""}),[S,N]=(0,a.useState)(!1),[O,A]=(0,a.useState)(!1),[P,T]=(0,a.useState)(!1),[M,Q]=(0,a.useState)([]),H=qsmBlockData.quizOptions,F=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(u.store);(0,a.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{L()}),100),!q(E)&&0{if(E==t.value)return e=!0,!0})),e?K(E):(i({quizID:void 0}),B({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const L=()=>{let e=document.getElementById("modal-advanced-question-type");q(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");q(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},K=e=>{!q(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(i({quizID:parseInt(e),postID:n.post_id,quizAttr:{...x,...n}}),!q(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:b(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},R=(e,t)=>{let n=x;n[t]=e,i({quizAttr:{...n}})};(0,a.useEffect)((()=>{if(F){let e=(()=>{let e=j(_);if(q(e))return!1;e=e.innerBlocks;let t={quiz_id:x.quiz_id,post_id:x.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,i=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,s=b(a?.answerEditor,"text"),r=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=b(t?.content);q(a?.answerEditor)||"rich"!==a.answerEditor||(n=g((0,l.decodeEntities)(n)));let i=[n,b(t?.points),b(t?.isCorrect)];"image"!==s||q(t?.caption)||i.push(t?.caption),r.push(i)})),i.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:x.quiz_id,postID:x.post_id,answerEditor:s,type:b(a?.type,"0"),name:g(b(a?.description)),question_title:b(a?.title),answerInfo:g(b(a?.correctAnswerInfo)),comments:b(a?.commentBox,"1"),hint:b(a?.hint),category:b(a?.category),multicategories:b(a?.multicategories,[]),required:b(a?.required,0),answers:r,featureImageID:b(a?.featureImageID),featureImageSrc:b(a?.featureImageSrc),page:n,other_settings:{...b(a?.settings,{}),required:b(a?.required,0)}})})),t.pages.push(i),t.qpages.push({id:a,quizID:x.quiz_id,pagekey:q(e.attributes.pageKey)?f():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:i}),n++}})),t.quiz={quiz_name:x.quiz_name,quiz_id:x.quiz_id,post_id:x.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==x[e]&&null!==x[e]&&(t.quiz[e]=x[e])})),t})();A(!0),e=h({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[F]);const V=(0,u.useBlockProps)(),$=(0,u.useInnerBlocksProps)(V,{template:M,allowedBlocks:["qsm/quiz-page"]});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(u.InspectorControls,null,(0,a.createElement)(d.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,a.createElement)("span",{className:"qsm-inspector-label-value"},x.post_status)),(0,a.createElement)(d.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name"),className:"qsm-no-mb"}),(!q(E)||"0"!=E)&&(0,a.createElement)("p",null,(0,a.createElement)(d.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+E+"&tab=options"},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),q(E)||"0"==E?(0,a.createElement)("div",{...V}," ",(0,a.createElement)(d.Placeholder,{className:"qsm-placeholder-wrapper",icon:y,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,a.createElement)(a.Fragment,null,!q(D)&&0K(e),disabled:S,__nextHasNoMarginBottom:!0}),(0,a.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,a.createElement)(d.Button,{variant:"link",onClick:()=>N(!S)},(0,s.__)("Add New","quiz-master-next"))),(q(D)||S)&&(0,a.createElement)(d.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,a.createElement)(d.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name")}),(0,a.createElement)(d.Button,{variant:"link",onClick:()=>T(!P)},(0,s.__)("Advance options","quiz-master-next")),(0,a.createElement)("div",{className:"qsm-advance-settings"},P&&H.map((e=>(0,a.createElement)(v,{key:"qsm-settings"+e.id,data:e,quizAttr:x,setAttributes:i,onChangeFunc:R})))),(0,a.createElement)(d.Button,{variant:"primary",disabled:O||q(x.quiz_name),onClick:()=>(()=>{if(q(x.quiz_name))return void console.log("empty quiz_name");A(!0);let e=h({quiz_name:x.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===x[t]||null===x[t]?"":e.append(t,x[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(A(!1),"success"==e.status){let t=h({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:0,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=h({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",f()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&K(e.quizID)}))}})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),C.error&&(0,a.createElement)("p",{className:"qsm-error-text"},C.msg)))," "):(0,a.createElement)("div",{...$}))},save:e=>null});const k=(0,E.createHigherOrderComponent)((e=>t=>{const{name:n,className:i,attributes:s,setAttributes:r,isSelected:o,clientId:l,context:u}=t;return"core/group"!==n?(0,a.createElement)(e,{key:"edit",...t}):(console.log("props",t),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(e,{key:"edit",...t})))}),"withMyPluginControls");wp.hooks.addFilter("editor.BlockEdit","my-plugin/with-inspector-controls",k)}},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,a),s.exports}a.m=t,e=[],a.O=function(t,n,i,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,i,s]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var i,s,r=n[0],o=n[1],l=n[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(l)var c=l(a)}for(t&&t(n);u {};\r\nexport default function InputComponent( {\r\n className='', \r\n quizAttr, \r\n setAttributes,\r\n data,\r\n onChangeFunc = noop,\r\n} ) {\r\n\r\n const processData = ( ) => {\r\n data.defaultvalue = data.default;\r\n if ( ! qsmIsEmpty( data?.options ) ) {\r\n switch (data.type) {\r\n case 'checkbox':\r\n if ( 1 === data.options.length ) {\r\n data.type = 'toggle';\r\n }\r\n data.label = data.options[0].label;\r\n break;\r\n case 'radio':\r\n if ( 1 == data.options.length ) {\r\n\t\t\t\t\t\tdata.label = data.options[0].label;\r\n\t\t\t\t\t\tdata.type = 'toggle';\r\n } else {\r\n\t\t\t\t\t\tdata.type = 'select';\r\n\t\t\t\t\t}\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n data.label = qsmIsEmpty( data.label ) ? '': qsmStripTags( data.label );\r\n data.help = qsmIsEmpty( data.help ) ? '': qsmStripTags( data.help );\r\n return data;\r\n }\r\n \r\n const newData = processData();\r\n const {\r\n id,\r\n label='',\r\n type,\r\n help='',\r\n options=[],\r\n defaultvalue \r\n } = newData;\r\n\r\n return(\r\n\t\t<>\r\n\t\t{ 'toggle' === type && (\r\n\t\t\t onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) }\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'select' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t\thelp={ help }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'number' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t\thelp={ help }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'text' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t\thelp={ help }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'textarea' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t\thelp={ help }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n \t/>\r\n\t\t)}\r\n\t\t{ 'checkbox' === type && (\t\r\n\t\t\t onChangeFunc( ( ( ! qsmIsEmpty( quizAttr[id] ) && '1' == quizAttr[id] ) ? 0 : 1 ), id ) }\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t{ 'radio' === type && (\t\r\n\t\t\t onChangeFunc( val, id) }\r\n\t\t\t/>\r\n\t\t)}\r\n\t\t\r\n\t);\r\n}","import { Icon } from '@wordpress/components';\r\n//QSM Quiz Block\r\nexport const qsmBlockIcon = () => (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Warning icon\r\nexport const warningIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport { decodeEntities } from '@wordpress/html-entities';\r\nimport {\r\n\tInspectorControls,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n\tstore as blockEditorStore,\r\n\tuseInnerBlocksProps,\r\n} from '@wordpress/block-editor';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect } from '@wordpress/data';\r\nimport { store as editorStore } from '@wordpress/editor';\r\nimport {\r\n\tPanelBody,\r\n\tButton,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tSelectControl,\r\n\tPlaceholder,\r\n\tExternalLink,\r\n\t__experimentalVStack as VStack,\r\n} from '@wordpress/components';\r\nimport './editor.scss';\r\nimport { qsmIsEmpty, qsmFormData, qsmUniqid, qsmValueOrDefault, qsmDecodeHtml } from './helper';\r\nimport InputComponent from './component/InputComponent';\r\nimport { qsmBlockIcon } from './component/icon';\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst { className, attributes, setAttributes, isSelected, clientId } = props;\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\t//quiz attribute\r\n\tconst globalQuizsetting = qsmBlockData.globalQuizsetting;\r\n\tconst {\r\n\t\tquizID,\r\n\t\tpostID,\r\n\t\tquizAttr = globalQuizsetting\r\n\t} = attributes;\r\n\r\n\r\n\t//quiz list\r\n\tconst [ quizList, setQuizList ] = useState( qsmBlockData.QSMQuizList );\r\n\t//quiz list\r\n\tconst [ quizMessage, setQuizMessage ] = useState( {\r\n\t\terror: false,\r\n\t\tmsg: ''\r\n\t} );\r\n\t//whether creating a new quiz\r\n\tconst [ createQuiz, setCreateQuiz ] = useState( false );\r\n\t//whether saving quiz\r\n\tconst [ saveQuiz, setSaveQuiz ] = useState( false );\r\n\t//whether to show advance option\r\n\tconst [ showAdvanceOption, setShowAdvanceOption ] = useState( false );\r\n\t//Quiz template on set Quiz ID\r\n\tconst [ quizTemplate, setQuizTemplate ] = useState( [] );\r\n\t//Quiz Options to create attributes label, description and layout\r\n\tconst quizOptions = qsmBlockData.quizOptions;\r\n\r\n\t//check if page is saving\r\n\tconst isSavingPage = useSelect( ( select ) => {\r\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\r\n\t\treturn isSavingPost() && ! isAutosavingPost();\r\n\t}, [] );\r\n\r\n\tconst { getBlock } = useSelect( blockEditorStore );\r\n\r\n\t/**Initialize block from server */\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetQSMAttr = true;\r\n\t\tif ( shouldSetQSMAttr ) {\r\n\t\t\t//add upgrade modal\r\n\t\t\tif ( '0' == qsmBlockData.is_pro_activated ) {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\taddUpgradePopupHtml();\r\n\t\t\t\t}, 100);\r\n\t\t\t}\r\n\t\t\t//initialize QSM block\r\n\t\t\tif ( ! qsmIsEmpty( quizID ) && 0 < quizID ) {\r\n\t\t\t\t//Check if quiz exists\r\n\t\t\t\tlet hasQuiz = false;\r\n\t\t\t\tquizList.forEach( quizElement => {\r\n\t\t\t\t\tif ( quizID == quizElement.value ) {\r\n\t\t\t\t\t\thasQuiz = true;\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tif ( hasQuiz ) {\r\n\t\t\t\t\tinitializeQuizAttributes( quizID );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsetAttributes({\r\n\t\t\t\t\t\tquizID : undefined\r\n\t\t\t\t\t});\r\n\t\t\t\t\tsetQuizMessage( {\r\n\t\t\t\t\t\terror: true,\r\n\t\t\t\t\t\tmsg: __( 'Quiz not found. Please select an existing quiz or create a new one.', 'quiz-master-next' )\r\n\t\t\t\t\t} );\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetQSMAttr = false;\r\n\t\t};\r\n\t\t\r\n\t}, [ ] );\r\n\r\n\t/**Add modal advanced-question-type */\r\n\tconst addUpgradePopupHtml = () => {\r\n\t\tlet modalEl = document.getElementById('modal-advanced-question-type');\r\n\t\tif ( qsmIsEmpty( modalEl ) ) {\r\n\t\t\tapiFetch( {\r\n\t\t\t\tpath: '/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t} ).then( ( res ) => {\r\n\t\t\t\tlet bodyEl = document.getElementById('wpbody-content');\r\n\t\t\t\tif ( ! qsmIsEmpty( bodyEl ) && 'success' == res.status ) { \r\n\t\t\t\t\tbodyEl.insertAdjacentHTML('afterbegin', res.result );\r\n\t\t\t\t}\r\n\t\t\t} ).catch(\r\n\t\t\t\t( error ) => {\r\n\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**Initialize quiz attributes: first time render only */\r\n\tconst initializeQuizAttributes = ( quiz_id ) => {\r\n\t\tif ( ! qsmIsEmpty( quiz_id ) && 0 < quiz_id ) {\r\n\t\t\tapiFetch( {\r\n\t\t\t\tpath: '/quiz-survey-master/v1/quiz/structure',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t\tdata: { quizID: quiz_id },\r\n\t\t\t} ).then( ( res ) => {\r\n\t\t\t\t\r\n\t\t\t\tif ( 'success' == res.status ) {\r\n\t\t\t\t\tsetQuizMessage( {\r\n\t\t\t\t\t\terror: false,\r\n\t\t\t\t\t\tmsg: ''\r\n\t\t\t\t\t} );\r\n\t\t\t\t\tlet result = res.result;\r\n\t\t\t\t\tsetAttributes( { \r\n\t\t\t\t\t\tquizID: parseInt( quiz_id ),\r\n\t\t\t\t\t\tpostID: result.post_id,\r\n\t\t\t\t\t\tquizAttr: { ...quizAttr, ...result }\r\n\t\t\t\t\t} );\r\n\t\t\t\t\tif ( ! qsmIsEmpty( result.qpages ) ) {\r\n\t\t\t\t\t\tlet quizTemp = [];\r\n\t\t\t\t\t\tresult.qpages.forEach( page => {\r\n\t\t\t\t\t\t\tlet questions = [];\r\n\t\t\t\t\t\t\tif ( ! qsmIsEmpty( page.question_arr ) ) {\r\n\t\t\t\t\t\t\t\tpage.question_arr.forEach( question => {\r\n\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question ) ) {\r\n\t\t\t\t\t\t\t\t\t\tlet answers = [];\r\n\t\t\t\t\t\t\t\t\t\t//answers options blocks\r\n\t\t\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( question.answers ) && 0 < question.answers.length ) {\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tquestion.answers.forEach( ( answer, aIndex ) => {\r\n\t\t\t\t\t\t\t\t\t\t\t\tanswers.push(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toptionID:aIndex,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontent:answer[0],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoints:answer[1],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect:answer[2],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcaption: qsmValueOrDefault( answer[3] )\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t//question blocks\r\n\t\t\t\t\t\t\t\t\t\tquestions.push(\r\n\t\t\t\t\t\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t\t\t\t\t\t'qsm/quiz-question',\r\n\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tquestionID: question.question_id,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: question.question_type_new,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswerEditor: question.settings.answerEditor,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: question.settings.question_title,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: question.question_name,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\trequired: question.settings.required,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\thint:question.hints,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tanswers: question.answers,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcorrectAnswerInfo:question.question_answer_info,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcategory:question.category,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tmulticategories:question.multicategories,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcommentBox: question.comments,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tmatchAnswer: question.settings.matchAnswer,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageID: question.settings.featureImageID,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfeatureImageSrc: question.settings.featureImageSrc,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsettings: question.settings\r\n\t\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t\tanswers\r\n\t\t\t\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tquizTemp.push(\r\n\t\t\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t\t\t'qsm/quiz-page',\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tpageID:page.id,\r\n\t\t\t\t\t\t\t\t\t\tpageKey: page.pagekey,\r\n\t\t\t\t\t\t\t\t\t\thidePrevBtn: page.hide_prevbtn,\r\n\t\t\t\t\t\t\t\t\t\tquizID: page.quizID\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\tquestions\r\n\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tsetQuizTemplate( quizTemp );\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconsole.log( \"error \"+ res.msg );\r\n\t\t\t\t}\r\n\t\t\t} ).catch(\r\n\t\t\t\t( error ) => {\r\n\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * \r\n\t * @returns Placeholder for quiz in case quiz ID is not set\r\n\t */\r\n\tconst quizPlaceholder = ( ) => {\r\n\t\treturn (\r\n\t\t\t\r\n\t\t\t\t{\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t{ ( ! qsmIsEmpty( quizList ) && 0 < quizList.length )&& \r\n\t\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tinitializeQuizAttributes( quizID )\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdisabled={ createQuiz }\r\n\t\t\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t{ __( 'OR', 'quiz-master-next' ) }\r\n\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t\t}\r\n\t\t\t\t\t{ ( qsmIsEmpty( quizList ) || createQuiz ) &&\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t setQuizAttributes( val, 'quiz_name') }\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t{ showAdvanceOption && quizOptions.map( qSetting => (\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t))\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t }\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tquizMessage.error && (\r\n\t\t\t\t\t\t\t

{ quizMessage.msg }

\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t);\r\n\t};\r\n\r\n\t/**\r\n\t * Set attribute value\r\n\t * @param { any } value attribute value to set\r\n\t * @param { string } attr_name attribute name\r\n\t */\r\n\tconst setQuizAttributes = ( value , attr_name ) => {\r\n\t\tlet newAttr = quizAttr;\r\n\t\tnewAttr[ attr_name ] = value;\r\n\t\tsetAttributes( { quizAttr: { ...newAttr } } );\r\n\t}\r\n\r\n\t/**\r\n\t * Prepare quiz data e.g. quiz details, questions, answers etc to save \r\n\t * @returns quiz data\r\n\t */\r\n\tconst getQuizDataToSave = ( ) => {\t\r\n\t\tlet blocks = getBlock( clientId ); \r\n\t\tif ( qsmIsEmpty( blocks ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tblocks = blocks.innerBlocks;\r\n\t\tlet quizDataToSave = {\r\n\t\t\tquiz_id: quizAttr.quiz_id,\r\n\t\t\tpost_id: quizAttr.post_id,\r\n\t\t\tquiz:{},\r\n\t\t\tpages:[],\r\n\t\t\tqpages:[],\r\n\t\t\tquestions:[]\r\n\t\t};\r\n\t\tlet pageSNo = 0;\r\n\t\t//loop through inner blocks\r\n\t\tblocks.forEach( (block) => {\r\n\t\t\tif ( 'qsm/quiz-page' === block.name ) {\r\n\t\t\t\tlet pageID = block.attributes.pageID;\r\n\t\t\t\tlet questions = [];\r\n\t\t\t\tif ( ! qsmIsEmpty( block.innerBlocks ) && 0 < block.innerBlocks.length ) { \r\n\t\t\t\t\tlet questionBlocks = block.innerBlocks;\r\n\t\t\t\t\t//Question Blocks\r\n\t\t\t\t\tquestionBlocks.forEach( ( questionBlock ) => {\r\n\t\t\t\t\t\tif ( 'qsm/quiz-question' !== questionBlock.name ) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlet questionAttr = questionBlock.attributes;\r\n\t\t\t\t\t\tlet answerEditor = qsmValueOrDefault( questionAttr?.answerEditor, 'text' );\r\n\t\t\t\t\t\tlet answers = [];\r\n\t\t\t\t\t\t//Answer option blocks\r\n\t\t\t\t\t\tif ( ! qsmIsEmpty( questionBlock.innerBlocks ) && 0 < questionBlock.innerBlocks.length ) { \r\n\t\t\t\t\t\t\tlet answerOptionBlocks = questionBlock.innerBlocks;\r\n\t\t\t\t\t\t\tanswerOptionBlocks.forEach( ( answerOptionBlock ) => {\r\n\t\t\t\t\t\t\t\tif ( 'qsm/quiz-answer-option' !== answerOptionBlock.name ) {\r\n\t\t\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tlet answerAttr = answerOptionBlock.attributes;\r\n\t\t\t\t\t\t\t\tlet answerContent = qsmValueOrDefault( answerAttr?.content );\r\n\t\t\t\t\t\t\t\t//if rich text\r\n\t\t\t\t\t\t\t\tif ( ! qsmIsEmpty( questionAttr?.answerEditor ) && 'rich' === questionAttr.answerEditor ) {\r\n\t\t\t\t\t\t\t\t\tanswerContent = qsmDecodeHtml( decodeEntities( answerContent ) );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tlet ans = [\r\n\t\t\t\t\t\t\t\t\tanswerContent,\r\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.points ),\r\n\t\t\t\t\t\t\t\t\tqsmValueOrDefault( answerAttr?.isCorrect ),\r\n\t\t\t\t\t\t\t\t];\r\n\t\t\t\t\t\t\t\t//answer options are image type\r\n\t\t\t\t\t\t\t\tif ( 'image' === answerEditor && ! qsmIsEmpty( answerAttr?.caption ) ) {\r\n\t\t\t\t\t\t\t\t\tans.push( answerAttr?.caption );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tanswers.push( ans );\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//questions Data\r\n\t\t\t\t\t\tquestions.push( questionAttr.questionID );\r\n\t\t\t\t\t\t//update question only if changes occured\r\n\t\t\t\t\t\tif ( questionAttr.isChanged ) {\r\n\t\t\t\t\t\t\tquizDataToSave.questions.push({\r\n\t\t\t\t\t\t\t\t\"id\": questionAttr.questionID,\r\n\t\t\t\t\t\t\t\t\"quizID\": quizAttr.quiz_id,\r\n\t\t\t\t\t\t\t\t\"postID\": quizAttr.post_id,\r\n\t\t\t\t\t\t\t\t\"answerEditor\": answerEditor,\r\n\t\t\t\t\t\t\t\t\"type\": qsmValueOrDefault( questionAttr?.type , '0' ),\r\n\t\t\t\t\t\t\t\t\"name\": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.description ) ),\r\n\t\t\t\t\t\t\t\t\"question_title\": qsmValueOrDefault( questionAttr?.title ),\r\n\t\t\t\t\t\t\t\t\"answerInfo\": qsmDecodeHtml( qsmValueOrDefault( questionAttr?.correctAnswerInfo ) ),\r\n\t\t\t\t\t\t\t\t\"comments\": qsmValueOrDefault( questionAttr?.commentBox, '1' ),\r\n\t\t\t\t\t\t\t\t\"hint\": qsmValueOrDefault( questionAttr?.hint ),\r\n\t\t\t\t\t\t\t\t\"category\": qsmValueOrDefault( questionAttr?.category ),\r\n\t\t\t\t\t\t\t\t\"multicategories\": qsmValueOrDefault( questionAttr?.multicategories, [] ),\r\n\t\t\t\t\t\t\t\t\"required\": qsmValueOrDefault( questionAttr?.required, 0 ),\r\n\t\t\t\t\t\t\t\t\"answers\": answers,\r\n\t\t\t\t\t\t\t\t\"featureImageID\":qsmValueOrDefault( questionAttr?.featureImageID ),\r\n\t\t\t\t\t\t\t\t\"featureImageSrc\":qsmValueOrDefault( questionAttr?.featureImageSrc ),\r\n\t\t\t\t\t\t\t\t\"page\": pageSNo,\r\n\t\t\t\t\t\t\t\t\"other_settings\": {\r\n\t\t\t\t\t\t\t\t\t...qsmValueOrDefault( questionAttr?.settings, {} ),\r\n\t\t\t\t\t\t\t\t\t\"required\": qsmValueOrDefault( questionAttr?.required, 0 )\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// pages[0][]: 2512\r\n\t\t\t\t// \tqpages[0][id]: 2\r\n\t\t\t\t// \tqpages[0][quizID]: 76\r\n\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\r\n\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\r\n\t\t\t\t// \tqpages[0][questions][]: 2512\r\n\t\t\t\t// \tpost_id: 111\r\n\t\t\t\t//page data\r\n\t\t\t\tquizDataToSave.pages.push( questions );\r\n\t\t\t\t\r\n\t\t\t\tquizDataToSave.qpages.push( {\r\n\t\t\t\t\t'id': pageID,\r\n\t\t\t\t\t'quizID': quizAttr.quiz_id,\r\n\t\t\t\t\t'pagekey': qsmIsEmpty( block.attributes.pageKey ) ? qsmUniqid() :block.attributes.pageKey,\r\n\t\t\t\t\t'hide_prevbtn':block.attributes.hidePrevBtn,\r\n\t\t\t\t\t'questions': questions\r\n\t\t\t\t} );\r\n\t\t\t\tpageSNo++;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t//Quiz details\r\n\t\tquizDataToSave.quiz = { \r\n\t\t\t'quiz_name': quizAttr.quiz_name,\r\n\t\t\t'quiz_id': quizAttr.quiz_id,\r\n\t\t\t'post_id': quizAttr.post_id,\r\n\t\t};\r\n\t\tif ( showAdvanceOption ) {\r\n\t\t\t[\r\n\t\t\t'form_type', \r\n\t\t\t'system', \r\n\t\t\t'timer_limit', \r\n\t\t\t'pagination',\r\n\t\t\t'enable_contact_form', \r\n\t\t\t'enable_pagination_quiz', \r\n\t\t\t'show_question_featured_image_in_result',\r\n\t\t\t'progress_bar',\r\n\t\t\t'require_log_in',\r\n\t\t\t'disable_first_page',\r\n\t\t\t'comment_section'\r\n\t\t\t].forEach( ( item ) => { \r\n\t\t\t\tif ( 'undefined' !== typeof quizAttr[ item ] && null !== quizAttr[ item ] ) {\r\n\t\t\t\t\tquizDataToSave.quiz[ item ] = quizAttr[ item ];\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn quizDataToSave;\r\n\t}\r\n\r\n\t//saving Quiz on save page\r\n\tuseEffect( () => {\r\n\t\tif ( isSavingPage ) {\r\n\t\t\tlet quizData = getQuizDataToSave();\r\n\t\t\t//save quiz status\r\n\t\t\tsetSaveQuiz( true );\r\n\t\t\t\r\n\t\t\tquizData = qsmFormData({\r\n\t\t\t\t'save_entire_quiz': '1',\r\n\t\t\t\t'quizData': JSON.stringify( quizData ),\r\n\t\t\t\t'qsm_block_quiz_nonce' : qsmBlockData.nonce,\r\n\t\t\t\t\"nonce\": qsmBlockData.saveNonce,//save pages nonce\r\n\t\t\t});\r\n\r\n\t\t\t//AJAX call\r\n\t\t\tapiFetch( {\r\n\t\t\t\tpath: '/quiz-survey-master/v1/quiz/save_quiz',\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t\tbody: quizData\r\n\t\t\t} ).then( ( res ) => {\r\n\t\t\t\t//create notice\r\n\t\t\t\tcreateNotice( res.status, res.msg, {\r\n\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t} );\r\n\t\t\t} ).catch(\r\n\t\t\t\t( error ) => {\r\n\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t} );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}, [ isSavingPage ] );\r\n\r\n\t/**\r\n\t * Create new quiz and set quiz ID\r\n\t * \r\n\t */\r\n\tconst createNewQuiz = () => {\r\n\t\tif ( qsmIsEmpty( quizAttr.quiz_name ) ) {\r\n\t\t\tconsole.log(\"empty quiz_name\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t//save quiz status\r\n\t\tsetSaveQuiz( true );\r\n\t\t\r\n\t\tlet quizData = qsmFormData({\r\n\t\t\t'quiz_name': quizAttr.quiz_name,\r\n\t\t\t'qsm_new_quiz_nonce': qsmBlockData.qsm_new_quiz_nonce\r\n\t\t});\r\n\t\t\r\n\t\t['form_type', \r\n\t\t'system', \r\n\t\t'timer_limit', \r\n\t\t'pagination',\r\n\t\t'enable_contact_form', \r\n\t\t'enable_pagination_quiz', \r\n\t\t'show_question_featured_image_in_result',\r\n\t\t'progress_bar',\r\n\t\t'require_log_in',\r\n\t\t'disable_first_page',\r\n\t\t'comment_section'\r\n\t\t].forEach( ( item ) => ( 'undefined' === typeof quizAttr[ item ] || null === quizAttr[ item ] ) ? '' : quizData.append( item, quizAttr[ item ] ) );\r\n\r\n\t\t//AJAX call\r\n\t\tapiFetch( {\r\n\t\t\tpath: '/quiz-survey-master/v1/quiz/create_quiz',\r\n\t\t\tmethod: 'POST',\r\n\t\t\tbody: quizData\r\n\t\t} ).then( ( res ) => {\r\n\t\t\t//save quiz status\r\n\t\t\tsetSaveQuiz( false );\r\n\t\t\tif ( 'success' == res.status ) {\r\n\t\t\t\t//create a question\r\n\t\t\t\tlet newQuestion = qsmFormData( {\r\n\t\t\t\t\t\"id\": null,\r\n\t\t\t\t\t\"quizID\": res.quizID,\r\n\t\t\t\t\t\"answerEditor\": \"text\",\r\n\t\t\t\t\t\"type\": \"0\",\r\n\t\t\t\t\t\"name\": \"\",\r\n\t\t\t\t\t\"question_title\": \"\",\r\n\t\t\t\t\t\"answerInfo\": \"\",\r\n\t\t\t\t\t\"comments\": \"1\",\r\n\t\t\t\t\t\"hint\": \"\",\r\n\t\t\t\t\t\"category\": \"\",\r\n\t\t\t\t\t\"required\": 0,\r\n\t\t\t\t\t\"answers\": [],\r\n\t\t\t\t\t\"page\": 0\r\n\t\t\t\t} );\r\n\t\t\t\t//AJAX call\r\n\t\t\t\tapiFetch( {\r\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\r\n\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\tbody: newQuestion\r\n\t\t\t\t} ).then( ( response ) => {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ( 'success' == response.status ) {\r\n\t\t\t\t\t\tlet question_id = response.id;\r\n\r\n\t\t\t\t\t\t/**Page attributes required format */\r\n\t\t\t\t\t\t// pages[0][]: 2512\r\n\t\t\t\t\t\t// \tqpages[0][id]: 2\r\n\t\t\t\t\t\t// \tqpages[0][quizID]: 76\r\n\t\t\t\t\t\t// \tqpages[0][pagekey]: Ipj90nNT\r\n\t\t\t\t\t\t// \tqpages[0][hide_prevbtn]: 0\r\n\t\t\t\t\t\t// \tqpages[0][questions][]: 2512\r\n\t\t\t\t\t\t// \tpost_id: 111\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlet newPage = qsmFormData( {\r\n\t\t\t\t\t\t\t\"action\": qsmBlockData.save_pages_action,\r\n\t\t\t\t\t\t\t\"quiz_id\": res.quizID,\r\n\t\t\t\t\t\t\t\"nonce\": qsmBlockData.saveNonce,\r\n\t\t\t\t\t\t\t\"post_id\": res.quizPostID,\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t\tnewPage.append( 'pages[0][]', question_id );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][id]', 1 );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][quizID]', res.quizID );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][pagekey]', qsmUniqid() );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][hide_prevbtn]', 0 );\r\n\t\t\t\t\t\tnewPage.append( 'qpages[0][questions][]', question_id );\r\n\r\n\r\n\t\t\t\t\t\t//create a page\r\n\t\t\t\t\t\tapiFetch( {\r\n\t\t\t\t\t\t\turl: qsmBlockData.ajax_url,\r\n\t\t\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\t\t\tbody: newPage\r\n\t\t\t\t\t\t} ).then( ( pageResponse ) => {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ( 'success' == pageResponse.status ) {\r\n\t\t\t\t\t\t\t\t//set new quiz\r\n\t\t\t\t\t\t\t\tinitializeQuizAttributes( res.quizID );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}).catch(\r\n\t\t\t\t\t( error ) => {\r\n\t\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t\t\r\n\t\t\t} \r\n\r\n\t\t\t//create notice\r\n\t\t\tcreateNotice( res.status, res.msg, {\r\n\t\t\t\tisDismissible: true,\r\n\t\t\t\ttype: 'snackbar',\r\n\t\t\t} );\r\n\t\t} ).catch(\r\n\t\t\t( error ) => {\r\n\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t} );\r\n\t\t\t}\r\n\t\t);\r\n\t \r\n\t}\r\n\r\n\t/**\r\n\t * Inner Blocks\r\n\t */\r\n\tconst blockProps = useBlockProps();\r\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\r\n\t\ttemplate: quizTemplate,\r\n\t\tallowedBlocks : [\r\n\t\t\t'qsm/quiz-page'\r\n\t\t]\r\n\t} );\r\n\t\r\n\r\n\treturn (\r\n\t<>\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t setQuizAttributes( val, 'quiz_name') }\r\n\t\t\tclassName='qsm-no-mb'\r\n\t\t/>\r\n\t\t{\r\n\t\t\t( ! qsmIsEmpty( quizID ) || '0' != quizID ) && \r\n\t\t\t

\r\n\t\t\t\t\r\n\t\t\t\t\t{ __( 'Advance Quiz Settings', 'quiz-master-next' ) }\r\n\t\t\t\t\r\n\t\t\t

\r\n\t\t}\r\n\t\t
\r\n\t
\r\n\t{ ( qsmIsEmpty( quizID ) || '0' == quizID ) ? \r\n
{ quizPlaceholder() }
\r\n\t:\r\n\t
\r\n\t}\r\n\t\r\n\t\r\n\t);\r\n}\r\n","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n//Match array of object values and return array of cooresponding matching keys \r\nexport const qsmMatchingValueKeyArray = ( values, obj ) => {\r\n\tif ( qsmIsEmpty( obj ) || ! Array.isArray( values ) ) {\r\n\t\treturn values;\r\n\t}\r\n\treturn values.map( ( val ) => Object.keys(obj).find( key => obj[key] == val) );\r\n}\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//Generate random number\r\nexport const qsmGenerateRandomKey = (length) => {\r\n const charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n let key = \"\";\r\n\r\n // Generate random bytes\r\n const values = new Uint8Array(length);\r\n window.crypto.getRandomValues(values);\r\n\r\n for (let i = 0; i < length; i++) {\r\n // Use the random byte to index into the charset\r\n key += charset[values[i] % charset.length];\r\n }\r\n\r\n return key;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const id = qsmGenerateRandomKey(8);\r\n return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(7) }`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { registerBlockType } from '@wordpress/blocks';\r\nimport './style.scss';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { qsmBlockIcon } from './component/icon';\r\nimport { createHigherOrderComponent } from '@wordpress/compose';\r\n\r\nconst save = ( props ) => null;\r\nregisterBlockType( metadata.name, {\r\n\ticon: qsmBlockIcon,\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n\tsave: save,\r\n} );\r\n\r\n\r\nconst withMyPluginControls = createHigherOrderComponent( ( BlockEdit ) => {\r\n\treturn ( props ) => {\r\n\t\tconst { name, className, attributes, setAttributes, isSelected, clientId, context } = props;\r\n\t\tif ( 'core/group' !== name ) {\r\n\t\t\treturn ;\r\n\t\t}\r\n\r\n\t\tconsole.log(\"props\",props);\r\n\t\treturn (\r\n\t\t\t<>\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t);\r\n\t};\r\n}, 'withMyPluginControls' );\r\n\r\nwp.hooks.addFilter(\r\n\t'editor.BlockEdit',\r\n\t'my-plugin/with-inspector-controls',\r\n\twithMyPluginControls\r\n);","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"compose\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"editor\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkqsm\"] = self[\"webpackChunkqsm\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], function() { return __webpack_require__(\"./src/index.js\"); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useState","useEffect","Button","TextControl","ToggleControl","SelectControl","CheckboxControl","RadioControl","TextareaControl","qsmIsEmpty","qsmStripTags","noop","InputComponent","className","quizAttr","setAttributes","data","onChangeFunc","_quizAttr$id","_quizAttr$id2","_quizAttr$id3","_quizAttr$id4","_quizAttr$id5","processData","defaultvalue","default","options","type","length","label","help","newData","id","createElement","Fragment","checked","onChange","value","val","__nextHasNoMarginBottom","selected","Icon","qsmBlockIcon","icon","width","height","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","warningIcon","stroke","strokeWidth","strokeLinecap","strokeLinejoin","apiFetch","decodeEntities","InspectorControls","InnerBlocks","useBlockProps","store","blockEditorStore","useInnerBlocksProps","noticesStore","useDispatch","useSelect","editorStore","PanelBody","Placeholder","ExternalLink","__experimentalVStack","VStack","qsmFormData","qsmUniqid","qsmValueOrDefault","qsmDecodeHtml","Edit","props","qsmBlockData","attributes","isSelected","clientId","createNotice","globalQuizsetting","quizID","postID","quizList","setQuizList","QSMQuizList","quizMessage","setQuizMessage","error","msg","createQuiz","setCreateQuiz","saveQuiz","setSaveQuiz","showAdvanceOption","setShowAdvanceOption","quizTemplate","setQuizTemplate","quizOptions","isSavingPage","select","isAutosavingPost","isSavingPost","getBlock","shouldSetQSMAttr","is_pro_activated","setTimeout","addUpgradePopupHtml","hasQuiz","forEach","quizElement","initializeQuizAttributes","undefined","modalEl","document","getElementById","path","method","then","res","bodyEl","status","insertAdjacentHTML","result","catch","console","log","quiz_id","parseInt","post_id","qpages","quizTemp","page","questions","question_arr","question","answers","answer","aIndex","push","optionID","content","points","isCorrect","caption","questionID","question_id","question_type_new","answerEditor","settings","title","question_title","description","question_name","required","hint","hints","correctAnswerInfo","question_answer_info","category","multicategories","commentBox","comments","matchAnswer","featureImageID","featureImageSrc","pageID","pageKey","pagekey","hidePrevBtn","hide_prevbtn","quizPlaceholder","instructions","disabled","variant","onClick","spacing","quiz_name","setQuizAttributes","map","qSetting","key","createNewQuiz","attr_name","newAttr","getQuizDataToSave","blocks","innerBlocks","quizDataToSave","quiz","pages","pageSNo","block","name","questionBlocks","questionBlock","questionAttr","answerOptionBlocks","answerOptionBlock","answerAttr","answerContent","ans","isChanged","item","quizData","JSON","stringify","nonce","saveNonce","body","isDismissible","message","qsm_new_quiz_nonce","append","newQuestion","response","newPage","save_pages_action","quizPostID","url","ajax_url","pageResponse","blockProps","innerBlocksProps","template","allowedBlocks","initialOpen","post_status","href","quiz_settings_url","qsmUniqueArray","arr","Array","isArray","filter","index","indexOf","qsmMatchingValueKeyArray","values","obj","Object","keys","find","html","txt","innerHTML","qsmSanitizeName","toLowerCase","replace","text","div","innerText","FormData","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmGenerateRandomKey","charset","Uint8Array","window","crypto","getRandomValues","i","prefix","random","defaultValue","registerBlockType","metadata","createHigherOrderComponent","save","edit","withMyPluginControls","BlockEdit","context","wp","hooks","addFilter"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/page/index.asset.php b/blocks/build/page/index.asset.php index 23561557e..5a2b29b90 100644 --- a/blocks/build/page/index.asset.php +++ b/blocks/build/page/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '491b4cba078ca130db1c'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'a6a7c8c48015f8b1bc61'); diff --git a/blocks/build/page/index.js b/blocks/build/page/index.js index 7ee478b11..035c9ecdf 100644 --- a/blocks/build/page/index.js +++ b/blocks/build/page/index.js @@ -1,360 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, -/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmGenerateRandomKey: function() { return /* binding */ qsmGenerateRandomKey; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmMatchingValueKeyArray: function() { return /* binding */ qsmMatchingValueKeyArray; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; - -//Get Unique array values -const qsmUniqueArray = arr => { - if (qsmIsEmpty(arr) || !Array.isArray(arr)) { - return arr; - } - return arr.filter((val, index, arr) => arr.indexOf(val) === index); -}; - -//Match array of object values and return array of cooresponding matching keys -const qsmMatchingValueKeyArray = (values, obj) => { - if (qsmIsEmpty(obj) || !Array.isArray(values)) { - return values; - } - return values.map(val => Object.keys(obj).find(key => obj[key] == val)); -}; - -//Decode htmlspecialchars -const qsmDecodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; -}; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from text content. -const qsmStripTags = text => { - let div = document.createElement("div"); - div.innerHTML = qsmDecodeHtml(text); - return div.innerText; -}; - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - //add to check if api call from editor - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//add objecyt to form data -const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { - if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { - return data; - } - for (let key in valueObj) { - if (valueObj.hasOwnProperty(key)) { - let value = valueObj[key]; - if ('object' === value) { - qsmAddObjToFormData(formKey + '[' + key + ']', value, data); - } else { - data.append(formKey + '[' + key + ']', valueObj[key]); - } - } - } - return data; -}; - -//Generate random number -const qsmGenerateRandomKey = length => { - const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - let key = ""; - - // Generate random bytes - const values = new Uint8Array(length); - window.crypto.getRandomValues(values); - for (let i = 0; i < length; i++) { - // Use the random byte to index into the charset - key += charset[values[i] % charset.length]; - } - return key; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const id = qsmGenerateRandomKey(8); - return `${prefix}${id}${random ? `.${qsmGenerateRandomKey(7)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "./src/page/edit.js": -/*!**************************!*\ - !*** ./src/page/edit.js ***! - \**************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - - -function Edit(props) { - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId, - context - } = props; - const quizID = context['quiz-master-next/quizID']; - const { - pageID, - pageKey, - hidePrevBtn - } = attributes; - const [qsmPageAttr, setQsmPageAttr] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData.globalQuizsetting); - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page Name', 'quiz-master-next'), - value: pageKey, - onChange: pageKey => setAttributes({ - pageKey - }) - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hide Previous Button?', 'quiz-master-next'), - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn, - onChange: () => setAttributes({ - hidePrevBtn: !(0,_helper__WEBPACK_IMPORTED_MODULE_5__.qsmIsEmpty)(hidePrevBtn) && '1' == hidePrevBtn ? 0 : 1 - }) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { - allowedBlocks: ['qsm/quiz-question'] - }))); -} - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "./src/page/block.json": -/*!*****************************!*\ - !*** ./src/page/block.json ***! - \*****************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-page","version":"0.1.0","title":"Page","category":"widgets","parent":["qsm/quiz"],"icon":"text-page","description":"QSM Quiz Page","attributes":{"pageID":{"type":"string","default":"0"},"pageKey":{"type":"string","default":""},"hidePrevBtn":{"type":"string","default":"0"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/quizAttr"],"providesContext":{"quiz-master-next/pageID":"pageID"},"example":{},"supports":{"html":false,"multiple":false},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!***************************!*\ - !*** ./src/page/index.js ***! - \***************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/page/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/page/block.json"); - - - -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"] -}); -}(); -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,l=(window.wp.apiFetch,window.wp.blockEditor),a=window.wp.components;const i=e=>null==e||""===e;var o=JSON.parse('{"u2":"qsm/quiz-page"}');(0,e.registerBlockType)(o.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:o,attributes:r,setAttributes:s,isSelected:c,clientId:u,context:m}=e,{pageID:d,pageKey:w,hidePrevBtn:p}=(m["quiz-master-next/quizID"],r),[g,q]=(0,t.useState)(qsmBlockData.globalQuizsetting),B=(0,l.useBlockProps)();return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(l.InspectorControls,null,(0,t.createElement)(a.PanelBody,{title:(0,n.__)("Page settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(a.TextControl,{label:(0,n.__)("Page Name","quiz-master-next"),value:w,onChange:e=>s({pageKey:e})}),(0,t.createElement)(a.ToggleControl,{label:(0,n.__)("Hide Previous Button?","quiz-master-next"),checked:!i(p)&&"1"==p,onChange:()=>s({hidePrevBtn:i(p)||"1"!=p?1:0})}))),(0,t.createElement)("div",{...B},(0,t.createElement)(l.InnerBlocks,{allowedBlocks:["qsm/quiz-question"]})))}})}(); \ No newline at end of file diff --git a/blocks/build/page/index.js.map b/blocks/build/page/index.js.map deleted file mode 100644 index e7baf7212..000000000 --- a/blocks/build/page/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"page/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAMA,UAAU,GAAKC,IAAI,IAAQ,WAAW,KAAK,OAAOA,IAAI,IAAI,IAAI,KAAKA,IAAI,IAAI,EAAE,KAAKA,IAAM;;AAErG;AACO,MAAMC,cAAc,GAAKC,GAAG,IAAM;EACxC,IAAKH,UAAU,CAAEG,GAAI,CAAC,IAAI,CAAEC,KAAK,CAACC,OAAO,CAAEF,GAAI,CAAC,EAAG;IAClD,OAAOA,GAAG;EACX;EACA,OAAOA,GAAG,CAACG,MAAM,CAAE,CAAEC,GAAG,EAAEC,KAAK,EAAEL,GAAG,KAAMA,GAAG,CAACM,OAAO,CAAEF,GAA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AW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AAEpCC,oEAAiB,CAAEC,6CAAa,EAAE;EACjC;AACD;AACA;EACCC,IAAI,EAAE1B,6CAAIA;AACX,CAAE,CAAC,C","sources":["webpack://qsm/./src/helper.js","webpack://qsm/./src/page/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/page/index.js"],"sourcesContent":["//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n//Match array of object values and return array of cooresponding matching keys \r\nexport const qsmMatchingValueKeyArray = ( values, obj ) => {\r\n\tif ( qsmIsEmpty( obj ) || ! Array.isArray( values ) ) {\r\n\t\treturn values;\r\n\t}\r\n\treturn values.map( ( val ) => Object.keys(obj).find( key => obj[key] == val) );\r\n}\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//Generate random number\r\nexport const qsmGenerateRandomKey = (length) => {\r\n const charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n let key = \"\";\r\n\r\n // Generate random bytes\r\n const values = new Uint8Array(length);\r\n window.crypto.getRandomValues(values);\r\n\r\n for (let i = 0; i < length; i++) {\r\n // Use the random byte to index into the charset\r\n key += charset[values[i] % charset.length];\r\n }\r\n\r\n return key;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const id = qsmGenerateRandomKey(8);\r\n return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(7) }`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tInspectorControls,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n} from '@wordpress/block-editor';\r\nimport {\r\n\tPanelBody,\r\n\tPanelRow,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tRangeControl,\r\n\tRadioControl,\r\n\tSelectControl,\r\n} from '@wordpress/components';\r\nimport { qsmIsEmpty } from '../helper';\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\t\r\n\tconst {\r\n\t\tpageID,\r\n\t\tpageKey,\r\n\t\thidePrevBtn,\r\n\t} = attributes;\r\n\r\n\tconst [ qsmPageAttr, setQsmPageAttr ] = useState( qsmBlockData.globalQuizsetting );\r\n\t\r\n\tconst blockProps = useBlockProps();\r\n\r\n\treturn (\r\n\t<>\r\n\t\r\n\t\t\r\n\t\t\t setAttributes( { pageKey } ) }\r\n\t\t\t/>\r\n\t\t\t setAttributes( { hidePrevBtn : ( ( ! qsmIsEmpty( hidePrevBtn ) && '1' == hidePrevBtn ) ? 0 : 1 ) } ) }\r\n\t\t\t/>\r\n\t\t\r\n\t\t\r\n\t\r\n\t
\r\n\t\t\r\n\t
\r\n\t\r\n\t);\r\n}\r\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\n\r\nregisterBlockType( metadata.name, {\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n} );\r\n"],"names":["qsmIsEmpty","data","qsmUniqueArray","arr","Array","isArray","filter","val","index","indexOf","qsmMatchingValueKeyArray","values","obj","map","Object","keys","find","key","qsmDecodeHtml","html","txt","document","createElement","innerHTML","value","qsmSanitizeName","name","toLowerCase","replace","qsmStripTags","text","div","innerText","qsmFormData","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmGenerateRandomKey","length","charset","Uint8Array","window","crypto","getRandomValues","i","qsmUniqid","prefix","random","id","qsmValueOrDefault","defaultValue","__","useState","useEffect","apiFetch","InspectorControls","InnerBlocks","useBlockProps","PanelBody","PanelRow","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","Edit","props","qsmBlockData","className","attributes","setAttributes","isSelected","clientId","context","quizID","pageID","pageKey","hidePrevBtn","qsmPageAttr","setQsmPageAttr","globalQuizsetting","blockProps","Fragment","title","initialOpen","label","onChange","checked","allowedBlocks","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php index f561fdc4e..a9403634f 100644 --- a/blocks/build/question/index.asset.php +++ b/blocks/build/question/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '79942d734c1eedd39da1'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'c31cb48245743f813ffb'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 152936b1f..31450ef2c 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -1,1343 +1,5 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/component/FeaturedImage.js": -/*!****************************************!*\ - !*** ./src/component/FeaturedImage.js ***! - \****************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks"); -/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/blob */ "@wordpress/blob"); -/* harmony import */ var _wordpress_blob__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blob__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - -/** - * WordPress dependencies - */ - - - - - - - - - - -const ALLOWED_MEDIA_TYPES = ['image']; - -// Used when labels from post type were not yet loaded or when they are not present. -const DEFAULT_FEATURE_IMAGE_LABEL = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Featured image'); -const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Set featured image'); -const instructions = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('To edit the featured image, you need permission to upload media.')); -const FeaturedImage = ({ - featureImageID, - onUpdateImage, - onRemoveImage -}) => { - const { - createNotice - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__.store); - const toggleRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(); - const [isLoading, setIsLoading] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - const [media, setMedia] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(undefined); - const { - mediaFeature, - mediaUpload - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_6__.useSelect)(select => { - const { - getMedia - } = select(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_8__.store); - return { - mediaFeature: (0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(media) && !(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(featureImageID) && getMedia(featureImageID), - mediaUpload: select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.store).getSettings().mediaUpload - }; - }, []); - - /**Set media data */ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetQSMAttr = true; - if (shouldSetQSMAttr) { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_9__.qsmIsEmpty)(mediaFeature) && 'object' === typeof mediaFeature) { - setMedia({ - id: featureImageID, - width: mediaFeature.media_details.width, - height: mediaFeature.media_details.height, - url: mediaFeature.source_url, - alt_text: mediaFeature.alt_text, - slug: mediaFeature.slug - }); - } - } - - //cleanup - return () => { - shouldSetQSMAttr = false; - }; - }, [mediaFeature]); - function onDropFiles(filesList) { - mediaUpload({ - allowedTypes: ['image'], - filesList, - onFileChange([image]) { - if ((0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_4__.isBlobURL)(image?.url)) { - setIsLoading(true); - return; - } - onUpdateImage(image); - setIsLoading(false); - }, - onError(message) { - createNotice('error', message, { - isDismissible: true, - type: 'snackbar' - }); - } - }); - } - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "editor-post-featured-image" - }, media && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - id: `editor-post-featured-image-${featureImageID}-describedby`, - className: "hidden" - }, media.alt_text && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)( - // Translators: %s: The selected image alt text. - (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)( - // Translators: %s: The selected image filename. - (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('The current image has no alternative text. The file name is: %s'), media.slug)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.MediaUploadCheck, { - fallback: instructions - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.MediaUpload, { - title: DEFAULT_FEATURE_IMAGE_LABEL, - onSelect: media => { - setMedia(media); - onUpdateImage(media); - }, - unstableFeaturedImageFlow: true, - allowedTypes: ALLOWED_MEDIA_TYPES, - modalClass: "editor-post-featured-image__media-modal", - render: ({ - open - }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "editor-post-featured-image__container" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - ref: toggleRef, - className: !featureImageID ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', - onClick: open, - "aria-label": !featureImageID ? null : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Edit or replace the image'), - "aria-describedby": !featureImageID ? null : `editor-post-featured-image-${featureImageID}-describedby` - }, !!featureImageID && media && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ResponsiveWrapper, { - naturalWidth: media.width, - naturalHeight: media.height, - isInline: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { - src: media.url, - alt: media.alt_text - })), isLoading && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Spinner, null), !featureImageID && !isLoading && DEFAULT_SET_FEATURE_IMAGE_LABEL), !!featureImageID && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.__experimentalHStack, { - className: "editor-post-featured-image__actions" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - className: "editor-post-featured-image__action", - onClick: open - // Prefer that screen readers use the .editor-post-featured-image__preview button. - , - "aria-hidden": "true" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Replace')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - className: "editor-post-featured-image__action", - onClick: () => { - onRemoveImage(); - toggleRef.current.focus(); - } - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Remove'))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.DropZone, { - onFilesDrop: onDropFiles - })), - value: featureImageID - }))); -}; -/* harmony default export */ __webpack_exports__["default"] = (FeaturedImage); - -/***/ }), - -/***/ "./src/component/SelectAddCategory.js": -/*!********************************************!*\ - !*** ./src/component/SelectAddCategory.js ***! - \********************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - -/** - * Select or add a category - */ - - - - - -const SelectAddCategory = ({ - isCategorySelected, - setUnsetCatgory -}) => { - //whether showing add category form - const [showForm, setShowForm] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //new category name - const [formCatName, setFormCatName] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(''); - //new category prent id - const [formCatParent, setFormCatParent] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(0); - //new category adding start status - const [addingNewCategory, setAddingNewCategory] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //error - const [newCategoryError, setNewCategoryError] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - //category list - const [categories, setCategories] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(qsmBlockData?.hierarchicalCategoryList); - - //get category id-details object - const getCategoryIdDetailsObject = categories => { - let catObj = {}; - categories.forEach(cat => { - catObj[cat.id] = cat; - if (0 < cat.children.length) { - let childCategory = getCategoryIdDetailsObject(cat.children); - catObj = { - ...catObj, - ...childCategory - }; - } - }); - return catObj; - }; - - //category id wise details - const [categoryIdDetails, setCategoryIdDetails] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)((0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmIsEmpty)(qsmBlockData?.hierarchicalCategoryList) ? {} : getCategoryIdDetailsObject(qsmBlockData.hierarchicalCategoryList)); - const addNewCategoryLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Category ', 'quiz-master-next'); - const noParentOption = `— ${(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Parent Category ', 'quiz-master-next')} —`; - - //Add new category - const onAddCategory = async event => { - event.preventDefault(); - if (newCategoryError || (0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmIsEmpty)(formCatName) || addingNewCategory) { - return; - } - setAddingNewCategory(true); - - //create a page - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - url: qsmBlockData.ajax_url, - method: 'POST', - body: (0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmFormData)({ - 'action': 'save_new_category', - 'name': formCatName, - 'parent': formCatParent - }) - }).then(res => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_4__.qsmIsEmpty)(res.term_id)) { - let term_id = res.term_id; - //console.log("save_new_category",res); - //set category list - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/quiz/hierarchical-category-list', - method: 'POST' - }).then(res => { - // console.log("new categorieslist", res); - if ('success' == res.status) { - setCategories(res.result); - setCategoryIdDetails(res.result); - //set form - setFormCatName(''); - setFormCatParent(0); - //set category selected - setUnsetCatgory(term_id, getCategoryIdDetailsObject(term.id)); - setAddingNewCategory(false); - } - }); - } - }); - }; - - //get category name array - const getCategoryNameArray = categories => { - let cats = []; - categories.forEach(cat => { - cats.push(cat.name); - if (0 < cat.children.length) { - let childCategory = getCategoryNameArray(cat.children); - cats = [...cats, ...childCategory]; - } - }); - return cats; - }; - - //check if category name already exists and set new category name - const checkSetNewCategory = (catName, categories) => { - categories = getCategoryNameArray(categories); - console.log("categories", categories); - if (categories.includes(catName)) { - setNewCategoryError(catName); - } else { - setNewCategoryError(false); - setFormCatName(catName); - } - // categories.forEach( cat => { - // if ( cat.name == catName ) { - // matchName = true; - // return false; - // } else if ( 0 < cat.children.length ) { - // checkSetNewCategory( catName, cat.children ) - // } - // }); - - // if ( matchName ) { - // setNewCategoryError( matchName ); - // } else { - // setNewCategoryError( matchName ); - // setFormCatName( catName ); - // } - }; - - const renderTerms = categories => { - return categories.map(term => { - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - key: term.id, - className: "editor-post-taxonomies__hierarchical-terms-choice" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.CheckboxControl, { - label: term.name, - checked: isCategorySelected(term.id), - onChange: () => setUnsetCatgory(term.id, categoryIdDetails) - }), !!term.children.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "editor-post-taxonomies__hierarchical-terms-subchoices" - }, renderTerms(term.children))); - }); - }; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Categories', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "editor-post-taxonomies__hierarchical-terms-list", - tabIndex: "0", - role: "group", - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Categories', 'quiz-master-next') - }, renderTerms(categories)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "qsm-ptb-1" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - variant: "link", - onClick: () => setShowForm(!showForm) - }, addNewCategoryLabel)), showForm && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("form", { - onSubmit: onAddCategory - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Flex, { - direction: "column", - gap: "1" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.TextControl, { - __nextHasNoMarginBottom: true, - className: "editor-post-taxonomies__hierarchical-terms-input", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Category Name', 'quiz-master-next'), - value: formCatName, - onChange: formCatName => checkSetNewCategory(formCatName, categories), - required: true - }), 0 < categories.length && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.TreeSelect, { - __nextHasNoMarginBottom: true, - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Parent Category', 'quiz-master-next'), - noOptionLabel: noParentOption, - onChange: id => setFormCatParent(id), - selectedId: formCatParent, - tree: categories - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FlexItem, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { - variant: "secondary", - type: "submit", - className: "editor-post-taxonomies__hierarchical-terms-submit", - disabled: newCategoryError || addingNewCategory - }, addNewCategoryLabel)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FlexItem, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { - className: "qsm-error-text" - }, false !== newCategoryError && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Category ', 'quiz-master-next') + newCategoryError + (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)(' already exists.', 'quiz-master-next')))))); -}; -/* harmony default export */ __webpack_exports__["default"] = (SelectAddCategory); - -/***/ }), - -/***/ "./src/component/icon.js": -/*!*******************************!*\ - !*** ./src/component/icon.js ***! - \*******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ answerOptionBlockIcon: function() { return /* binding */ answerOptionBlockIcon; }, -/* harmony export */ qsmBlockIcon: function() { return /* binding */ qsmBlockIcon; }, -/* harmony export */ questionBlockIcon: function() { return /* binding */ questionBlockIcon; }, -/* harmony export */ warningIcon: function() { return /* binding */ warningIcon; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); - - -//QSM Quiz Block -const qsmBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "3", - fill: "black" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z", - fill: "white" - })) -}); - -//Question Block -const questionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "25", - height: "25", - viewBox: "0 0 25 25", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - x: "0.102539", - y: "0.101562", - width: "24", - height: "24", - rx: "4.68852", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z", - fill: "white" - })) -}); - -//Answer option Block -const answerOptionBlockIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("rect", { - width: "24", - height: "24", - rx: "4.21657", - fill: "#ADADAD" - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z", - fill: "white" - })) -}); - -//Warning icon -const warningIcon = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { - icon: () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { - width: "54", - height: "54", - viewBox: "0 0 54 54", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { - d: "M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z", - stroke: "#B45309", - strokeWidth: "1.65929", - strokeLinecap: "round", - strokeLinejoin: "round" - })) -}); - -/***/ }), - -/***/ "./src/helper.js": -/*!***********************!*\ - !*** ./src/helper.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ qsmAddObjToFormData: function() { return /* binding */ qsmAddObjToFormData; }, -/* harmony export */ qsmDecodeHtml: function() { return /* binding */ qsmDecodeHtml; }, -/* harmony export */ qsmFormData: function() { return /* binding */ qsmFormData; }, -/* harmony export */ qsmGenerateRandomKey: function() { return /* binding */ qsmGenerateRandomKey; }, -/* harmony export */ qsmIsEmpty: function() { return /* binding */ qsmIsEmpty; }, -/* harmony export */ qsmMatchingValueKeyArray: function() { return /* binding */ qsmMatchingValueKeyArray; }, -/* harmony export */ qsmSanitizeName: function() { return /* binding */ qsmSanitizeName; }, -/* harmony export */ qsmStripTags: function() { return /* binding */ qsmStripTags; }, -/* harmony export */ qsmUniqid: function() { return /* binding */ qsmUniqid; }, -/* harmony export */ qsmUniqueArray: function() { return /* binding */ qsmUniqueArray; }, -/* harmony export */ qsmValueOrDefault: function() { return /* binding */ qsmValueOrDefault; } -/* harmony export */ }); -//Check if undefined, null, empty -const qsmIsEmpty = data => 'undefined' === typeof data || null === data || '' === data; - -//Get Unique array values -const qsmUniqueArray = arr => { - if (qsmIsEmpty(arr) || !Array.isArray(arr)) { - return arr; - } - return arr.filter((val, index, arr) => arr.indexOf(val) === index); -}; - -//Match array of object values and return array of cooresponding matching keys -const qsmMatchingValueKeyArray = (values, obj) => { - if (qsmIsEmpty(obj) || !Array.isArray(values)) { - return values; - } - return values.map(val => Object.keys(obj).find(key => obj[key] == val)); -}; - -//Decode htmlspecialchars -const qsmDecodeHtml = html => { - var txt = document.createElement("textarea"); - txt.innerHTML = html; - return txt.value; -}; -const qsmSanitizeName = name => { - if (qsmIsEmpty(name)) { - name = ''; - } else { - name = name.toLowerCase().replace(/ /g, '_'); - name = name.replace(/\W/g, ''); - } - return name; -}; - -// Remove anchor tags from text content. -const qsmStripTags = text => { - let div = document.createElement("div"); - div.innerHTML = qsmDecodeHtml(text); - return div.innerText; -}; - -//prepare form data -const qsmFormData = (obj = false) => { - let newData = new FormData(); - //add to check if api call from editor - newData.append('qsm_block_api_call', '1'); - if (false !== obj) { - for (let k in obj) { - if (obj.hasOwnProperty(k)) { - newData.append(k, obj[k]); - } - } - } - return newData; -}; - -//add objecyt to form data -const qsmAddObjToFormData = (formKey, valueObj, data = new FormData()) => { - if (qsmIsEmpty(formKey) || qsmIsEmpty(valueObj) || 'object' !== typeof valueObj) { - return data; - } - for (let key in valueObj) { - if (valueObj.hasOwnProperty(key)) { - let value = valueObj[key]; - if ('object' === value) { - qsmAddObjToFormData(formKey + '[' + key + ']', value, data); - } else { - data.append(formKey + '[' + key + ']', valueObj[key]); - } - } - } - return data; -}; - -//Generate random number -const qsmGenerateRandomKey = length => { - const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - let key = ""; - - // Generate random bytes - const values = new Uint8Array(length); - window.crypto.getRandomValues(values); - for (let i = 0; i < length; i++) { - // Use the random byte to index into the charset - key += charset[values[i] % charset.length]; - } - return key; -}; - -//generate uiniq id -const qsmUniqid = (prefix = "", random = false) => { - const id = qsmGenerateRandomKey(8); - return `${prefix}${id}${random ? `.${qsmGenerateRandomKey(7)}` : ""}`; -}; - -//return data if not empty otherwise default value -const qsmValueOrDefault = (data, defaultValue = '') => qsmIsEmpty(data) ? defaultValue : data; - -/***/ }), - -/***/ "./src/question/edit.js": -/*!******************************!*\ - !*** ./src/question/edit.js ***! - \******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ Edit; } -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices"); -/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _component_FeaturedImage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../component/FeaturedImage */ "./src/component/FeaturedImage.js"); -/* harmony import */ var _component_SelectAddCategory__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../component/SelectAddCategory */ "./src/component/SelectAddCategory.js"); -/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../component/icon */ "./src/component/icon.js"); -/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../helper */ "./src/helper.js"); - - - - - - - - - - - - - - -//check for duplicate questionID attr -const isQuestionIDReserved = (questionIDCheck, clientIdCheck) => { - const blocksClientIds = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.select)('core/block-editor').getClientIdsWithDescendants(); - return (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(blocksClientIds) ? false : blocksClientIds.some(blockClientId => { - const { - questionID - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.select)('core/block-editor').getBlockAttributes(blockClientId); - //different Client Id but same questionID attribute means duplicate - return clientIdCheck !== blockClientId && questionID === questionIDCheck; - }); -}; - -/** - * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array - * - */ -function Edit(props) { - var _settings$file_upload; - //check for QSM initialize data - if ('undefined' === typeof qsmBlockData) { - return null; - } - const { - className, - attributes, - setAttributes, - isSelected, - clientId, - context - } = props; - - /** https://github.com/WordPress/gutenberg/issues/22282 */ - const isParentOfSelectedBlock = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => isSelected || select('core/block-editor').hasSelectedInnerBlock(clientId, true)); - const quizID = context['quiz-master-next/quizID']; - const { - quiz_name, - post_id, - rest_nonce - } = context['quiz-master-next/quizAttr']; - const pageID = context['quiz-master-next/pageID']; - const { - createNotice - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__.store); - - //Get finstion to find index of blocks - const { - getBlockRootClientId, - getBlockIndex - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.store); - - //Get funstion to insert block - const { - insertBlock - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.store); - const { - isChanged = false, - //use in editor only to detect if any change occur in this block - questionID, - type, - description, - title, - correctAnswerInfo, - commentBox, - category, - multicategories = [], - hint, - featureImageID, - featureImageSrc, - answers, - answerEditor, - matchAnswer, - required, - settings = {} - } = attributes; - - //Variable to decide if correct answer info input field should be available - const [enableCorrectAnsInfo, setEnableCorrectAnsInfo] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(correctAnswerInfo)); - //Advance Question modal - const [isOpenAdvanceQModal, setIsOpenAdvanceQModal] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - const proActivated = '1' == qsmBlockData.is_pro_activated; - const isAdvanceQuestionType = qtype => 14 < parseInt(qtype); - - //Available file types - const fileTypes = qsmBlockData.file_upload_type.options; - - //Get selected file types - const selectedFileTypes = () => { - let file_types = settings?.file_upload_type || qsmBlockData.file_upload_type.default; - return (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(file_types) ? [] : file_types.split(','); - }; - - //Is file type checked - const isCheckedFileType = fileType => selectedFileTypes().includes(fileType); - - //Set file type - const setFileTypes = fileType => { - let file_types = selectedFileTypes(); - if (file_types.includes(fileType)) { - file_types = file_types.filter(file_type => file_type != fileType); - } else { - file_types.push(fileType); - } - file_types = file_types.join(','); - setAttributes({ - settings: { - ...settings, - file_upload_type: file_types - } - }); - }; - - /**Generate question id if not set or in case duplicate questionID ***/ - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetID = true; - if (shouldSetID) { - if ((0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(questionID) || '0' == questionID || !(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(questionID) && isQuestionIDReserved(questionID, clientId)) { - //create a question - let newQuestion = (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmFormData)({ - "id": null, - "rest_nonce": rest_nonce, - "quizID": quizID, - "quiz_name": quiz_name, - "postID": post_id, - "answerEditor": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(answerEditor, 'text'), - "type": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(type, '0'), - "name": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(description)), - "question_title": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(title), - "answerInfo": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmDecodeHtml)((0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(correctAnswerInfo)), - "comments": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(commentBox, '1'), - "hint": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(hint), - "category": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(category), - "multicategories": [], - "required": (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmValueOrDefault)(required, 0), - "answers": answers, - "page": 0, - "featureImageID": featureImageID, - "featureImageSrc": featureImageSrc, - "matchAnswer": null - }); - - //AJAX call - _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ - path: '/quiz-survey-master/v1/questions', - method: 'POST', - body: newQuestion - }).then(response => { - if ('success' == response.status) { - let question_id = response.id; - setAttributes({ - questionID: question_id - }); - } - }).catch(error => { - console.log('error', error); - createNotice('error', error.message, { - isDismissible: true, - type: 'snackbar' - }); - }); - } - } - - //cleanup - return () => { - shouldSetID = false; - }; - }, []); - - //detect change in question - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - let shouldSetChanged = true; - if (shouldSetChanged && isSelected && false === isChanged) { - setAttributes({ - isChanged: true - }); - } - - //cleanup - return () => { - shouldSetChanged = false; - }; - }, [questionID, type, description, title, correctAnswerInfo, commentBox, category, multicategories, hint, featureImageID, featureImageSrc, answers, answerEditor, matchAnswer, required, settings]); - - //add classes - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({ - className: isParentOfSelectedBlock ? ' in-editing-mode' : '' - }); - const QUESTION_TEMPLATE = [['qsm/quiz-answer-option', { - optionID: '0' - }], ['qsm/quiz-answer-option', { - optionID: '1' - }]]; - - //Get category ancestor - const getCategoryAncestors = (termId, categories) => { - let parents = []; - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(categories[termId]) && '0' != categories[termId]['parent']) { - termId = categories[termId]['parent']; - parents.push(termId); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(categories[termId]) && '0' != categories[termId]['parent']) { - let ancestor = getCategoryAncestors(termId, categories); - parents = [...parents, ...ancestor]; - } - } - return (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmUniqueArray)(parents); - }; - - //check if a category is selected - const isCategorySelected = termId => multicategories.includes(termId); - - //set or unset category - const setUnsetCatgory = (termId, categories) => { - let multiCat = (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(multicategories) || 0 === multicategories.length ? (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(category) ? [] : [category] : multicategories; - - //Case: category unselected - if (multiCat.includes(termId)) { - //remove category if already set - multiCat = multiCat.filter(catID => catID != termId); - let children = []; - //check for if any child is selcted - multiCat.forEach(childCatID => { - //get ancestors of category - let ancestorIds = getCategoryAncestors(childCatID, categories); - //given unselected category is an ancestor of selected category - if (ancestorIds.includes(termId)) { - //remove category if already set - multiCat = multiCat.filter(catID => catID != childCatID); - } - }); - } else { - //add category if not set - multiCat.push(termId); - //get ancestors of category - let ancestorIds = getCategoryAncestors(termId, categories); - //select all ancestor - multiCat = [...multiCat, ...ancestorIds]; - } - multiCat = (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmUniqueArray)(multiCat); - setAttributes({ - category: '', - multicategories: [...multiCat] - }); - }; - - //Notes relation to question type - const notes = ['12', '7', '3', '5', '14'].includes(type) ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Note: Add only correct answer options with their respective points score.', 'quiz-master-next') : ''; - - //set Question type - const setQuestionType = qtype => { - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(MicroModal) && !proActivated && ['15', '16', '17'].includes(qtype)) { - //Show modal for advance question type - let modalEl = document.getElementById('modal-advanced-question-type'); - if (!(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(modalEl)) { - MicroModal.show('modal-advanced-question-type'); - } - } else if (proActivated && isAdvanceQuestionType(qtype)) { - setIsOpenAdvanceQModal(true); - } else { - setAttributes({ - type: qtype - }); - } - }; - - //insert new Question - const insertNewQuestion = () => { - if ((0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(props?.name)) { - console.log("block name not found"); - return true; - } - const blockToInsert = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__.createBlock)(props.name); - const selectBlockOnInsert = true; - insertBlock(blockToInsert, getBlockIndex(clientId) + 1, getBlockRootClientId(clientId), selectBlockOnInsert); - }; - - //insert new Question - const insertNewPage = () => { - const blockToInsert = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_6__.createBlock)('qsm/quiz-page'); - const currentPageClientID = getBlockRootClientId(clientId); - const newPageIndex = getBlockIndex(currentPageClientID) + 1; - const qsmBlockClientID = getBlockRootClientId(currentPageClientID); - const selectBlockOnInsert = true; - insertBlock(blockToInsert, newPageIndex, qsmBlockClientID, selectBlockOnInsert); - }; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToolbarGroup, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToolbarButton, { - icon: "plus-alt2", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Question', 'quiz-master-next'), - onClick: () => insertNewQuestion() - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToolbarButton, { - icon: "welcome-add-page", - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Page', 'quiz-master-next'), - onClick: () => insertNewPage() - }))), isOpenAdvanceQModal && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Modal, { - contentLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Use QSM Editor for Advanced Question', 'quiz-master-next'), - className: "qsm-advance-q-modal", - isDismissible: false, - size: "small", - __experimentalHideHeader: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "qsm-modal-body" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", { - className: "qsm-title" - }, (0,_component_icon__WEBPACK_IMPORTED_MODULE_10__.warningIcon)(), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("br", null), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Use QSM editor for Advanced Question', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { - className: "qsm-description" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.", "quiz-master-next")), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "qsm-modal-btn-wrapper" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { - variant: "secondary", - onClick: () => setIsOpenAdvanceQModal(false) - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Cancel', 'quiz-master-next')), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { - variant: "primary", - onClick: () => {} - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ExternalLink, { - href: qsmBlockData.quiz_settings_url + '&quiz_id=' + quizID - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add Question from quiz editor', 'quiz-master-next')))))), isAdvanceQuestionType(type) ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", { - className: "block-editor-block-card__title" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('ID', 'quiz-master-next') + ': ' + questionID), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advanced Question Type', 'quiz-master-next')))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h4", { - className: 'qsm-question-title qsm-error-text' - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Advanced Question Type : ', 'quiz-master-next') + title), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Edit question in QSM ', 'quiz-master-next'), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ExternalLink, { - href: qsmBlockData.quiz_settings_url + '&quiz_id=' + quizID - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('editor', 'quiz-master-next'))))) : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question settings', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", { - className: "block-editor-block-card__title" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('ID', 'quiz-master-next') + ': ' + questionID), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: qsmBlockData.question_type.label, - value: type || qsmBlockData.question_type.default, - onChange: type => setQuestionType(type), - help: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(qsmBlockData.question_type_description[type]) ? '' : qsmBlockData.question_type_description[type] + ' ' + notes, - __nextHasNoMarginBottom: true - }, !(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(qsmBlockData.question_type.options) && qsmBlockData.question_type.options.map(qtypes => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("optgroup", { - label: qtypes.category, - key: "qtypes" + qtypes.category - }, qtypes.types.map(qtype => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("option", { - value: qtype.slug, - key: "qtype" + qtype.slug - }, qtype.name))))), ['0', '4', '1', '10', '13'].includes(type) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: qsmBlockData.answerEditor.label, - value: answerEditor || qsmBlockData.answerEditor.default, - options: qsmBlockData.answerEditor.options, - onChange: answerEditor => setAttributes({ - answerEditor - }), - __nextHasNoMarginBottom: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Required', 'quiz-master-next'), - checked: !(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(required) && '1' == required, - onChange: () => setAttributes({ - required: !(0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmIsEmpty)(required) && '1' == required ? 0 : 1 - }) - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show Correct Answer Info', 'quiz-master-next'), - checked: enableCorrectAnsInfo, - onChange: () => setEnableCorrectAnsInfo(!enableCorrectAnsInfo) - })), '11' == type && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('File Settings', 'quiz-master-next'), - initialOpen: false - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - type: "number", - label: qsmBlockData.file_upload_limit.heading, - value: (_settings$file_upload = settings?.file_upload_limit) !== null && _settings$file_upload !== void 0 ? _settings$file_upload : qsmBlockData.file_upload_limit.default, - onChange: limit => setAttributes({ - settings: { - ...settings, - file_upload_limit: limit - } - }) - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", { - className: "qsm-inspector-label" - }, qsmBlockData.file_upload_type.heading), Object.keys(qsmBlockData.file_upload_type.options).map(filetype => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.CheckboxControl, { - key: 'filetype-' + filetype, - label: fileTypes[filetype], - checked: isCheckedFileType(filetype), - onChange: () => setFileTypes(filetype) - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_SelectAddCategory__WEBPACK_IMPORTED_MODULE_9__["default"], { - isCategorySelected: isCategorySelected, - setUnsetCatgory: setUnsetCatgory - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Hint', 'quiz-master-next'), - initialOpen: false - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.TextControl, { - label: "", - value: hint, - onChange: hint => setAttributes({ - hint: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmStripTags)(hint) - }) - })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: qsmBlockData.commentBox.heading, - initialOpen: false - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.SelectControl, { - label: qsmBlockData.commentBox.label, - value: commentBox || qsmBlockData.commentBox.default, - options: qsmBlockData.commentBox.options, - onChange: commentBox => setAttributes({ - commentBox - }), - __nextHasNoMarginBottom: true - })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Featured image', 'quiz-master-next'), - initialOpen: true - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_component_FeaturedImage__WEBPACK_IMPORTED_MODULE_8__["default"], { - featureImageID: featureImageID, - onUpdateImage: mediaDetails => { - setAttributes({ - featureImageID: mediaDetails.id, - featureImageSrc: mediaDetails.url - }); - }, - onRemoveImage: id => { - setAttributes({ - featureImageID: undefined, - featureImageSrc: undefined - }); - } - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "h4", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question title', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Type your question here', 'quiz-master-next'), - value: title, - onChange: title => setAttributes({ - title: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmStripTags)(title) - }), - allowedFormats: [], - withoutInteractiveFormatting: true, - className: 'qsm-question-title' - }), isParentOfSelectedBlock && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Question description', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Description goes here... (optional)', 'quiz-master-next'), - value: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmDecodeHtml)(description), - onChange: description => setAttributes({ - description - }), - className: 'qsm-question-description', - __unstableEmbedURLOnPaste: true, - __unstableAllowPrefixTransformations: true - }), !['8', '11', '6', '9'].includes(type) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { - allowedBlocks: ['qsm/quiz-answer-option'], - template: QUESTION_TEMPLATE - }), enableCorrectAnsInfo && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - tagName: "p", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct Answer Info', 'quiz-master-next'), - placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Correct answer info goes here', 'quiz-master-next'), - value: (0,_helper__WEBPACK_IMPORTED_MODULE_11__.qsmDecodeHtml)(correctAnswerInfo), - onChange: correctAnswerInfo => setAttributes({ - correctAnswerInfo - }), - className: 'qsm-question-correct-answer-info', - __unstableEmbedURLOnPaste: true, - __unstableAllowPrefixTransformations: true - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, { - icon: "plus-alt2", - onClick: () => insertNewQuestion(), - variant: "secondary", - className: "add-new-question-btn" - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add New Question', 'quiz-master-next')))))); -} - -/***/ }), - -/***/ "@wordpress/api-fetch": -/*!**********************************!*\ - !*** external ["wp","apiFetch"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["apiFetch"]; - -/***/ }), - -/***/ "@wordpress/blob": -/*!******************************!*\ - !*** external ["wp","blob"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blob"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ (function(module) { - -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/core-data": -/*!**********************************!*\ - !*** external ["wp","coreData"] ***! - \**********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["coreData"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/hooks": -/*!*******************************!*\ - !*** external ["wp","hooks"] ***! - \*******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["hooks"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ (function(module) { - -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "@wordpress/notices": -/*!*********************************!*\ - !*** external ["wp","notices"] ***! - \*********************************/ -/***/ (function(module) { - -module.exports = window["wp"]["notices"]; - -/***/ }), - -/***/ "./src/question/block.json": -/*!*********************************!*\ - !*** ./src/question/block.json ***! - \*********************************/ -/***/ (function(module) { - -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"qsm/quiz-question","version":"0.1.0","title":"Question","category":"widgets","parent":["qsm/quiz-page"],"icon":"move","description":"QSM Quiz Question","attributes":{"isChanged":{"type":"string","default":false},"questionID":{"type":"string","default":"0"},"type":{"type":"string","default":"0"},"description":{"type":"string","source":"html","selector":"p","default":""},"title":{"type":"string","default":""},"correctAnswerInfo":{"type":"string","source":"html","selector":"p","default":""},"commentBox":{"type":"string","default":"1"},"category":{"type":"number"},"multicategories":{"type":"array"},"hint":{"type":"string"},"featureImageID":{"type":"number"},"featureImageSrc":{"type":"string"},"answers":{"type":"array"},"answerEditor":{"type":"string","default":"text"},"matchAnswer":{"type":"string","default":"random"},"required":{"type":"string","default":"0"},"media":{"type":"object"},"settings":{"type":"object"}},"usesContext":["quiz-master-next/quizID","quiz-master-next/pageID","quiz-master-next/quizAttr"],"providesContext":{"quiz-master-next/questionID":"questionID","quiz-master-next/questionType":"type","quiz-master-next/answerType":"answerEditor","quiz-master-next/questionChanged":"isChanged"},"example":{},"supports":{"html":false,"anchor":true,"className":true,"interactivity":{"clientNavigation":true}},"textdomain":"main-block","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -!function() { -/*!*******************************!*\ - !*** ./src/question/index.js ***! - \*******************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/question/edit.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/question/block.json"); -/* harmony import */ var _component_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../component/icon */ "./src/component/icon.js"); - - - - -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { - icon: _component_icon__WEBPACK_IMPORTED_MODULE_3__.questionBlockIcon, - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], - __experimentalLabel(attributes, { - context - }) { - const { - title - } = attributes; - const customName = attributes?.metadata?.name; - const hasContent = title?.length > 0; - - // In the list view, use the question title as the label. - // If the title is empty, fall back to the default label. - if (context === 'list-view' && (customName || hasContent)) { - return customName || title; - } - } -}); -}(); -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch,l=e.n(r),i=window.wp.blockEditor,o=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,_=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),p=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=p(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],E=(0,n.__)("Featured image"),x=(0,n.__)("Set featured image"),C=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media."));var w=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:l}=(0,s.useDispatch)(o.store),_=(0,a.useRef)(),[p,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:w,mediaUpload:y}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function b(e){y({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){l("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(w)||"object"!=typeof w||q({id:e,width:w.media_details.width,height:w.media_details.height,url:w.source_url,alt_text:w.alt_text,slug:w.slug})),()=>{t=!1}}),[w]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( +// Translators: %s: The selected image alt text. +(0,n.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,n.sprintf)( +// Translators: %s: The selected image filename. +(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:C},(0,a.createElement)(i.MediaUpload,{title:E,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&x),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),_.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:b})),value:e})))},y=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,E]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,C)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},v(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},v(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},y)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(o)||_||(p(!0),l()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:o,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;l()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(E(e.result),w(e.result),s(""),u(0),t(a,x(term.id)),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:o,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||_},y)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},b=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(b.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){var r;if("undefined"==typeof qsmBlockData)return null;const{className:m,attributes:u,setAttributes:f,isSelected:E,clientId:x,context:C}=e,b=(0,s.useSelect)((e=>E||e("core/block-editor").hasSelectedInnerBlock(x,!0))),k=C["quiz-master-next/quizID"],{quiz_name:v,post_id:B,rest_nonce:z}=C["quiz-master-next/quizAttr"],{createNotice:D}=(C["quiz-master-next/pageID"],(0,s.useDispatch)(o.store)),{getBlockRootClientId:I,getBlockIndex:N}=(0,s.useSelect)(i.store),{insertBlock:S}=(0,s.useDispatch)(i.store),{isChanged:T=!1,questionID:A,type:M,description:L,title:P,correctAnswerInfo:F,commentBox:O,category:Q,multicategories:H=[],hint:R,featureImageID:U,featureImageSrc:j,answers:W,answerEditor:Z,matchAnswer:V,required:$,settings:G={}}=u,[J,K]=(0,a.useState)(!d(F)),[X,Y]=(0,a.useState)(!1),ee="1"==qsmBlockData.is_pro_activated,te=e=>14{let e=G?.file_upload_type||qsmBlockData.file_upload_type.default;return d(e)?[]:e.split(",")};(0,a.useEffect)((()=>{let e=!0;if(e&&(d(A)||"0"==A||!d(A)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(A,x))){let e=h({id:null,rest_nonce:z,quizID:k,quiz_name:v,postID:B,answerEditor:q(Z,"text"),type:q(M,"0"),name:p(q(L)),question_title:q(P),answerInfo:p(q(F)),comments:q(O,"1"),hint:q(R),category:q(Q),multicategories:[],required:q($,0),answers:W,page:0,featureImageID:U,featureImageSrc:j,matchAnswer:null});l()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;f({questionID:t})}})).catch((e=>{console.log("error",e),D("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&E&&!1===T&&f({isChanged:!0}),()=>{e=!1}}),[A,M,L,P,F,O,Q,H,R,U,j,W,Z,V,$,G]);const re=(0,i.useBlockProps)({className:b?" in-editing-mode":""}),le=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=le(e,t);a=[...a,...n]}return _(a)},ie=["12","7","3","5","14"].includes(M)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"",oe=()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);S(a,N(x)+1,I(x),!0)};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>oe()}),(0,a.createElement)(c.ToolbarButton,{icon:"welcome-add-page",label:(0,n.__)("Add New Page","quiz-master-next"),onClick:()=>(()=>{const e=(0,t.createBlock)("qsm/quiz-page"),a=I(x),n=N(a)+1,r=I(a);S(e,n,r,!0)})()}))),X&&(0,a.createElement)(c.Modal,{contentLabel:(0,n.__)("Use QSM Editor for Advanced Question","quiz-master-next"),className:"qsm-advance-q-modal",isDismissible:!1,size:"small",__experimentalHideHeader:!0},(0,a.createElement)("div",{className:"qsm-modal-body"},(0,a.createElement)("h3",{className:"qsm-title"},(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"54",height:"54",viewBox:"0 0 54 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{d:"M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z",stroke:"#B45309",strokeWidth:"1.65929",strokeLinecap:"round",strokeLinejoin:"round"}))}),(0,a.createElement)("br",null),(0,n.__)("Use QSM editor for Advanced Question","quiz-master-next")),(0,a.createElement)("p",{className:"qsm-description"},(0,n.__)("Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.","quiz-master-next")),(0,a.createElement)("div",{className:"qsm-modal-btn-wrapper"},(0,a.createElement)(c.Button,{variant:"secondary",onClick:()=>Y(!1)},(0,n.__)("Cancel","quiz-master-next")),(0,a.createElement)(c.Button,{variant:"primary",onClick:()=>{}},(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+k},(0,n.__)("Add Question from quiz editor","quiz-master-next")))))),te(M)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+A),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...re},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+P),(0,a.createElement)("p",null,(0,n.__)("Edit question in QSM ","quiz-master-next"),(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+k},(0,n.__)("editor","quiz-master-next"))))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+A),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:M||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||ee||!["15","16","17"].includes(e))ee&&te(e)?Y(!0):f({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[M])?"":qsmBlockData.question_type_description[M]+" "+ie,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),["0","4","1","10","13"].includes(M)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:Z||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>f({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d($)&&"1"==$,onChange:()=>f({required:d($)||"1"!=$?1:0})}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Show Correct Answer Info","quiz-master-next"),checked:J,onChange:()=>K(!J)})),"11"==M&&(0,a.createElement)(c.PanelBody,{title:(0,n.__)("File Settings","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{type:"number",label:qsmBlockData.file_upload_limit.heading,value:null!==(r=G?.file_upload_limit)&&void 0!==r?r:qsmBlockData.file_upload_limit.default,onChange:e=>f({settings:{...G,file_upload_limit:e}})}),(0,a.createElement)("label",{className:"qsm-inspector-label"},qsmBlockData.file_upload_type.heading),Object.keys(qsmBlockData.file_upload_type.options).map((e=>{return(0,a.createElement)(c.CheckboxControl,{key:"filetype-"+e,label:ae[e],checked:(t=e,ne().includes(t)),onChange:()=>(e=>{let t=ne();t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),t=t.join(","),f({settings:{...G,file_upload_type:t}})})(e)});var t}))),(0,a.createElement)(y,{isCategorySelected:e=>H.includes(e),setUnsetCatgory:(e,t)=>{let a=d(H)||0===H.length?d(Q)?[]:[Q]:H;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{le(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=le(e,t);a=[...a,...n]}a=_(a),f({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Hint","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{label:"",value:R,onChange:e=>f({hint:g(e)})})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading,initialOpen:!1},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:O||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>f({commentBox:e}),__nextHasNoMarginBottom:!0})),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(w,{featureImageID:U,onUpdateImage:e=>{f({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{f({featureImageID:void 0,featureImageSrc:void 0})}}))),(0,a.createElement)("div",{...re},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:P,onChange:e=>f({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),b&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here... (optional)","quiz-master-next"),value:p(L),onChange:e=>f({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(M)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),J&&(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:p(F),onChange:e=>f({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(c.Button,{icon:"plus-alt2",onClick:()=>oe(),variant:"secondary",className:"add-new-question-btn"},(0,n.__)("Add New Question","quiz-master-next"))))))},__experimentalLabel(e,{context:t}){const{title:a}=e,n=e?.metadata?.name;if("list-view"===t&&(n||a?.length>0))return n||a}})}(); \ No newline at end of file diff --git a/blocks/build/question/index.js.map b/blocks/build/question/index.js.map deleted file mode 100644 index d24d91dd2..000000000 --- a/blocks/build/question/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"question/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAC8C;AACE;AASjB;AACa;AACqB;AACN;AACgC;AAK1D;AACyB;AACnB;AAEvC,MAAM2B,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG5B,mDAAE,CAAE,gBAAiB,CAAC;AAC1D,MAAM6B,+BAA+B,GAAG7B,mDAAE,CAAE,oBAAqB,CAAC;AAElE,MAAM8B,YAAY,GACjBC,iEAAA,YACG/B,mDAAE,CACH,kEACD,CACE,CACH;AAED,MAAMgC,aAAa,GAAGA,CAAE;EACvBC,cAAc;EACdC,aAAa;EACbC;AACD,CAAC,KAA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;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;ACNsD;AAC5B;AACU;AACkB;AAEtDmW,oEAAiB,CAAEC,6CAAa,EAAE;EACjC7L,IAAI,EAACM,8DAAiB;EACtB;AACD;AACA;EACCwL,IAAI,EAAE5G,6CAAI;EACV6G,mBAAmBA,CAAE1G,UAAU,EAAE;IAAEI;EAAQ,CAAC,EAAG;IAC9C,MAAM;MAAE7L;IAAM,CAAC,GAAGyL,UAAU;IAE5B,MAAM2G,UAAU,GAAG3G,UAAU,EAAEwG,QAAQ,EAAExN,IAAI;IAC7C,MAAM4N,UAAU,GAAGrS,KAAK,EAAEmD,MAAM,GAAG,CAAC;;IAEpC;IACA;IACA,IAAK0I,OAAO,KAAK,WAAW,KAAMuG,UAAU,IAAIC,UAAU,CAAE,EAAG;MAC9D,OAAOD,UAAU,IAAIpS,KAAK;IAC3B;EACD;AACD,CAAE,CAAC,C","sources":["webpack://qsm/./src/component/FeaturedImage.js","webpack://qsm/./src/component/SelectAddCategory.js","webpack://qsm/./src/component/icon.js","webpack://qsm/./src/helper.js","webpack://qsm/./src/question/edit.js","webpack://qsm/external window [\"wp\",\"apiFetch\"]","webpack://qsm/external window [\"wp\",\"blob\"]","webpack://qsm/external window [\"wp\",\"blockEditor\"]","webpack://qsm/external window [\"wp\",\"blocks\"]","webpack://qsm/external window [\"wp\",\"components\"]","webpack://qsm/external window [\"wp\",\"coreData\"]","webpack://qsm/external window [\"wp\",\"data\"]","webpack://qsm/external window [\"wp\",\"element\"]","webpack://qsm/external window [\"wp\",\"hooks\"]","webpack://qsm/external window [\"wp\",\"i18n\"]","webpack://qsm/external window [\"wp\",\"notices\"]","webpack://qsm/webpack/bootstrap","webpack://qsm/webpack/runtime/compat get default export","webpack://qsm/webpack/runtime/define property getters","webpack://qsm/webpack/runtime/hasOwnProperty shorthand","webpack://qsm/webpack/runtime/make namespace object","webpack://qsm/./src/question/index.js"],"sourcesContent":["/**\r\n * WordPress dependencies\r\n */\r\nimport { __, sprintf } from '@wordpress/i18n';\r\nimport { applyFilters } from '@wordpress/hooks';\r\nimport {\r\n\tDropZone,\r\n\tButton,\r\n\tSpinner,\r\n\tResponsiveWrapper,\r\n\twithNotices,\r\n\twithFilters,\r\n\t__experimentalHStack as HStack,\r\n} from '@wordpress/components';\r\nimport { isBlobURL } from '@wordpress/blob';\r\nimport { useState, useRef, useEffect } from '@wordpress/element';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect, select, withDispatch, withSelect } from '@wordpress/data';\r\nimport {\r\n\tMediaUpload,\r\n\tMediaUploadCheck,\r\n\tstore as blockEditorStore,\r\n} from '@wordpress/block-editor';\r\nimport { store as coreStore } from '@wordpress/core-data';\r\nimport { qsmIsEmpty } from '../helper';\r\n\r\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\r\n\r\n// Used when labels from post type were not yet loaded or when they are not present.\r\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\r\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\r\n\r\nconst instructions = (\r\n\t

\r\n\t\t{ __(\r\n\t\t\t'To edit the featured image, you need permission to upload media.'\r\n\t\t) }\r\n\t

\r\n);\r\n\r\nconst FeaturedImage = ( {\r\n\tfeatureImageID,\r\n\tonUpdateImage,\r\n\tonRemoveImage\r\n} ) => {\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\tconst toggleRef = useRef();\r\n\tconst [ isLoading, setIsLoading ] = useState( false );\r\n\tconst [ media, setMedia ] = useState( undefined );\r\n\tconst { mediaFeature, mediaUpload } = useSelect( ( select ) => {\r\n\t\tconst { getMedia } = select( coreStore );\r\n\t\t\treturn {\r\n\t\t\t\tmediaFeature: qsmIsEmpty( media ) && ! qsmIsEmpty( featureImageID ) && getMedia( featureImageID ),\r\n\t\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload \r\n\t\t\t};\r\n\t}, [] );\r\n\r\n\t/**Set media data */\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetQSMAttr = true;\r\n\t\tif ( shouldSetQSMAttr ) {\r\n\t\t\tif ( ! qsmIsEmpty( mediaFeature ) && 'object' === typeof mediaFeature ) {\r\n\t\t\t\tsetMedia({\r\n\t\t\t\t\tid: featureImageID,\r\n\t\t\t\t\twidth: mediaFeature.media_details.width, \r\n\t\t\t\t\theight: mediaFeature.media_details.height, \r\n\t\t\t\t\turl: mediaFeature.source_url,\r\n\t\t\t\t\talt_text: mediaFeature.alt_text,\r\n\t\t\t\t\tslug: mediaFeature.slug\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetQSMAttr = false;\r\n\t\t};\r\n\t\t\r\n\t}, [ mediaFeature ] );\r\n\r\n\tfunction onDropFiles( filesList ) {\r\n\t\tmediaUpload( {\r\n\t\t\tallowedTypes: [ 'image' ],\r\n\t\t\tfilesList,\r\n\t\t\tonFileChange( [ image ] ) {\r\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\r\n\t\t\t\t\tsetIsLoading( true );\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tonUpdateImage( image );\r\n\t\t\t\tsetIsLoading( false );\r\n\t\t\t},\r\n\t\t\tonError( message ) {\r\n\t\t\t\tcreateNotice( 'error', message, {\r\n\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t} );\r\n\t\t\t},\r\n\t\t} );\r\n\t}\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t{ media && (\r\n\t\t\t\t\r\n\t\t\t\t\t{ media.alt_text &&\r\n\t\t\t\t\t\tsprintf(\r\n\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\r\n\t\t\t\t\t\t\t__( 'Current image: %s' ),\r\n\t\t\t\t\t\t\tmedia.alt_text\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t\t{ ! media.alt_text &&\r\n\t\t\t\t\t\tsprintf(\r\n\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\r\n\t\t\t\t\t\t\t__(\r\n\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\r\n\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\tmedia.slug\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t
\r\n\t\t\t) }\r\n\t\t\t\r\n\t\t\t\t { \r\n\t\t\t\t\t\tsetMedia( media );\r\n\t\t\t\t\t\tonUpdateImage( media );\r\n\t\t\t\t\t} }\r\n\t\t\t\t\tunstableFeaturedImageFlow\r\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\r\n\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\r\n\t\t\t\t\trender={ ( { open } ) => (\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t{ !! featureImageID && media && (\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\t\t{ isLoading && }\r\n\t\t\t\t\t\t\t\t{ ! featureImageID &&\r\n\t\t\t\t\t\t\t\t\t! isLoading &&\r\n\t\t\t\t\t\t\t\t\t(\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t{ !! featureImageID && (\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\r\n\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\r\n\t\t\t\t\t\t\t\t\t\t} }\r\n\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t) }\r\n\t\t\t\t\tvalue={ featureImageID }\r\n\t\t\t\t/>\r\n\t\t\t
\r\n\t\t
\r\n\t);\r\n}\r\n\r\nexport default FeaturedImage;","/**\r\n * Select or add a category\r\n */\r\nimport { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tPanelBody,\r\n Button,\r\n TreeSelect,\r\n\tTextControl,\r\n\tToggleControl,\r\n\tRangeControl,\r\n\tRadioControl,\r\n\tSelectControl,\r\n\tCheckboxControl,\r\n Flex,\r\n FlexItem,\r\n} from '@wordpress/components';\r\nimport { qsmIsEmpty, qsmFormData } from '../helper';\r\n\r\nconst SelectAddCategory = ({\r\n isCategorySelected,\r\n setUnsetCatgory\r\n}) => {\r\n\r\n //whether showing add category form\r\n\tconst [ showForm, setShowForm ] = useState( false );\r\n //new category name\r\n const [ formCatName, setFormCatName ] = useState( '' );\r\n //new category prent id\r\n const [ formCatParent, setFormCatParent ] = useState( 0 );\r\n //new category adding start status\r\n const [ addingNewCategory, setAddingNewCategory ] = useState( false );\r\n //error\r\n const [ newCategoryError, setNewCategoryError ] = useState( false );\r\n //category list \r\n const [ categories, setCategories ] = useState( qsmBlockData?.hierarchicalCategoryList );\r\n\r\n //get category id-details object \r\n const getCategoryIdDetailsObject = ( categories ) => {\r\n let catObj = {};\r\n categories.forEach( cat => {\r\n catObj[ cat.id ] = cat;\r\n if ( 0 < cat.children.length ) {\r\n let childCategory = getCategoryIdDetailsObject( cat.children );\r\n catObj = { ...catObj, ...childCategory };\r\n }\r\n });\r\n return catObj;\r\n }\r\n\r\n //category id wise details\r\n const [ categoryIdDetails, setCategoryIdDetails ] = useState( qsmIsEmpty( qsmBlockData?.hierarchicalCategoryList ) ? {} : getCategoryIdDetailsObject( qsmBlockData.hierarchicalCategoryList ) );\r\n\r\n const addNewCategoryLabel = __( 'Add New Category ', 'quiz-master-next' );\r\n const noParentOption = `— ${ __( 'Parent Category ', 'quiz-master-next' ) } —`;\r\n\r\n //Add new category\r\n const onAddCategory = async ( event ) => {\r\n\t\tevent.preventDefault();\r\n\t\tif ( newCategoryError || qsmIsEmpty( formCatName ) || addingNewCategory ) {\r\n\t\t\treturn;\r\n\t\t}\r\n setAddingNewCategory( true );\r\n\r\n //create a page\r\n apiFetch( {\r\n url: qsmBlockData.ajax_url,\r\n method: 'POST',\r\n body: qsmFormData({\r\n 'action': 'save_new_category',\r\n 'name': formCatName,\r\n 'parent': formCatParent \r\n })\r\n } ).then( ( res ) => {\r\n if ( ! qsmIsEmpty( res.term_id ) ) {\r\n let term_id = res.term_id;\r\n //console.log(\"save_new_category\",res);\r\n //set category list\r\n apiFetch( {\r\n path: '/quiz-survey-master/v1/quiz/hierarchical-category-list',\r\n method: 'POST'\r\n } ).then( ( res ) => {\r\n // console.log(\"new categorieslist\", res);\r\n if ( 'success' == res.status ) {\r\n setCategories( res.result );\r\n setCategoryIdDetails( res.result );\r\n //set form\r\n setFormCatName( '' );\r\n setFormCatParent( 0 );\r\n //set category selected\r\n setUnsetCatgory( term_id, getCategoryIdDetailsObject( term.id ) );\r\n setAddingNewCategory( false );\r\n }\r\n });\r\n \r\n }\r\n \r\n });\r\n }\r\n\r\n //get category name array\r\n const getCategoryNameArray = ( categories ) => {\r\n let cats = [];\r\n categories.forEach( cat => {\r\n cats.push( cat.name );\r\n if ( 0 < cat.children.length ) {\r\n let childCategory = getCategoryNameArray( cat.children );\r\n cats = [ ...cats, ...childCategory ];\r\n }\r\n });\r\n return cats;\r\n }\r\n\r\n //check if category name already exists and set new category name\r\n const checkSetNewCategory = ( catName, categories ) => {\r\n categories = getCategoryNameArray( categories );\r\n console.log( \"categories\", categories );\r\n if ( categories.includes( catName ) ) {\r\n setNewCategoryError( catName );\r\n } else {\r\n setNewCategoryError( false );\r\n setFormCatName( catName );\r\n }\r\n // categories.forEach( cat => {\r\n // if ( cat.name == catName ) {\r\n // matchName = true;\r\n // return false;\r\n // } else if ( 0 < cat.children.length ) {\r\n // checkSetNewCategory( catName, cat.children )\r\n // }\r\n // });\r\n \r\n // if ( matchName ) {\r\n // setNewCategoryError( matchName );\r\n // } else {\r\n // setNewCategoryError( matchName );\r\n // setFormCatName( catName );\r\n // }\r\n }\r\n\r\n const renderTerms = ( categories ) => {\r\n\t\treturn categories.map( ( term ) => {\r\n\t\t\treturn (\r\n\t\t\t\t\r\n\t\t\t\t\t setUnsetCatgory( term.id, categoryIdDetails ) }\r\n />\r\n\t\t\t\t\t{ !! term.children.length && (\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t{ renderTerms( term.children ) }\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t) }\r\n\t\t\t\t
\r\n\t\t\t);\r\n\t\t} );\r\n\t};\r\n \r\n return(\r\n \r\n \r\n\t\t\t\t{ renderTerms( categories ) }\r\n\t\t\t
\r\n
\r\n \r\n
\r\n { showForm && (\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t checkSetNewCategory( formCatName, categories ) }\r\n\t\t\t\t\t\t\trequired\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t{ 0 < categories.length && (\r\n\t\t\t\t\t\t\t setFormCatParent( id ) }\r\n\t\t\t\t\t\t\t\tselectedId={ formCatParent }\r\n\t\t\t\t\t\t\t\ttree={ categories }\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t) }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t{ addNewCategoryLabel }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n \r\n

\r\n { false !== newCategoryError && __( 'Category ', 'quiz-master-next' ) + newCategoryError + __( ' already exists.', 'quiz-master-next' ) }\r\n

\r\n
\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t) }\r\n\t\t\r\n );\r\n}\r\n\r\nexport default SelectAddCategory;","import { Icon } from '@wordpress/components';\r\n//QSM Quiz Block\r\nexport const qsmBlockIcon = () => (\r\n\t (\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Question Block\r\nexport const questionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Answer option Block\r\nexport const answerOptionBlockIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);\r\n\r\n//Warning icon\r\nexport const warningIcon = () => (\r\n\t (\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t) }\r\n\t/>\r\n);","//Check if undefined, null, empty\r\nexport const qsmIsEmpty = ( data ) => ( 'undefined' === typeof data || null === data || '' === data );\r\n\r\n//Get Unique array values\r\nexport const qsmUniqueArray = ( arr ) => {\r\n\tif ( qsmIsEmpty( arr ) || ! Array.isArray( arr ) ) {\r\n\t\treturn arr;\r\n\t}\r\n\treturn arr.filter( ( val, index, arr ) => arr.indexOf( val ) === index );\r\n}\r\n\r\n//Match array of object values and return array of cooresponding matching keys \r\nexport const qsmMatchingValueKeyArray = ( values, obj ) => {\r\n\tif ( qsmIsEmpty( obj ) || ! Array.isArray( values ) ) {\r\n\t\treturn values;\r\n\t}\r\n\treturn values.map( ( val ) => Object.keys(obj).find( key => obj[key] == val) );\r\n}\r\n\r\n//Decode htmlspecialchars\r\nexport const qsmDecodeHtml = ( html ) => {\r\n\tvar txt = document.createElement(\"textarea\");\r\n\ttxt.innerHTML = html;\r\n\treturn txt.value;\r\n}\r\n\r\nexport const qsmSanitizeName = ( name ) => {\r\n\tif ( qsmIsEmpty( name ) ) {\r\n\t\tname = '';\r\n\t} else {\r\n\t\tname = name.toLowerCase().replace( / /g, '_' );\r\n\t\tname = name.replace(/\\W/g, '');\r\n\t}\r\n\t\r\n\treturn name;\r\n}\r\n\r\n// Remove anchor tags from text content.\r\nexport const qsmStripTags = ( text ) => {\r\n\tlet div = document.createElement(\"div\");\r\n\tdiv.innerHTML = qsmDecodeHtml( text );\r\n\treturn div.innerText;\r\n}\r\n\r\n//prepare form data\r\nexport const qsmFormData = ( obj = false ) => {\r\n\tlet newData = new FormData();\r\n\t//add to check if api call from editor\r\n\tnewData.append('qsm_block_api_call', '1');\r\n\tif ( false !== obj ) {\r\n\t\tfor ( let k in obj ) {\r\n\t\t\tif ( obj.hasOwnProperty( k ) ) {\r\n\t\t\t newData.append( k, obj[k] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn newData;\r\n}\r\n\r\n//add objecyt to form data\r\nexport const qsmAddObjToFormData = ( formKey, valueObj, data = new FormData() ) => {\r\n\tif ( qsmIsEmpty( formKey ) || qsmIsEmpty( valueObj ) || 'object' !== typeof valueObj ) {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfor (let key in valueObj) {\r\n\t\tif ( valueObj.hasOwnProperty(key) ) {\r\n\t\t\tlet value = valueObj[key];\r\n\t\t\tif ( 'object' === value ) {\r\n\t\t\t\tqsmAddObjToFormData( formKey+'['+key+']', value, data );\r\n\t\t\t} else {\r\n\t\t\t\tdata.append( formKey+'['+key+']', valueObj[key] );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\treturn data;\r\n}\r\n\r\n//Generate random number\r\nexport const qsmGenerateRandomKey = (length) => {\r\n const charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n let key = \"\";\r\n\r\n // Generate random bytes\r\n const values = new Uint8Array(length);\r\n window.crypto.getRandomValues(values);\r\n\r\n for (let i = 0; i < length; i++) {\r\n // Use the random byte to index into the charset\r\n key += charset[values[i] % charset.length];\r\n }\r\n\r\n return key;\r\n}\r\n\r\n//generate uiniq id\r\nexport const qsmUniqid = (prefix = \"\", random = false) => {\r\n const id = qsmGenerateRandomKey(8);\r\n return `${prefix}${id}${random ? `.${ qsmGenerateRandomKey(7) }`:\"\"}`;\r\n};\r\n\r\n//return data if not empty otherwise default value\r\nexport const qsmValueOrDefault = ( data, defaultValue = '' ) => qsmIsEmpty( data ) ? defaultValue :data;","import { __ } from '@wordpress/i18n';\r\nimport { useState, useEffect } from '@wordpress/element';\r\nimport apiFetch from '@wordpress/api-fetch';\r\nimport {\r\n\tInspectorControls,\r\n\tRichText,\r\n\tInnerBlocks,\r\n\tuseBlockProps,\r\n\tstore as blockEditorStore,\r\n\tBlockControls,\r\n} from '@wordpress/block-editor';\r\nimport { store as noticesStore } from '@wordpress/notices';\r\nimport { useDispatch, useSelect, select } from '@wordpress/data';\r\nimport { createBlock } from '@wordpress/blocks';\r\nimport {\r\n\tPanelBody,\r\n\tToggleControl,\r\n\tSelectControl,\r\n\tToolbarGroup, \r\n\tToolbarButton,\r\n\tTextControl,\r\n\tCheckboxControl,\r\n\tFormTokenField,\r\n\tButton,\r\n\tExternalLink,\r\n\tModal\r\n} from '@wordpress/components';\r\nimport FeaturedImage from '../component/FeaturedImage';\r\nimport SelectAddCategory from '../component/SelectAddCategory';\r\nimport { warningIcon } from \"../component/icon\";\r\nimport { qsmIsEmpty, qsmStripTags, qsmFormData, qsmValueOrDefault, qsmDecodeHtml, qsmUniqueArray, qsmMatchingValueKeyArray } from '../helper';\r\n\r\n\r\n//check for duplicate questionID attr\r\nconst isQuestionIDReserved = ( questionIDCheck, clientIdCheck ) => {\r\n const blocksClientIds = select( 'core/block-editor' ).getClientIdsWithDescendants();\r\n return qsmIsEmpty( blocksClientIds ) ? false : blocksClientIds.some( ( blockClientId ) => {\r\n const { questionID } = select( 'core/block-editor' ).getBlockAttributes( blockClientId );\r\n\t\t//different Client Id but same questionID attribute means duplicate\r\n return clientIdCheck !== blockClientId && questionID === questionIDCheck;\r\n } );\r\n};\r\n\r\n/**\r\n * https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md#allowedformats-array\r\n * \r\n */\r\nexport default function Edit( props ) {\r\n\t//check for QSM initialize data\r\n\tif ( 'undefined' === typeof qsmBlockData ) {\r\n\t\treturn null;\r\n\t}\r\n\t\r\n\tconst { className, attributes, setAttributes, isSelected, clientId, context } = props;\r\n\r\n\t/** https://github.com/WordPress/gutenberg/issues/22282 */\r\n\tconst isParentOfSelectedBlock = useSelect( ( select ) => isSelected || select( 'core/block-editor' ).hasSelectedInnerBlock( clientId, true ) );\r\n\r\n\tconst quizID = context['quiz-master-next/quizID'];\r\n\tconst {\r\n\t\tquiz_name,\r\n\t\tpost_id,\r\n\t\trest_nonce\r\n\t} = context['quiz-master-next/quizAttr'];\r\n\tconst pageID = context['quiz-master-next/pageID'];\r\n\tconst { createNotice } = useDispatch( noticesStore );\r\n\r\n\t//Get finstion to find index of blocks\r\n\tconst { \r\n\t\tgetBlockRootClientId, \r\n\t\tgetBlockIndex \r\n\t} = useSelect( blockEditorStore );\r\n\r\n\t//Get funstion to insert block\r\n\tconst {\r\n\t\tinsertBlock\r\n\t} = useDispatch( blockEditorStore );\r\n\r\n\tconst {\r\n\t\tisChanged = false,//use in editor only to detect if any change occur in this block\r\n\t\tquestionID,\r\n\t\ttype,\r\n\t\tdescription,\r\n\t\ttitle,\r\n\t\tcorrectAnswerInfo,\r\n\t\tcommentBox,\r\n\t\tcategory,\r\n\t\tmulticategories=[],\r\n\t\thint,\r\n\t\tfeatureImageID,\r\n\t\tfeatureImageSrc,\r\n\t\tanswers,\r\n\t\tanswerEditor,\r\n\t\tmatchAnswer,\r\n\t\trequired,\r\n\t\tsettings={},\r\n\t} = attributes;\r\n\t\r\n\t//Variable to decide if correct answer info input field should be available \r\n\tconst [ enableCorrectAnsInfo, setEnableCorrectAnsInfo ] = useState( ! qsmIsEmpty( correctAnswerInfo ) );\r\n\t//Advance Question modal\r\n\tconst [ isOpenAdvanceQModal, setIsOpenAdvanceQModal ] = useState( false );\r\n\r\n\tconst proActivated = ( '1' == qsmBlockData.is_pro_activated );\r\n\tconst isAdvanceQuestionType = ( qtype ) => 14 < parseInt( qtype );\r\n\r\n\t//Available file types\r\n\tconst fileTypes = qsmBlockData.file_upload_type.options;\r\n\r\n\t//Get selected file types\r\n\tconst selectedFileTypes = () => {\r\n\t\tlet file_types = settings?.file_upload_type || qsmBlockData.file_upload_type.default;\r\n\t\treturn qsmIsEmpty( file_types ) ? [] : file_types.split(',');\r\n\t}\r\n\r\n\t//Is file type checked\r\n\tconst isCheckedFileType = ( fileType ) => selectedFileTypes().includes( fileType );\r\n\r\n\t//Set file type\r\n\tconst setFileTypes = ( fileType ) => {\r\n\t\tlet file_types = selectedFileTypes();\r\n\t\tif ( file_types.includes( fileType ) ) {\r\n\t\t\tfile_types = file_types.filter( file_type => file_type != fileType );\r\n\t\t} else {\r\n\t\t\tfile_types.push( fileType );\r\n\t\t}\r\n\t\tfile_types = file_types.join(',');\r\n\t\tsetAttributes({\r\n\t\t\tsettings:{\r\n\t\t\t\t...settings,\r\n\t\t\t\tfile_upload_type: file_types\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\t\r\n\t/**Generate question id if not set or in case duplicate questionID ***/\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetID = true;\r\n\t\tif ( shouldSetID ) {\r\n\t\t\r\n\t\t\tif ( qsmIsEmpty( questionID ) || '0' == questionID || ( ! qsmIsEmpty( questionID ) && isQuestionIDReserved( questionID, clientId ) ) ) {\r\n\t\t\t\t\r\n\t\t\t\t//create a question\r\n\t\t\t\tlet newQuestion = qsmFormData( {\r\n\t\t\t\t\t\"id\": null,\r\n\t\t\t\t\t\"rest_nonce\": rest_nonce,\r\n\t\t\t\t\t\"quizID\": quizID,\r\n\t\t\t\t\t\"quiz_name\": quiz_name,\r\n\t\t\t\t\t\"postID\": post_id,\r\n\t\t\t\t\t\"answerEditor\": qsmValueOrDefault( answerEditor, 'text' ),\r\n\t\t\t\t\t\"type\": qsmValueOrDefault( type , '0' ),\r\n\t\t\t\t\t\"name\": qsmDecodeHtml( qsmValueOrDefault( description ) ),\r\n\t\t\t\t\t\"question_title\": qsmValueOrDefault( title ),\r\n\t\t\t\t\t\"answerInfo\": qsmDecodeHtml( qsmValueOrDefault( correctAnswerInfo ) ),\r\n\t\t\t\t\t\"comments\": qsmValueOrDefault( commentBox, '1' ),\r\n\t\t\t\t\t\"hint\": qsmValueOrDefault( hint ),\r\n\t\t\t\t\t\"category\": qsmValueOrDefault( category ),\r\n\t\t\t\t\t\"multicategories\": [],\r\n\t\t\t\t\t\"required\": qsmValueOrDefault( required, 0 ),\r\n\t\t\t\t\t\"answers\": answers,\r\n\t\t\t\t\t\"page\": 0,\r\n\t\t\t\t\t\"featureImageID\": featureImageID,\r\n\t\t\t\t\t\"featureImageSrc\": featureImageSrc,\r\n\t\t\t\t\t\"matchAnswer\": null,\r\n\t\t\t\t} );\r\n\r\n\t\t\t\t//AJAX call\r\n\t\t\t\tapiFetch( {\r\n\t\t\t\t\tpath: '/quiz-survey-master/v1/questions',\r\n\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\tbody: newQuestion\r\n\t\t\t\t} ).then( ( response ) => {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ( 'success' == response.status ) {\r\n\t\t\t\t\t\tlet question_id = response.id;\r\n\t\t\t\t\t\tsetAttributes( { questionID: question_id } );\r\n\t\t\t\t\t}\r\n\t\t\t\t}).catch(\r\n\t\t\t\t\t( error ) => {\r\n\t\t\t\t\t\tconsole.log( 'error',error );\r\n\t\t\t\t\t\tcreateNotice( 'error', error.message, {\r\n\t\t\t\t\t\t\tisDismissible: true,\r\n\t\t\t\t\t\t\ttype: 'snackbar',\r\n\t\t\t\t\t\t} );\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetID = false;\r\n\t\t};\r\n\t\t\r\n\t}, [] );\r\n\r\n\t//detect change in question\r\n\tuseEffect( () => {\r\n\t\tlet shouldSetChanged = true;\r\n\t\tif ( shouldSetChanged && isSelected && false === isChanged ) {\r\n\t\t\t\r\n\t\t\tsetAttributes( { isChanged: true } );\r\n\t\t}\r\n\r\n\t\t//cleanup\r\n\t\treturn () => {\r\n\t\t\tshouldSetChanged = false;\r\n\t\t};\r\n\t}, [\r\n\t\tquestionID,\r\n\t\ttype,\r\n\t\tdescription,\r\n\t\ttitle,\r\n\t\tcorrectAnswerInfo,\r\n\t\tcommentBox,\r\n\t\tcategory,\r\n\t\tmulticategories,\r\n\t\thint,\r\n\t\tfeatureImageID,\r\n\t\tfeatureImageSrc,\r\n\t\tanswers,\r\n\t\tanswerEditor,\r\n\t\tmatchAnswer,\r\n\t\trequired,\r\n\t\tsettings,\r\n\t] )\r\n\r\n\t//add classes\r\n\tconst blockProps = useBlockProps( {\r\n\t\tclassName: isParentOfSelectedBlock ? ' in-editing-mode':'' ,\r\n\t} );\r\n\r\n\tconst QUESTION_TEMPLATE = [\r\n\t\t[\r\n\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t{\r\n\t\t\t\toptionID:'0'\r\n\t\t\t}\r\n\t\t],\r\n\t\t[\r\n\t\t\t'qsm/quiz-answer-option',\r\n\t\t\t{\r\n\t\t\t\toptionID:'1'\r\n\t\t\t}\r\n\t\t]\r\n\r\n\t];\r\n\r\n\t//Get category ancestor\r\n\tconst getCategoryAncestors = ( termId, categories ) => {\r\n\t\tlet parents = [];\r\n\t\tif ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) {\r\n\t\t\ttermId = categories[ termId ]['parent'];\r\n\t\t\tparents.push( termId );\r\n\t\t\tif ( ! qsmIsEmpty( categories[ termId ] ) && '0' != categories[ termId ]['parent'] ) {\r\n\t\t\t\tlet ancestor = getCategoryAncestors( termId, categories );\r\n\t\t\t\tparents = [ ...parents, ...ancestor ];\r\n\t\t\t}\r\n\t\t} \r\n\t\t\r\n\t\treturn qsmUniqueArray( parents );\r\n\t }\r\n\r\n\t//check if a category is selected\r\n\tconst isCategorySelected = ( termId ) => multicategories.includes( termId );\r\n\r\n\t//set or unset category\r\n\tconst setUnsetCatgory = ( termId, categories ) => {\r\n\t\tlet multiCat = ( qsmIsEmpty( multicategories ) || 0 === multicategories.length ) ? ( qsmIsEmpty( category ) ? [] : [ category ] ) : multicategories;\r\n\t\t\r\n\t\t//Case: category unselected\r\n\t\tif ( multiCat.includes( termId ) ) {\r\n\t\t\t//remove category if already set\r\n\t\t\tmultiCat = multiCat.filter( catID => catID != termId );\r\n\t\t\tlet children = [];\r\n\t\t\t//check for if any child is selcted \r\n\t\t\tmultiCat.forEach( childCatID => {\r\n\t\t\t\t//get ancestors of category\r\n\t\t\t\tlet ancestorIds = getCategoryAncestors( childCatID, categories );\r\n\t\t\t\t//given unselected category is an ancestor of selected category\r\n\t\t\t\tif ( ancestorIds.includes( termId ) ) {\r\n\t\t\t\t\t//remove category if already set\r\n\t\t\t\t\tmultiCat = multiCat.filter( catID => catID != childCatID );\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t//add category if not set\r\n\t\t\tmultiCat.push( termId );\r\n\t\t\t//get ancestors of category\r\n\t\t\tlet ancestorIds = getCategoryAncestors( termId, categories );\r\n\t\t\t//select all ancestor\r\n\t\t\tmultiCat = [ ...multiCat, ...ancestorIds ];\r\n\t\t}\r\n\r\n\t\tmultiCat = qsmUniqueArray( multiCat );\r\n\r\n\t\tsetAttributes({ \r\n\t\t\tcategory: '',\r\n\t\t\tmulticategories: [ ...multiCat ]\r\n\t\t});\r\n\t}\r\n\r\n\t//Notes relation to question type\r\n\tconst notes = ['12','7','3','5','14'].includes( type ) ? __( 'Note: Add only correct answer options with their respective points score.', 'quiz-master-next' ) : '';\r\n\r\n\t//set Question type\r\n\tconst setQuestionType = ( qtype ) => {\r\n\t\tif ( ! qsmIsEmpty( MicroModal ) && ! proActivated && ['15', '16', '17'].includes( qtype ) ) {\r\n\t\t\t//Show modal for advance question type\r\n\t\t\tlet modalEl = document.getElementById('modal-advanced-question-type');\r\n\t\t\tif ( ! qsmIsEmpty( modalEl ) ) {\r\n\t\t\t\tMicroModal.show('modal-advanced-question-type');\r\n\t\t\t}\r\n\t\t} else if ( proActivated && isAdvanceQuestionType( qtype ) ) {\r\n\t\t\tsetIsOpenAdvanceQModal( true );\r\n\t\t} else {\r\n\t\t\tsetAttributes( { type: qtype } );\r\n\t\t}\r\n\t}\r\n\r\n\t//insert new Question\r\n\tconst insertNewQuestion = () => {\r\n\t\tif ( qsmIsEmpty( props?.name )) {\r\n\t\t\tconsole.log(\"block name not found\");\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tconst blockToInsert = createBlock( props.name );\r\n\t\r\n\t\tconst selectBlockOnInsert = true;\r\n\t\tinsertBlock(\r\n\t\t\tblockToInsert,\r\n\t\t\tgetBlockIndex( clientId ) + 1,\r\n\t\t\tgetBlockRootClientId( clientId ),\r\n\t\t\tselectBlockOnInsert\r\n\t\t);\r\n\t}\r\n\r\n\t//insert new Question\r\n\tconst insertNewPage = () => {\r\n\t\tconst blockToInsert = createBlock( 'qsm/quiz-page' );\r\n\t\tconst currentPageClientID = getBlockRootClientId( clientId );\r\n\t\tconst newPageIndex = getBlockIndex( currentPageClientID ) + 1;\r\n\t\tconst qsmBlockClientID = getBlockRootClientId( currentPageClientID );\r\n\t\tconst selectBlockOnInsert = true;\r\n\t\tinsertBlock(\r\n\t\t\tblockToInsert,\r\n\t\t\tnewPageIndex,\r\n\t\t\tqsmBlockClientID,\r\n\t\t\tselectBlockOnInsert\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t<>\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t insertNewQuestion() }\r\n\t\t\t\t/>\r\n\t\t\t\t insertNewPage() }\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t\r\n\t{ isOpenAdvanceQModal && (\r\n\t\t\r\n\t\t\t
\r\n\t\t\t\t

\r\n\t\t\t\t\t{ warningIcon() }\r\n\t\t\t\t\t
\r\n\t\t\t\t\t{ __( 'Use QSM editor for Advanced Question', 'quiz-master-next' ) }\r\n\t\t\t\t

\r\n\t\t\t\t

\r\n\t\t\t\t\t{ __( \"Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.\", \"quiz-master-next\" ) }\r\n\t\t\t\t

\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t\r\n\t\t
\r\n\t) }\r\n\t { isAdvanceQuestionType( type ) ? (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\r\n\t\t\t\t\t

{ __( 'Advanced Question Type', 'quiz-master-next' ) }

\r\n\t\t\t\t
\r\n\t\t\t
\t\r\n\t\t\t
\r\n\t\t\t

{ __( 'Advanced Question Type : ', 'quiz-master-next' ) + title }

\r\n\t\t\t

\r\n\t\t\t{ __( 'Edit question in QSM ', 'quiz-master-next' ) }\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t
\r\n\t\t\r\n\t\t):(\r\n\t\t<>\r\n\t\t\r\n\t\t\t\r\n\t\t\t

{ __( 'ID', 'quiz-master-next' )+': '+questionID }

\r\n\t\t\t{ /** Question Type **/ }\r\n\t\t\t\r\n\t\t\t\t\tsetQuestionType( type )\r\n\t\t\t\t}\r\n\t\t\t\thelp={ qsmIsEmpty( qsmBlockData.question_type_description[ type ] ) ? '' : qsmBlockData.question_type_description[ type ]+' '+notes }\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t>\r\n\t\t\t\t{\r\n\t\t\t\t! qsmIsEmpty( qsmBlockData.question_type.options ) && qsmBlockData.question_type.options.map( qtypes => \r\n\t\t\t\t\t(\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tqtypes.types.map( qtype => \r\n\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t)\r\n\t\t\t\t\t)\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t{/**Answer Type */}\r\n\t\t\t{\r\n\t\t\t\t['0','4','1','10','13'].includes( type ) && \r\n\t\t\t\t\r\n\t\t\t\t\t\tsetAttributes( { answerEditor } )\r\n\t\t\t\t\t}\r\n\t\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\t setAttributes( { required : ( ( ! qsmIsEmpty( required ) && '1' == required ) ? 0 : 1 ) } ) }\r\n\t\t\t/>\r\n\t\t\t setEnableCorrectAnsInfo( ! enableCorrectAnsInfo ) }\r\n\t\t\t/>\r\n\t\t\t
\r\n\t\t\t{/**File Upload */}\r\n\t\t\t{ '11' == type && (\r\n\t\t\t\t\r\n\t\t\t\t{/**Upload Limit */}\r\n\t\t\t\t setAttributes( { settings:{\r\n\t\t\t\t\t\t...settings,\r\n\t\t\t\t\t\tfile_upload_limit: limit\r\n\t\t\t\t\t} } ) }\r\n\t\t\t\t/>\r\n\t\t\t\t{/**Allowed File Type */}\r\n\t\t\t\t\r\n\t\t\t\t{\r\n\t\t\t\t\tObject.keys( qsmBlockData.file_upload_type.options ).map( filetype => (\r\n\t\t\t\t\t\t setFileTypes( filetype ) }\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t) )\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t)}\r\n\t\t\t{/**Categories */}\r\n\t\t\t\r\n\t\t\t{/**Hint */}\r\n\t\t\t\r\n\t\t\t setAttributes( { hint: qsmStripTags( hint ) } ) }\r\n\t\t\t/>\r\n\t\t\t\r\n\t\t\t{/**Comment Box */}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\tsetAttributes( { commentBox } )\r\n\t\t\t\t}\r\n\t\t\t\t__nextHasNoMarginBottom\r\n\t\t\t/>\r\n\t\t\t\r\n\t\t\t{/**Feature Image */}\r\n\t\t\t\r\n\t\t\t\t {\r\n\t\t\t\t\tsetAttributes({ \r\n\t\t\t\t\t\tfeatureImageID: mediaDetails.id,\r\n\t\t\t\t\t\tfeatureImageSrc: mediaDetails.url\r\n\t\t\t\t\t});\r\n\t\t\t\t} }\r\n\t\t\t\tonRemoveImage={ ( id ) => {\r\n\t\t\t\t\tsetAttributes({ \r\n\t\t\t\t\t\tfeatureImageID: undefined,\r\n\t\t\t\t\t\tfeatureImageSrc: undefined,\r\n\t\t\t\t\t});\r\n\t\t\t\t} }\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t
\r\n\t\t
\r\n\t\t\t setAttributes( { title: qsmStripTags( title ) } ) }\r\n\t\t\t\tallowedFormats={ [ ] }\r\n\t\t\t\twithoutInteractiveFormatting\r\n\t\t\t\tclassName={ 'qsm-question-title' }\r\n\t\t\t/>\r\n\t\t\t{\r\n\t\t\t\tisParentOfSelectedBlock && \r\n\t\t\t\t<>\r\n\t\t\t\t setAttributes({ description }) }\r\n\t\t\t\t\tclassName={ 'qsm-question-description' }\r\n\t\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t\t/>\r\n\t\t\t\t{\r\n\t\t\t\t\t! ['8','11','6','9'].includes( type ) &&\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t{\r\n\t\t\t\t\tenableCorrectAnsInfo && (\r\n\t\t\t\t\t\t setAttributes({ correctAnswerInfo }) }\r\n\t\t\t\t\t\t\tclassName={ 'qsm-question-correct-answer-info' }\r\n\t\t\t\t\t\t\t__unstableEmbedURLOnPaste\r\n\t\t\t\t\t\t\t__unstableAllowPrefixTransformations\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t)\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t
\r\n\t\t\r\n\t\t)\r\n\t}\r\n\t\r\n\t);\r\n}\r\n","module.exports = window[\"wp\"][\"apiFetch\"];","module.exports = window[\"wp\"][\"blob\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"hooks\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"notices\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { registerBlockType } from '@wordpress/blocks';\r\nimport Edit from './edit';\r\nimport metadata from './block.json';\r\nimport { questionBlockIcon } from \"../component/icon\";\r\n\r\nregisterBlockType( metadata.name, {\r\n\ticon:questionBlockIcon,\r\n\t/**\r\n\t * @see ./edit.js\r\n\t */\r\n\tedit: Edit,\r\n\t__experimentalLabel( attributes, { context } ) {\r\n\t\tconst { title } = attributes;\r\n\r\n\t\tconst customName = attributes?.metadata?.name;\r\n\t\tconst hasContent = title?.length > 0;\r\n\r\n\t\t// In the list view, use the question title as the label.\r\n\t\t// If the title is empty, fall back to the default label.\r\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\r\n\t\t\treturn customName || title;\r\n\t\t}\r\n\t},\r\n} );\r\n"],"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","ResponsiveWrapper","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","useEffect","store","noticesStore","useDispatch","useSelect","select","withDispatch","withSelect","MediaUpload","MediaUploadCheck","blockEditorStore","coreStore","qsmIsEmpty","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","createElement","FeaturedImage","featureImageID","onUpdateImage","onRemoveImage","createNotice","toggleRef","isLoading","setIsLoading","media","setMedia","undefined","mediaFeature","mediaUpload","getMedia","getSettings","shouldSetQSMAttr","id","width","media_details","height","url","source_url","alt_text","slug","onDropFiles","filesList","allowedTypes","onFileChange","image","onError","message","isDismissible","type","className","fallback","title","onSelect","unstableFeaturedImageFlow","modalClass","render","open","ref","onClick","naturalWidth","naturalHeight","isInline","src","alt","current","focus","onFilesDrop","value","apiFetch","PanelBody","TreeSelect","TextControl","ToggleControl","RangeControl","RadioControl","SelectControl","CheckboxControl","Flex","FlexItem","qsmFormData","SelectAddCategory","isCategorySelected","setUnsetCatgory","showForm","setShowForm","formCatName","setFormCatName","formCatParent","setFormCatParent","addingNewCategory","setAddingNewCategory","newCategoryError","setNewCategoryError","categories","setCategories","qsmBlockData","hierarchicalCategoryList","getCategoryIdDetailsObject","catObj","forEach","cat","children","length","childCategory","categoryIdDetails","setCategoryIdDetails","addNewCategoryLabel","noParentOption","onAddCategory","event","preventDefault","ajax_url","method","body","then","res","term_id","path","status","result","term","getCategoryNameArray","cats","push","name","checkSetNewCategory","catName","console","log","includes","renderTerms","map","key","label","checked","onChange","initialOpen","tabIndex","role","variant","onSubmit","direction","gap","__nextHasNoMarginBottom","required","noOptionLabel","selectedId","tree","disabled","Icon","qsmBlockIcon","icon","viewBox","fill","xmlns","rx","d","questionBlockIcon","x","y","answerOptionBlockIcon","warningIcon","stroke","strokeWidth","strokeLinecap","strokeLinejoin","data","qsmUniqueArray","arr","Array","isArray","filter","val","index","indexOf","qsmMatchingValueKeyArray","values","obj","Object","keys","find","qsmDecodeHtml","html","txt","document","innerHTML","qsmSanitizeName","toLowerCase","replace","qsmStripTags","text","div","innerText","newData","FormData","append","k","hasOwnProperty","qsmAddObjToFormData","formKey","valueObj","qsmGenerateRandomKey","charset","Uint8Array","window","crypto","getRandomValues","i","qsmUniqid","prefix","random","qsmValueOrDefault","defaultValue","InspectorControls","RichText","InnerBlocks","useBlockProps","BlockControls","createBlock","ToolbarGroup","ToolbarButton","FormTokenField","ExternalLink","Modal","isQuestionIDReserved","questionIDCheck","clientIdCheck","blocksClientIds","getClientIdsWithDescendants","some","blockClientId","questionID","getBlockAttributes","Edit","props","_settings$file_upload","attributes","setAttributes","isSelected","clientId","context","isParentOfSelectedBlock","hasSelectedInnerBlock","quizID","quiz_name","post_id","rest_nonce","pageID","getBlockRootClientId","getBlockIndex","insertBlock","isChanged","description","correctAnswerInfo","commentBox","category","multicategories","hint","featureImageSrc","answers","answerEditor","matchAnswer","settings","enableCorrectAnsInfo","setEnableCorrectAnsInfo","isOpenAdvanceQModal","setIsOpenAdvanceQModal","proActivated","is_pro_activated","isAdvanceQuestionType","qtype","parseInt","fileTypes","file_upload_type","options","selectedFileTypes","file_types","default","split","isCheckedFileType","fileType","setFileTypes","file_type","join","shouldSetID","newQuestion","response","question_id","catch","error","shouldSetChanged","blockProps","QUESTION_TEMPLATE","optionID","getCategoryAncestors","termId","parents","ancestor","multiCat","catID","childCatID","ancestorIds","notes","setQuestionType","MicroModal","modalEl","getElementById","show","insertNewQuestion","blockToInsert","selectBlockOnInsert","insertNewPage","currentPageClientID","newPageIndex","qsmBlockClientID","Fragment","contentLabel","size","__experimentalHideHeader","href","quiz_settings_url","question_type","help","question_type_description","qtypes","types","file_upload_limit","heading","limit","filetype","mediaDetails","tagName","placeholder","allowedFormats","withoutInteractiveFormatting","__unstableEmbedURLOnPaste","__unstableAllowPrefixTransformations","allowedBlocks","template","registerBlockType","metadata","edit","__experimentalLabel","customName","hasContent"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/build/style-index.css b/blocks/build/style-index.css index 74830d632..8b1378917 100644 --- a/blocks/build/style-index.css +++ b/blocks/build/style-index.css @@ -1,11 +1 @@ -/*!***************************************************************************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! - \***************************************************************************************************************************************************************************************************************************************/ -/** - * The following styles get applied both on the front of your site - * and in the editor. - * - * Replace them with your own styles or remove the file completely. - */ -/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/blocks/build/style-index.css.map b/blocks/build/style-index.css.map deleted file mode 100644 index 69cae5f30..000000000 --- a/blocks/build/style-index.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA,C","sources":["webpack://qsm/./src/style.scss"],"sourcesContent":["/**\r\n * The following styles get applied both on the front of your site\r\n * and in the editor.\r\n *\r\n * Replace them with your own styles or remove the file completely.\r\n */\r\n\r\n// .wp-block-qsm-main-block {\r\n// \tbackground-color: #21759b;\r\n// \tcolor: #fff;\r\n// \tpadding: 2px;\r\n// }\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file From 80ed3c1c4fee405bc4b1b07bf0d04a5045b8329b Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Thu, 21 Mar 2024 11:11:20 +0530 Subject: [PATCH 24/27] On edit highlight question with option to add question --- blocks/build/answer-option/index.asset.php | 2 +- blocks/build/answer-option/index.js | 2 +- blocks/build/index.asset.php | 2 +- blocks/build/index.css | 2 +- blocks/build/index.js | 2 +- blocks/build/page/index.asset.php | 2 +- blocks/build/page/index.js | 2 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 4 ++-- blocks/package-lock.json | 6 +++--- blocks/src/component/icon.js | 9 ++++++++ blocks/src/editor.scss | 11 ++++++++++ blocks/src/question/edit.js | 24 ++++++++++++++-------- 13 files changed, 49 insertions(+), 21 deletions(-) diff --git a/blocks/build/answer-option/index.asset.php b/blocks/build/answer-option/index.asset.php index 2b8a2bc74..330bf9a7f 100644 --- a/blocks/build/answer-option/index.asset.php +++ b/blocks/build/answer-option/index.asset.php @@ -1 +1 @@ - array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => '86bb3e6490c0563af58b'); + array('react', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => '2d3f4bd22446647134b1'); diff --git a/blocks/build/answer-option/index.js b/blocks/build/answer-option/index.js index 2ef84a3af..22268cc8c 100644 --- a/blocks/build/answer-option/index.js +++ b/blocks/build/answer-option/index.js @@ -1 +1 @@ -!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,i=window.wp.htmlEntities,o=window.wp.escapeHtml,a=window.wp.blockEditor,l=window.wp.data,r=window.wp.url,c=window.wp.components,s=window.wp.blob,u=window.React,m=window.wp.primitives,d=(0,u.createElement)(m.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,u.createElement)(m.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),p=window.wp.notices;const w=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},E=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText};var h=function({url:e="",caption:i="",alt:o="",setURLCaption:r}){const u=["image"],[m,g]=(0,t.useState)(null),[E,h]=(0,t.useState)(),{imageDefaultSize:x,mediaUpload:f}=((0,t.useRef)(),(0,l.useSelect)((e=>{const{getSettings:t}=e(a.store),n=t();return{imageDefaultSize:n.imageDefaultSize,mediaUpload:n.mediaUpload}}),[])),{createErrorNotice:_}=(0,l.useDispatch)(p.store);function v(e){_(e,{type:"snackbar"}),r(void 0,void 0),h(void 0)}function q(e){if(!e||!e.url)return void r(void 0,void 0);if((0,s.isBlobURL)(e.url))return void h(e.url);h();let t=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));return n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e.url,n})(e,x);g(t.id),r(t.url,t.caption)}function b(t){t!==e&&r(t,i)}let z=((e,t)=>!e&&(0,s.isBlobURL)(t))(m,e);(0,t.useEffect)((()=>{if(!z)return;const t=(0,s.getBlobByURL)(e);t&&f({filesList:[t],onFileChange:([e])=>{q(e)},allowedTypes:u,onError:e=>{z=!1,v(e)}})}),[]),(0,t.useEffect)((()=>{z?h(e):(0,s.revokeBlobURL)(E)}),[z,e]);const R=((e,t)=>t&&!e&&!(0,s.isBlobURL)(t))(m,e)?e:void 0,L=!!e&&(0,t.createElement)("img",{alt:(0,n.__)("Edit image"),title:(0,n.__)("Edit image"),className:"edit-image-preview",src:e});let B=(0,t.createElement)(t.Fragment,null,(0,t.createElement)("img",{src:E||e,alt:"",className:"qsm-answer-option-image",style:{width:"200",height:"auto"}}),E&&(0,t.createElement)(c.Spinner,null));return(0,t.createElement)("figure",null,w(e)?(0,t.createElement)(a.MediaPlaceholder,{icon:(0,t.createElement)(a.BlockIcon,{icon:d}),onSelect:q,onSelectURL:b,onError:v,accept:"image/*",allowedTypes:u,value:{id:m,src:R},mediaPreview:L,disableMediaButtons:E||e}):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.BlockControls,{group:"other"},(0,t.createElement)(a.MediaReplaceFlow,{mediaId:m,mediaURL:e,allowedTypes:u,accept:"image/*",onSelect:q,onSelectURL:b,onError:v})),(0,t.createElement)("div",null,B)))},x=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(x.u2,{icon:()=>(0,t.createElement)(c.Icon,{icon:()=>(0,t.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("rect",{width:"24",height:"24",rx:"4.21657",fill:"#ADADAD"}),(0,t.createElement)("path",{d:"M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z",fill:"white"}))}),__experimentalLabel(e,{context:t}){const{content:n}=e,i=e?.metadata?.name;if("list-view"===t&&(i||n?.length>0))return i||n},merge(e,t){return{content:(e.content||"")+(t.content||"")}},edit:function(s){if("undefined"==typeof qsmBlockData)return null;const{className:u,attributes:m,setAttributes:d,isSelected:p,clientId:x,context:f,mergeBlocks:_,onReplace:v,onRemove:q}=s,b=(f["quiz-master-next/quizID"],f["quiz-master-next/pageID"],f["quiz-master-next/questionID"],f["quiz-master-next/questionType"]),z=f["quiz-master-next/answerType"],R=f["quiz-master-next/questionChanged"],L="qsm/quiz-answer-option",{optionID:B,content:k,caption:S,points:C,isCorrect:y}=m,{selectBlock:U}=(0,l.useDispatch)(a.store),{updateBlockAttributes:T}=(0,l.useDispatch)(a.store),D=(0,l.useSelect)((e=>{let t=e(a.store).getBlockParentsByBlockName(x,"qsm/quiz-question",!0);return w(t)?"":t[0]}),[x]);(0,t.useEffect)((()=>{let e=!0;return e&&p&&!w(D)&&!1===R&&T(D,{isChanged:!0}),()=>{e=!1}}),[k,S,C,y]),(0,t.useEffect)((()=>{let e=!0;return e&&(w(k)||!(0,r.isURL)(k)||-1===k.indexOf("https://")&&-1===k.indexOf("http://")||!["rich","text"].includes(z)||d({content:"",caption:""})),()=>{e=!1}}),[z]);const I=(0,a.useBlockProps)({className:p?" is-highlighted ":""}),A=["4","10"].includes(b)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.InspectorControls,null,(0,t.createElement)(c.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},"image"===z&&(0,t.createElement)(c.TextControl,{type:"text",label:(0,n.__)("Caption","quiz-master-next"),value:S,onChange:e=>d({caption:(0,o.escapeAttribute)(e)})}),(0,t.createElement)(c.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:C,onChange:e=>d({points:e})}),["0","4","1","10","2"].includes(b)&&(0,t.createElement)(c.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!w(y)&&"1"==y,onChange:()=>d({isCorrect:w(y)||"1"!=y?1:0})}))),(0,t.createElement)("div",{...I},(0,t.createElement)(c.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:A,disabled:!0,readOnly:!0,tabIndex:"-1"}),!["rich","image"].includes(z)&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:E((0,i.decodeEntities)(k)),onChange:e=>d({content:E((0,i.decodeEntities)(e))}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(L,i);return n&&(o.clientId=x),o},onMerge:_,onReplace:v,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}),"rich"===z&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:g((0,i.decodeEntities)(k)),onChange:e=>d({content:e}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(L,i);return n&&(o.clientId=x),o},onMerge:_,onReplace:v,onRemove:q,className:"qsm-question-answer-option",identifier:"text",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),"image"===z&&(0,t.createElement)(h,{url:(0,r.isURL)(k)?k:"",caption:S,setURLCaption:(e,t)=>d({content:(0,r.isURL)(e)?e:"",caption:t})}))))}})}(); \ No newline at end of file +(()=>{"use strict";const e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,i=window.wp.htmlEntities,o=window.wp.escapeHtml,a=window.wp.blockEditor,l=window.wp.data,r=window.wp.url,c=window.wp.components,s=window.wp.blob,u=window.React,m=window.wp.primitives,d=(0,u.createElement)(m.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,u.createElement)(m.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),p=window.wp.notices,w=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},E=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=function({url:e="",caption:i="",alt:o="",setURLCaption:r}){const u=["image"],[m,g]=(0,t.useState)(null),[E,h]=(0,t.useState)(),{imageDefaultSize:x,mediaUpload:f}=((0,t.useRef)(),(0,l.useSelect)((e=>{const{getSettings:t}=e(a.store),n=t();return{imageDefaultSize:n.imageDefaultSize,mediaUpload:n.mediaUpload}}),[])),{createErrorNotice:_}=(0,l.useDispatch)(p.store);function v(e){_(e,{type:"snackbar"}),r(void 0,void 0),h(void 0)}function q(e){if(!e||!e.url)return void r(void 0,void 0);if((0,s.isBlobURL)(e.url))return void h(e.url);h();let t=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));return n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e.url,n})(e,x);g(t.id),r(t.url,t.caption)}function b(t){t!==e&&r(t,i)}let z=((e,t)=>!e&&(0,s.isBlobURL)(t))(m,e);(0,t.useEffect)((()=>{if(!z)return;const t=(0,s.getBlobByURL)(e);t&&f({filesList:[t],onFileChange:([e])=>{q(e)},allowedTypes:u,onError:e=>{z=!1,v(e)}})}),[]),(0,t.useEffect)((()=>{z?h(e):(0,s.revokeBlobURL)(E)}),[z,e]);const R=((e,t)=>t&&!e&&!(0,s.isBlobURL)(t))(m,e)?e:void 0,L=!!e&&(0,t.createElement)("img",{alt:(0,n.__)("Edit image"),title:(0,n.__)("Edit image"),className:"edit-image-preview",src:e});let B=(0,t.createElement)(t.Fragment,null,(0,t.createElement)("img",{src:E||e,alt:"",className:"qsm-answer-option-image",style:{width:"200",height:"auto"}}),E&&(0,t.createElement)(c.Spinner,null));return(0,t.createElement)("figure",null,w(e)?(0,t.createElement)(a.MediaPlaceholder,{icon:(0,t.createElement)(a.BlockIcon,{icon:d}),onSelect:q,onSelectURL:b,onError:v,accept:"image/*",allowedTypes:u,value:{id:m,src:R},mediaPreview:L,disableMediaButtons:E||e}):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.BlockControls,{group:"other"},(0,t.createElement)(a.MediaReplaceFlow,{mediaId:m,mediaURL:e,allowedTypes:u,accept:"image/*",onSelect:q,onSelectURL:b,onError:v})),(0,t.createElement)("div",null,B)))},x=JSON.parse('{"u2":"qsm/quiz-answer-option"}');(0,e.registerBlockType)(x.u2,{icon:()=>(0,t.createElement)(c.Icon,{icon:()=>(0,t.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("rect",{width:"24",height:"24",rx:"4.21657",fill:"#ADADAD"}),(0,t.createElement)("path",{d:"M8.96182 17.2773H7.33619L10.9889 7.12707H12.7583L16.411 17.2773H14.7853L11.9157 8.97077H11.8364L8.96182 17.2773ZM9.23441 13.3025H14.5078V14.5911H9.23441V13.3025Z",fill:"white"}))}),__experimentalLabel(e,{context:t}){const{content:n}=e,i=e?.metadata?.name;if("list-view"===t&&(i||n?.length>0))return i||n},merge:(e,t)=>({content:(e.content||"")+(t.content||"")}),edit:function(s){if("undefined"==typeof qsmBlockData)return null;const{className:u,attributes:m,setAttributes:d,isSelected:p,clientId:x,context:f,mergeBlocks:_,onReplace:v,onRemove:q}=s,b=(f["quiz-master-next/quizID"],f["quiz-master-next/pageID"],f["quiz-master-next/questionID"],f["quiz-master-next/questionType"]),z=f["quiz-master-next/answerType"],R=f["quiz-master-next/questionChanged"],L="qsm/quiz-answer-option",{optionID:B,content:k,caption:S,points:C,isCorrect:y}=m,{selectBlock:U}=(0,l.useDispatch)(a.store),{updateBlockAttributes:T}=(0,l.useDispatch)(a.store),D=(0,l.useSelect)((e=>{let t=e(a.store).getBlockParentsByBlockName(x,"qsm/quiz-question",!0);return w(t)?"":t[0]}),[x]);(0,t.useEffect)((()=>{let e=!0;return e&&p&&!w(D)&&!1===R&&T(D,{isChanged:!0}),()=>{e=!1}}),[k,S,C,y]),(0,t.useEffect)((()=>{let e=!0;return e&&(w(k)||!(0,r.isURL)(k)||-1===k.indexOf("https://")&&-1===k.indexOf("http://")||!["rich","text"].includes(z)||d({content:"",caption:""})),()=>{e=!1}}),[z]);const I=(0,a.useBlockProps)({className:p?" is-highlighted ":""}),A=["4","10"].includes(b)?"checkbox":"radio";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a.InspectorControls,null,(0,t.createElement)(c.PanelBody,{title:(0,n.__)("Settings","quiz-master-next"),initialOpen:!0},"image"===z&&(0,t.createElement)(c.TextControl,{type:"text",label:(0,n.__)("Caption","quiz-master-next"),value:S,onChange:e=>d({caption:(0,o.escapeAttribute)(e)})}),(0,t.createElement)(c.TextControl,{type:"number",label:(0,n.__)("Points","quiz-master-next"),help:(0,n.__)("Answer points","quiz-master-next"),value:C,onChange:e=>d({points:e})}),["0","4","1","10","2"].includes(b)&&(0,t.createElement)(c.ToggleControl,{label:(0,n.__)("Correct","quiz-master-next"),checked:!w(y)&&"1"==y,onChange:()=>d({isCorrect:w(y)||"1"!=y?1:0})}))),(0,t.createElement)("div",{...I},(0,t.createElement)(c.__experimentalHStack,{className:"edit-post-document-actions__title",spacing:1,justify:"left"},(0,t.createElement)("input",{type:A,disabled:!0,readOnly:!0,tabIndex:"-1"}),!["rich","image"].includes(z)&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:E((0,i.decodeEntities)(k)),onChange:e=>d({content:E((0,i.decodeEntities)(e))}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(L,i);return n&&(o.clientId=x),o},onMerge:_,onReplace:v,onRemove:q,allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-answer-option",identifier:"text"}),"rich"===z&&(0,t.createElement)(a.RichText,{tagName:"p",title:(0,n.__)("Answer options","quiz-master-next"),"aria-label":(0,n.__)("Question answer","quiz-master-next"),placeholder:(0,n.__)("Your Answer","quiz-master-next"),value:g((0,i.decodeEntities)(k)),onChange:e=>d({content:e}),onSplit:(t,n)=>{let i;(n||t)&&(i={...m,content:t});const o=(0,e.createBlock)(L,i);return n&&(o.clientId=x),o},onMerge:_,onReplace:v,onRemove:q,className:"qsm-question-answer-option",identifier:"text",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),"image"===z&&(0,t.createElement)(h,{url:(0,r.isURL)(k)?k:"",caption:S,setURLCaption:(e,t)=>d({content:(0,r.isURL)(e)?e:"",caption:t})}))))}})})(); \ No newline at end of file diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 8857aa170..85d88b4c7 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '9c4f482f975570876da5'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => 'fff12f87c4a842c35239'); diff --git a/blocks/build/index.css b/blocks/build/index.css index a877bdc3d..fe6cd3155 100644 --- a/blocks/build/index.css +++ b/blocks/build/index.css @@ -1 +1 @@ -.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.editor-styles-wrapper .qsm-advance-settings{display:flex;flex-direction:column;gap:2rem}.qsm-placeholder-quiz-create-form{width:75%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{color:#666;font-size:1rem}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input:disabled{border-color:inherit}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=checkbox]:disabled,.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=radio]:disabled{opacity:1}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666}.wp-block-qsm-quiz-question .add-new-question-btn{margin-top:2rem}.qsm-advance-q-modal{justify-content:center;max-width:580px;text-align:center}.qsm-advance-q-modal .qsm-title{margin-top:0}.qsm-advance-q-modal .qsm-modal-btn-wrapper{display:flex;gap:1rem;justify-content:center}.qsm-advance-q-modal .qsm-modal-btn-wrapper .components-external-link{color:#fff;text-decoration:none} +.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.editor-styles-wrapper .qsm-advance-settings{display:flex;flex-direction:column;gap:2rem}.qsm-placeholder-quiz-create-form{width:75%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question.is-highlighted{padding:0 1rem}.wp-block-qsm-quiz-question .block-editor-block-list__insertion-point-inserter.qsm-add-new-ques-wrapper{bottom:-10px;left:auto;position:relative;z-index:9}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem;padding-top:.8rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{color:#666;font-size:1rem}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input:disabled{border-color:inherit}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=checkbox]:disabled,.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=radio]:disabled{opacity:1}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666}.wp-block-qsm-quiz-question .add-new-question-btn{margin-top:2rem}.qsm-advance-q-modal{justify-content:center;max-width:580px;text-align:center}.qsm-advance-q-modal .qsm-title{margin-top:0}.qsm-advance-q-modal .qsm-modal-btn-wrapper{display:flex;gap:1rem;justify-content:center}.qsm-advance-q-modal .qsm-modal-btn-wrapper .components-external-link{color:#fff;text-decoration:none} diff --git a/blocks/build/index.js b/blocks/build/index.js index cb9889692..e3a320357 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -!function(){"use strict";var e,t={818:function(e,t,n){var a=window.wp.element,i=window.wp.blocks,s=window.wp.i18n,r=window.wp.apiFetch,o=n.n(r),l=window.wp.htmlEntities,u=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,d=window.wp.components;const q=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},_=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},z=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let a=0;a`${e}${z(8)}${t?`.${z(7)}`:""}`,b=(e,t="")=>q(e)?t:e,w=()=>{};function v({className:e="",quizAttr:t,setAttributes:n,data:i,onChangeFunc:s=w}){var r,o,l,u,c;const m=(()=>{if(i.defaultvalue=i.default,!q(i?.options))switch(i.type){case"checkbox":1===i.options.length&&(i.type="toggle"),i.label=i.options[0].label;break;case"radio":1==i.options.length?(i.label=i.options[0].label,i.type="toggle"):i.type="select"}return i.label=q(i.label)?"":_(i.label),i.help=q(i.help)?"":_(i.help),i})(),{id:p,label:g="",type:h,help:z="",options:f=[],defaultvalue:b}=m;return(0,a.createElement)(a.Fragment,null,"toggle"===h&&(0,a.createElement)(d.ToggleControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>s(q(t[p])||"1"!=t[p]?1:0,p)}),"select"===h&&(0,a.createElement)(d.SelectControl,{label:g,value:null!==(r=t[p])&&void 0!==r?r:b,options:f,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"number"===h&&(0,a.createElement)(d.TextControl,{type:"number",label:g,value:null!==(o=t[p])&&void 0!==o?o:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"text"===h&&(0,a.createElement)(d.TextControl,{type:"text",label:g,value:null!==(l=t[p])&&void 0!==l?l:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"textarea"===h&&(0,a.createElement)(d.TextareaControl,{label:g,value:null!==(u=t[p])&&void 0!==u?u:b,onChange:e=>s(e,p),help:z,__nextHasNoMarginBottom:!0}),"checkbox"===h&&(0,a.createElement)(d.CheckboxControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>s(q(t[p])||"1"!=t[p]?1:0,p)}),"radio"===h&&(0,a.createElement)(d.RadioControl,{label:g,help:z,selected:null!==(c=t[p])&&void 0!==c?c:b,options:f,onChange:e=>s(e,p)}))}const y=()=>(0,a.createElement)(d.Icon,{icon:()=>(0,a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,a.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});var E=window.wp.compose;(0,i.registerBlockType)("qsm/quiz",{icon:y,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:i,isSelected:r,clientId:_}=e,{createNotice:z}=(0,m.useDispatch)(c.store),w=qsmBlockData.globalQuizsetting,{quizID:E,postID:k,quizAttr:x=w}=n,[D,I]=(0,a.useState)(qsmBlockData.QSMQuizList),[C,B]=(0,a.useState)({error:!1,msg:""}),[S,N]=(0,a.useState)(!1),[O,A]=(0,a.useState)(!1),[P,T]=(0,a.useState)(!1),[M,Q]=(0,a.useState)([]),H=qsmBlockData.quizOptions,F=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(u.store);(0,a.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{L()}),100),!q(E)&&0{if(E==t.value)return e=!0,!0})),e?K(E):(i({quizID:void 0}),B({error:!0,msg:(0,s.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const L=()=>{let e=document.getElementById("modal-advanced-question-type");q(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");q(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},K=e=>{!q(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(i({quizID:parseInt(e),postID:n.post_id,quizAttr:{...x,...n}}),!q(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:b(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},R=(e,t)=>{let n=x;n[t]=e,i({quizAttr:{...n}})};(0,a.useEffect)((()=>{if(F){let e=(()=>{let e=j(_);if(q(e))return!1;e=e.innerBlocks;let t={quiz_id:x.quiz_id,post_id:x.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,i=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,s=b(a?.answerEditor,"text"),r=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=b(t?.content);q(a?.answerEditor)||"rich"!==a.answerEditor||(n=g((0,l.decodeEntities)(n)));let i=[n,b(t?.points),b(t?.isCorrect)];"image"!==s||q(t?.caption)||i.push(t?.caption),r.push(i)})),i.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:x.quiz_id,postID:x.post_id,answerEditor:s,type:b(a?.type,"0"),name:g(b(a?.description)),question_title:b(a?.title),answerInfo:g(b(a?.correctAnswerInfo)),comments:b(a?.commentBox,"1"),hint:b(a?.hint),category:b(a?.category),multicategories:b(a?.multicategories,[]),required:b(a?.required,0),answers:r,featureImageID:b(a?.featureImageID),featureImageSrc:b(a?.featureImageSrc),page:n,other_settings:{...b(a?.settings,{}),required:b(a?.required,0)}})})),t.pages.push(i),t.qpages.push({id:a,quizID:x.quiz_id,pagekey:q(e.attributes.pageKey)?f():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:i}),n++}})),t.quiz={quiz_name:x.quiz_name,quiz_id:x.quiz_id,post_id:x.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==x[e]&&null!==x[e]&&(t.quiz[e]=x[e])})),t})();A(!0),e=h({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[F]);const V=(0,u.useBlockProps)(),$=(0,u.useInnerBlocksProps)(V,{template:M,allowedBlocks:["qsm/quiz-page"]});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(u.InspectorControls,null,(0,a.createElement)(d.PanelBody,{title:(0,s.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("label",{className:"qsm-inspector-label"},(0,s.__)("Status","quiz-master-next")+":",(0,a.createElement)("span",{className:"qsm-inspector-label-value"},x.post_status)),(0,a.createElement)(d.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name"),className:"qsm-no-mb"}),(!q(E)||"0"!=E)&&(0,a.createElement)("p",null,(0,a.createElement)(d.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+E+"&tab=options"},(0,s.__)("Advance Quiz Settings","quiz-master-next"))))),q(E)||"0"==E?(0,a.createElement)("div",{...V}," ",(0,a.createElement)(d.Placeholder,{className:"qsm-placeholder-wrapper",icon:y,label:(0,s.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,s.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,a.createElement)(a.Fragment,null,!q(D)&&0K(e),disabled:S,__nextHasNoMarginBottom:!0}),(0,a.createElement)("span",null,(0,s.__)("OR","quiz-master-next")),(0,a.createElement)(d.Button,{variant:"link",onClick:()=>N(!S)},(0,s.__)("Add New","quiz-master-next"))),(q(D)||S)&&(0,a.createElement)(d.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,a.createElement)(d.TextControl,{label:(0,s.__)("Quiz Name *","quiz-master-next"),help:(0,s.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name")}),(0,a.createElement)(d.Button,{variant:"link",onClick:()=>T(!P)},(0,s.__)("Advance options","quiz-master-next")),(0,a.createElement)("div",{className:"qsm-advance-settings"},P&&H.map((e=>(0,a.createElement)(v,{key:"qsm-settings"+e.id,data:e,quizAttr:x,setAttributes:i,onChangeFunc:R})))),(0,a.createElement)(d.Button,{variant:"primary",disabled:O||q(x.quiz_name),onClick:()=>(()=>{if(q(x.quiz_name))return void console.log("empty quiz_name");A(!0);let e=h({quiz_name:x.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===x[t]||null===x[t]?"":e.append(t,x[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(A(!1),"success"==e.status){let t=h({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:0,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=h({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",f()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&K(e.quizID)}))}})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,s.__)("Create Quiz","quiz-master-next"))),C.error&&(0,a.createElement)("p",{className:"qsm-error-text"},C.msg)))," "):(0,a.createElement)("div",{...$}))},save:e=>null});const k=(0,E.createHigherOrderComponent)((e=>t=>{const{name:n,className:i,attributes:s,setAttributes:r,isSelected:o,clientId:l,context:u}=t;return"core/group"!==n?(0,a.createElement)(e,{key:"edit",...t}):(console.log("props",t),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(e,{key:"edit",...t})))}),"withMyPluginControls");wp.hooks.addFilter("editor.BlockEdit","my-plugin/with-inspector-controls",k)}},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,a),s.exports}a.m=t,e=[],a.O=function(t,n,i,s){if(!n){var r=1/0;for(c=0;c=s)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(o=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,i,s]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var i,s,r=n[0],o=n[1],l=n[2],u=0;if(r.some((function(t){return 0!==e[t]}))){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(l)var c=l(a)}for(t&&t(n);u{"use strict";var e,t={818:(e,t,n)=>{const a=window.wp.element,s=window.wp.blocks,i=window.wp.i18n,r=window.wp.apiFetch;var o=n.n(r);const l=window.wp.htmlEntities,u=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,d=window.wp.components,q=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},_=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},z=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let a=0;a`${e}${z(8)}${t?`.${z(7)}`:""}`,w=(e,t="")=>q(e)?t:e,f=()=>{};function v({className:e="",quizAttr:t,setAttributes:n,data:s,onChangeFunc:i=f}){var r,o,l,u,c;const m=(()=>{if(s.defaultvalue=s.default,!q(s?.options))switch(s.type){case"checkbox":1===s.options.length&&(s.type="toggle"),s.label=s.options[0].label;break;case"radio":1==s.options.length?(s.label=s.options[0].label,s.type="toggle"):s.type="select"}return s.label=q(s.label)?"":_(s.label),s.help=q(s.help)?"":_(s.help),s})(),{id:p,label:g="",type:h,help:z="",options:b=[],defaultvalue:w}=m;return(0,a.createElement)(a.Fragment,null,"toggle"===h&&(0,a.createElement)(d.ToggleControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>i(q(t[p])||"1"!=t[p]?1:0,p)}),"select"===h&&(0,a.createElement)(d.SelectControl,{label:g,value:null!==(r=t[p])&&void 0!==r?r:w,options:b,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"number"===h&&(0,a.createElement)(d.TextControl,{type:"number",label:g,value:null!==(o=t[p])&&void 0!==o?o:w,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"text"===h&&(0,a.createElement)(d.TextControl,{type:"text",label:g,value:null!==(l=t[p])&&void 0!==l?l:w,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"textarea"===h&&(0,a.createElement)(d.TextareaControl,{label:g,value:null!==(u=t[p])&&void 0!==u?u:w,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"checkbox"===h&&(0,a.createElement)(d.CheckboxControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>i(q(t[p])||"1"!=t[p]?1:0,p)}),"radio"===h&&(0,a.createElement)(d.RadioControl,{label:g,help:z,selected:null!==(c=t[p])&&void 0!==c?c:w,options:b,onChange:e=>i(e,p)}))}const y=()=>(0,a.createElement)(d.Icon,{icon:()=>(0,a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,a.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))}),E=window.wp.compose;(0,s.registerBlockType)("qsm/quiz",{icon:y,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:s,isSelected:r,clientId:_}=e,{createNotice:z}=(0,m.useDispatch)(c.store),f=qsmBlockData.globalQuizsetting,{quizID:E,postID:k,quizAttr:x=f}=n,[D,I]=(0,a.useState)(qsmBlockData.QSMQuizList),[C,B]=(0,a.useState)({error:!1,msg:""}),[S,N]=(0,a.useState)(!1),[O,A]=(0,a.useState)(!1),[P,T]=(0,a.useState)(!1),[M,Q]=(0,a.useState)([]),H=qsmBlockData.quizOptions,F=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(u.store);(0,a.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{L()}),100),!q(E)&&0{if(E==t.value)return e=!0,!0})),e?K(E):(s({quizID:void 0}),B({error:!0,msg:(0,i.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const L=()=>{let e=document.getElementById("modal-advanced-question-type");q(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");q(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},K=e=>{!q(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(s({quizID:parseInt(e),postID:n.post_id,quizAttr:{...x,...n}}),!q(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:w(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},R=(e,t)=>{let n=x;n[t]=e,s({quizAttr:{...n}})};(0,a.useEffect)((()=>{if(F){let e=(()=>{let e=j(_);if(q(e))return!1;e=e.innerBlocks;let t={quiz_id:x.quiz_id,post_id:x.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,s=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,i=w(a?.answerEditor,"text"),r=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=w(t?.content);q(a?.answerEditor)||"rich"!==a.answerEditor||(n=g((0,l.decodeEntities)(n)));let s=[n,w(t?.points),w(t?.isCorrect)];"image"!==i||q(t?.caption)||s.push(t?.caption),r.push(s)})),s.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:x.quiz_id,postID:x.post_id,answerEditor:i,type:w(a?.type,"0"),name:g(w(a?.description)),question_title:w(a?.title),answerInfo:g(w(a?.correctAnswerInfo)),comments:w(a?.commentBox,"1"),hint:w(a?.hint),category:w(a?.category),multicategories:w(a?.multicategories,[]),required:w(a?.required,0),answers:r,featureImageID:w(a?.featureImageID),featureImageSrc:w(a?.featureImageSrc),page:n,other_settings:{...w(a?.settings,{}),required:w(a?.required,0)}})})),t.pages.push(s),t.qpages.push({id:a,quizID:x.quiz_id,pagekey:q(e.attributes.pageKey)?b():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:x.quiz_name,quiz_id:x.quiz_id,post_id:x.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==x[e]&&null!==x[e]&&(t.quiz[e]=x[e])})),t})();A(!0),e=h({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[F]);const V=(0,u.useBlockProps)(),$=(0,u.useInnerBlocksProps)(V,{template:M,allowedBlocks:["qsm/quiz-page"]});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(u.InspectorControls,null,(0,a.createElement)(d.PanelBody,{title:(0,i.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("label",{className:"qsm-inspector-label"},(0,i.__)("Status","quiz-master-next")+":",(0,a.createElement)("span",{className:"qsm-inspector-label-value"},x.post_status)),(0,a.createElement)(d.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name"),className:"qsm-no-mb"}),(!q(E)||"0"!=E)&&(0,a.createElement)("p",null,(0,a.createElement)(d.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+E+"&tab=options"},(0,i.__)("Advance Quiz Settings","quiz-master-next"))))),q(E)||"0"==E?(0,a.createElement)("div",{...V}," ",(0,a.createElement)(d.Placeholder,{className:"qsm-placeholder-wrapper",icon:y,label:(0,i.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,i.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,a.createElement)(a.Fragment,null,!q(D)&&0K(e),disabled:S,__nextHasNoMarginBottom:!0}),(0,a.createElement)("span",null,(0,i.__)("OR","quiz-master-next")),(0,a.createElement)(d.Button,{variant:"link",onClick:()=>N(!S)},(0,i.__)("Add New","quiz-master-next"))),(q(D)||S)&&(0,a.createElement)(d.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,a.createElement)(d.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name")}),(0,a.createElement)(d.Button,{variant:"link",onClick:()=>T(!P)},(0,i.__)("Advance options","quiz-master-next")),(0,a.createElement)("div",{className:"qsm-advance-settings"},P&&H.map((e=>(0,a.createElement)(v,{key:"qsm-settings"+e.id,data:e,quizAttr:x,setAttributes:s,onChangeFunc:R})))),(0,a.createElement)(d.Button,{variant:"primary",disabled:O||q(x.quiz_name),onClick:()=>(()=>{if(q(x.quiz_name))return void console.log("empty quiz_name");A(!0);let e=h({quiz_name:x.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===x[t]||null===x[t]?"":e.append(t,x[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(A(!1),"success"==e.status){let t=h({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:0,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=h({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",b()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&K(e.quizID)}))}})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,i.__)("Create Quiz","quiz-master-next"))),C.error&&(0,a.createElement)("p",{className:"qsm-error-text"},C.msg)))," "):(0,a.createElement)("div",{...$}))},save:e=>null});const k=(0,E.createHigherOrderComponent)((e=>t=>{const{name:n,className:s,attributes:i,setAttributes:r,isSelected:o,clientId:l,context:u}=t;return"core/group"!==n?(0,a.createElement)(e,{key:"edit",...t}):(console.log("props",t),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(e,{key:"edit",...t})))}),"withMyPluginControls");wp.hooks.addFilter("editor.BlockEdit","my-plugin/with-inspector-controls",k)}},n={};function a(e){var s=n[e];if(void 0!==s)return s.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.m=t,e=[],a.O=(t,n,s,i)=>{if(!n){var r=1/0;for(c=0;c=i)&&Object.keys(a.O).every((e=>a.O[e](n[l])))?n.splice(l--,1):(o=!1,i0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[n,s,i]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={826:0,431:0};a.O.j=t=>0===e[t];var t=(t,n)=>{var s,i,[r,o,l]=n,u=0;if(r.some((t=>0!==e[t]))){for(s in o)a.o(o,s)&&(a.m[s]=o[s]);if(l)var c=l(a)}for(t&&t(n);ua(818)));s=a.O(s)})(); \ No newline at end of file diff --git a/blocks/build/page/index.asset.php b/blocks/build/page/index.asset.php index 5a2b29b90..dbd2ba176 100644 --- a/blocks/build/page/index.asset.php +++ b/blocks/build/page/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'a6a7c8c48015f8b1bc61'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'b938d315c3e97d3c8ae6'); diff --git a/blocks/build/page/index.js b/blocks/build/page/index.js index 035c9ecdf..c89147e59 100644 --- a/blocks/build/page/index.js +++ b/blocks/build/page/index.js @@ -1 +1 @@ -!function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,l=(window.wp.apiFetch,window.wp.blockEditor),a=window.wp.components;const i=e=>null==e||""===e;var o=JSON.parse('{"u2":"qsm/quiz-page"}');(0,e.registerBlockType)(o.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:o,attributes:r,setAttributes:s,isSelected:c,clientId:u,context:m}=e,{pageID:d,pageKey:w,hidePrevBtn:p}=(m["quiz-master-next/quizID"],r),[g,q]=(0,t.useState)(qsmBlockData.globalQuizsetting),B=(0,l.useBlockProps)();return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(l.InspectorControls,null,(0,t.createElement)(a.PanelBody,{title:(0,n.__)("Page settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(a.TextControl,{label:(0,n.__)("Page Name","quiz-master-next"),value:w,onChange:e=>s({pageKey:e})}),(0,t.createElement)(a.ToggleControl,{label:(0,n.__)("Hide Previous Button?","quiz-master-next"),checked:!i(p)&&"1"==p,onChange:()=>s({hidePrevBtn:i(p)||"1"!=p?1:0})}))),(0,t.createElement)("div",{...B},(0,t.createElement)(l.InnerBlocks,{allowedBlocks:["qsm/quiz-question"]})))}})}(); \ No newline at end of file +(()=>{"use strict";const e=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,l=(window.wp.apiFetch,window.wp.blockEditor),i=window.wp.components,o=e=>null==e||""===e,a=JSON.parse('{"u2":"qsm/quiz-page"}');(0,e.registerBlockType)(a.u2,{edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:a,attributes:s,setAttributes:r,isSelected:c,clientId:u,context:m}=e,{pageID:d,pageKey:w,hidePrevBtn:p}=(m["quiz-master-next/quizID"],s),[g,q]=(0,t.useState)(qsmBlockData.globalQuizsetting),B=(0,l.useBlockProps)();return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(l.InspectorControls,null,(0,t.createElement)(i.PanelBody,{title:(0,n.__)("Page settings","quiz-master-next"),initialOpen:!0},(0,t.createElement)(i.TextControl,{label:(0,n.__)("Page Name","quiz-master-next"),value:w,onChange:e=>r({pageKey:e})}),(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Hide Previous Button?","quiz-master-next"),checked:!o(p)&&"1"==p,onChange:()=>r({hidePrevBtn:o(p)||"1"!=p?1:0})}))),(0,t.createElement)("div",{...B},(0,t.createElement)(l.InnerBlocks,{allowedBlocks:["qsm/quiz-question"]})))}})})(); \ No newline at end of file diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php index a9403634f..981f19975 100644 --- a/blocks/build/question/index.asset.php +++ b/blocks/build/question/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'c31cb48245743f813ffb'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '8c84bc3be26cb4988adf'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 31450ef2c..56d1d90ec 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -1,5 +1,5 @@ -!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch,l=e.n(r),i=window.wp.blockEditor,o=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData;const d=e=>null==e||""===e,_=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),p=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=p(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,f=["image"],E=(0,n.__)("Featured image"),x=(0,n.__)("Set featured image"),C=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media."));var w=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:l}=(0,s.useDispatch)(o.store),_=(0,a.useRef)(),[p,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:w,mediaUpload:y}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function b(e){y({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){l("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(w)||"object"!=typeof w||q({id:e,width:w.media_details.width,height:w.media_details.height,url:w.source_url,alt_text:w.alt_text,slug:w.slug})),()=>{t=!1}}),[w]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( +(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.blocks,a=window.wp.element,n=window.wp.i18n,r=window.wp.apiFetch;var l=e.n(r);const i=window.wp.blockEditor,o=window.wp.notices,s=window.wp.data,c=window.wp.components,m=(window.wp.hooks,window.wp.blob),u=window.wp.coreData,d=e=>null==e||""===e,_=e=>d(e)||!Array.isArray(e)?e:e.filter(((e,t,a)=>a.indexOf(e)===t)),p=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},g=e=>{let t=document.createElement("div");return t.innerHTML=p(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let a in e)e.hasOwnProperty(a)&&t.append(a,e[a]);return t},q=(e,t="")=>d(e)?t:e,E=["image"],f=(0,n.__)("Featured image"),w=(0,n.__)("Set featured image"),x=(0,a.createElement)("p",null,(0,n.__)("To edit the featured image, you need permission to upload media.")),C=({featureImageID:e,onUpdateImage:t,onRemoveImage:r})=>{const{createNotice:l}=(0,s.useDispatch)(o.store),_=(0,a.useRef)(),[p,g]=(0,a.useState)(!1),[h,q]=(0,a.useState)(void 0),{mediaFeature:C,mediaUpload:b}=(0,s.useSelect)((t=>{const{getMedia:a}=t(u.store);return{mediaFeature:d(h)&&!d(e)&&a(e),mediaUpload:t(i.store).getSettings().mediaUpload}}),[]);function y(e){b({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,m.isBlobURL)(e?.url)?g(!0):(t(e),g(!1))},onError(e){l("error",e,{isDismissible:!0,type:"snackbar"})}})}return(0,a.useEffect)((()=>{let t=!0;return t&&(d(C)||"object"!=typeof C||q({id:e,width:C.media_details.width,height:C.media_details.height,url:C.source_url,alt_text:C.alt_text,slug:C.slug})),()=>{t=!1}}),[C]),(0,a.createElement)("div",{className:"editor-post-featured-image"},h&&(0,a.createElement)("div",{id:`editor-post-featured-image-${e}-describedby`,className:"hidden"},h.alt_text&&(0,n.sprintf)( // Translators: %s: The selected image alt text. (0,n.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,n.sprintf)( // Translators: %s: The selected image filename. -(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:C},(0,a.createElement)(i.MediaUpload,{title:E,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:f,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&x),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),_.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:b})),value:e})))},y=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[f,E]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),x=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,C)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},v(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},v(f)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},y)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(o)||_||(p(!0),l()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:o,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;l()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(E(e.result),w(e.result),s(""),u(0),t(a,x(term.id)),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:o,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,f),required:!0}),0u(e),selectedId:m,tree:f}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||_},y)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},b=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(b.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){var r;if("undefined"==typeof qsmBlockData)return null;const{className:m,attributes:u,setAttributes:f,isSelected:E,clientId:x,context:C}=e,b=(0,s.useSelect)((e=>E||e("core/block-editor").hasSelectedInnerBlock(x,!0))),k=C["quiz-master-next/quizID"],{quiz_name:v,post_id:B,rest_nonce:z}=C["quiz-master-next/quizAttr"],{createNotice:D}=(C["quiz-master-next/pageID"],(0,s.useDispatch)(o.store)),{getBlockRootClientId:I,getBlockIndex:N}=(0,s.useSelect)(i.store),{insertBlock:S}=(0,s.useDispatch)(i.store),{isChanged:T=!1,questionID:A,type:M,description:L,title:P,correctAnswerInfo:F,commentBox:O,category:Q,multicategories:H=[],hint:R,featureImageID:U,featureImageSrc:j,answers:W,answerEditor:Z,matchAnswer:V,required:$,settings:G={}}=u,[J,K]=(0,a.useState)(!d(F)),[X,Y]=(0,a.useState)(!1),ee="1"==qsmBlockData.is_pro_activated,te=e=>14{let e=G?.file_upload_type||qsmBlockData.file_upload_type.default;return d(e)?[]:e.split(",")};(0,a.useEffect)((()=>{let e=!0;if(e&&(d(A)||"0"==A||!d(A)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(A,x))){let e=h({id:null,rest_nonce:z,quizID:k,quiz_name:v,postID:B,answerEditor:q(Z,"text"),type:q(M,"0"),name:p(q(L)),question_title:q(P),answerInfo:p(q(F)),comments:q(O,"1"),hint:q(R),category:q(Q),multicategories:[],required:q($,0),answers:W,page:0,featureImageID:U,featureImageSrc:j,matchAnswer:null});l()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;f({questionID:t})}})).catch((e=>{console.log("error",e),D("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&E&&!1===T&&f({isChanged:!0}),()=>{e=!1}}),[A,M,L,P,F,O,Q,H,R,U,j,W,Z,V,$,G]);const re=(0,i.useBlockProps)({className:b?" in-editing-mode":""}),le=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=le(e,t);a=[...a,...n]}return _(a)},ie=["12","7","3","5","14"].includes(M)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"",oe=()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);S(a,N(x)+1,I(x),!0)};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>oe()}),(0,a.createElement)(c.ToolbarButton,{icon:"welcome-add-page",label:(0,n.__)("Add New Page","quiz-master-next"),onClick:()=>(()=>{const e=(0,t.createBlock)("qsm/quiz-page"),a=I(x),n=N(a)+1,r=I(a);S(e,n,r,!0)})()}))),X&&(0,a.createElement)(c.Modal,{contentLabel:(0,n.__)("Use QSM Editor for Advanced Question","quiz-master-next"),className:"qsm-advance-q-modal",isDismissible:!1,size:"small",__experimentalHideHeader:!0},(0,a.createElement)("div",{className:"qsm-modal-body"},(0,a.createElement)("h3",{className:"qsm-title"},(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"54",height:"54",viewBox:"0 0 54 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{d:"M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z",stroke:"#B45309",strokeWidth:"1.65929",strokeLinecap:"round",strokeLinejoin:"round"}))}),(0,a.createElement)("br",null),(0,n.__)("Use QSM editor for Advanced Question","quiz-master-next")),(0,a.createElement)("p",{className:"qsm-description"},(0,n.__)("Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.","quiz-master-next")),(0,a.createElement)("div",{className:"qsm-modal-btn-wrapper"},(0,a.createElement)(c.Button,{variant:"secondary",onClick:()=>Y(!1)},(0,n.__)("Cancel","quiz-master-next")),(0,a.createElement)(c.Button,{variant:"primary",onClick:()=>{}},(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+k},(0,n.__)("Add Question from quiz editor","quiz-master-next")))))),te(M)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+A),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...re},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+P),(0,a.createElement)("p",null,(0,n.__)("Edit question in QSM ","quiz-master-next"),(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+k},(0,n.__)("editor","quiz-master-next"))))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+A),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:M||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||ee||!["15","16","17"].includes(e))ee&&te(e)?Y(!0):f({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[M])?"":qsmBlockData.question_type_description[M]+" "+ie,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),["0","4","1","10","13"].includes(M)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:Z||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>f({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d($)&&"1"==$,onChange:()=>f({required:d($)||"1"!=$?1:0})}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Show Correct Answer Info","quiz-master-next"),checked:J,onChange:()=>K(!J)})),"11"==M&&(0,a.createElement)(c.PanelBody,{title:(0,n.__)("File Settings","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{type:"number",label:qsmBlockData.file_upload_limit.heading,value:null!==(r=G?.file_upload_limit)&&void 0!==r?r:qsmBlockData.file_upload_limit.default,onChange:e=>f({settings:{...G,file_upload_limit:e}})}),(0,a.createElement)("label",{className:"qsm-inspector-label"},qsmBlockData.file_upload_type.heading),Object.keys(qsmBlockData.file_upload_type.options).map((e=>{return(0,a.createElement)(c.CheckboxControl,{key:"filetype-"+e,label:ae[e],checked:(t=e,ne().includes(t)),onChange:()=>(e=>{let t=ne();t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),t=t.join(","),f({settings:{...G,file_upload_type:t}})})(e)});var t}))),(0,a.createElement)(y,{isCategorySelected:e=>H.includes(e),setUnsetCatgory:(e,t)=>{let a=d(H)||0===H.length?d(Q)?[]:[Q]:H;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{le(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=le(e,t);a=[...a,...n]}a=_(a),f({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Hint","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{label:"",value:R,onChange:e=>f({hint:g(e)})})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading,initialOpen:!1},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:O||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>f({commentBox:e}),__nextHasNoMarginBottom:!0})),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(w,{featureImageID:U,onUpdateImage:e=>{f({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{f({featureImageID:void 0,featureImageSrc:void 0})}}))),(0,a.createElement)("div",{...re},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:P,onChange:e=>f({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),b&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here... (optional)","quiz-master-next"),value:p(L),onChange:e=>f({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(M)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),J&&(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:p(F),onChange:e=>f({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),(0,a.createElement)(c.Button,{icon:"plus-alt2",onClick:()=>oe(),variant:"secondary",className:"add-new-question-btn"},(0,n.__)("Add New Question","quiz-master-next"))))))},__experimentalLabel(e,{context:t}){const{title:a}=e,n=e?.metadata?.name;if("list-view"===t&&(n||a?.length>0))return n||a}})}(); \ No newline at end of file +(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:f,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:E,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&w),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),_.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:y})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[E,f]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),w=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,x)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},v(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},v(E)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},b)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(o)||_||(p(!0),l()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:o,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;l()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(f(e.result),C(e.result),s(""),u(0),t(a,w(term.id)),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:o,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,E),required:!0}),0u(e),selectedId:m,tree:E}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||_},b)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},y=()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",ariaHidden:"true",focusable:"false"},(0,a.createElement)("path",{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}))}),k=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(k.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){var r;if("undefined"==typeof qsmBlockData)return null;const{className:m,attributes:u,setAttributes:E,isSelected:f,clientId:w,context:x}=e,k=(0,s.useSelect)((e=>f||e("core/block-editor").hasSelectedInnerBlock(w,!0))),v=x["quiz-master-next/quizID"],{quiz_name:B,post_id:z,rest_nonce:D}=x["quiz-master-next/quizAttr"],{createNotice:I}=(x["quiz-master-next/pageID"],(0,s.useDispatch)(o.store)),{getBlockRootClientId:N,getBlockIndex:S}=(0,s.useSelect)(i.store),{insertBlock:T}=(0,s.useDispatch)(i.store),{isChanged:A=!1,questionID:M,type:L,description:P,title:F,correctAnswerInfo:O,commentBox:H,category:Q,multicategories:R=[],hint:U,featureImageID:j,featureImageSrc:V,answers:W,answerEditor:Z,matchAnswer:$,required:G,settings:J={}}=u,[K,X]=(0,a.useState)(!d(O)),[Y,ee]=(0,a.useState)(!1),te="1"==qsmBlockData.is_pro_activated,ae=e=>14{let e=J?.file_upload_type||qsmBlockData.file_upload_type.default;return d(e)?[]:e.split(",")};(0,a.useEffect)((()=>{let e=!0;if(e&&(d(M)||"0"==M||!d(M)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(M,w))){let e=h({id:null,rest_nonce:D,quizID:v,quiz_name:B,postID:z,answerEditor:q(Z,"text"),type:q(L,"0"),name:p(q(P)),question_title:q(F),answerInfo:p(q(O)),comments:q(H,"1"),hint:q(U),category:q(Q),multicategories:[],required:q(G,0),answers:W,page:0,featureImageID:j,featureImageSrc:V,matchAnswer:null});l()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;E({questionID:t})}})).catch((e=>{console.log("error",e),I("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&f&&!1===A&&E({isChanged:!0}),()=>{e=!1}}),[M,L,P,F,O,H,Q,R,U,j,V,W,Z,$,G,J]);const le=(0,i.useBlockProps)({className:k?" in-editing-mode is-highlighted ":""}),ie=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=ie(e,t);a=[...a,...n]}return _(a)},oe=["12","7","3","5","14"].includes(L)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"",se=()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);T(a,S(w)+1,N(w),!0)};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>se()}),(0,a.createElement)(c.ToolbarButton,{icon:"welcome-add-page",label:(0,n.__)("Add New Page","quiz-master-next"),onClick:()=>(()=>{const e=(0,t.createBlock)("qsm/quiz-page"),a=N(w),n=S(a)+1,r=N(a);T(e,n,r,!0)})()}))),Y&&(0,a.createElement)(c.Modal,{contentLabel:(0,n.__)("Use QSM Editor for Advanced Question","quiz-master-next"),className:"qsm-advance-q-modal",isDismissible:!1,size:"small",__experimentalHideHeader:!0},(0,a.createElement)("div",{className:"qsm-modal-body"},(0,a.createElement)("h3",{className:"qsm-title"},(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"54",height:"54",viewBox:"0 0 54 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{d:"M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z",stroke:"#B45309",strokeWidth:"1.65929",strokeLinecap:"round",strokeLinejoin:"round"}))}),(0,a.createElement)("br",null),(0,n.__)("Use QSM editor for Advanced Question","quiz-master-next")),(0,a.createElement)("p",{className:"qsm-description"},(0,n.__)("Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.","quiz-master-next")),(0,a.createElement)("div",{className:"qsm-modal-btn-wrapper"},(0,a.createElement)(c.Button,{variant:"secondary",onClick:()=>ee(!1)},(0,n.__)("Cancel","quiz-master-next")),(0,a.createElement)(c.Button,{variant:"primary",onClick:()=>{}},(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,n.__)("Add Question from quiz editor","quiz-master-next")))))),ae(L)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+M),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...le},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+F),(0,a.createElement)("p",null,(0,n.__)("Edit question in QSM ","quiz-master-next"),(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,n.__)("editor","quiz-master-next"))))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+M),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:L||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||te||!["15","16","17"].includes(e))te&&ae(e)?ee(!0):E({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[L])?"":qsmBlockData.question_type_description[L]+" "+oe,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),["0","4","1","10","13"].includes(L)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:Z||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>E({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d(G)&&"1"==G,onChange:()=>E({required:d(G)||"1"!=G?1:0})}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Show Correct Answer Info","quiz-master-next"),checked:K,onChange:()=>X(!K)})),"11"==L&&(0,a.createElement)(c.PanelBody,{title:(0,n.__)("File Settings","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{type:"number",label:qsmBlockData.file_upload_limit.heading,value:null!==(r=J?.file_upload_limit)&&void 0!==r?r:qsmBlockData.file_upload_limit.default,onChange:e=>E({settings:{...J,file_upload_limit:e}})}),(0,a.createElement)("label",{className:"qsm-inspector-label"},qsmBlockData.file_upload_type.heading),Object.keys(qsmBlockData.file_upload_type.options).map((e=>{return(0,a.createElement)(c.CheckboxControl,{key:"filetype-"+e,label:ne[e],checked:(t=e,re().includes(t)),onChange:()=>(e=>{let t=re();t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),t=t.join(","),E({settings:{...J,file_upload_type:t}})})(e)});var t}))),(0,a.createElement)(b,{isCategorySelected:e=>R.includes(e),setUnsetCatgory:(e,t)=>{let a=d(R)||0===R.length?d(Q)?[]:[Q]:R;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{ie(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=ie(e,t);a=[...a,...n]}a=_(a),E({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Hint","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{label:"",value:U,onChange:e=>E({hint:g(e)})})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading,initialOpen:!1},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:H||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>E({commentBox:e}),__nextHasNoMarginBottom:!0})),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(C,{featureImageID:j,onUpdateImage:e=>{E({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{E({featureImageID:void 0,featureImageSrc:void 0})}}))),(0,a.createElement)("div",{...le},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:F,onChange:e=>E({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),k&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here... (optional)","quiz-master-next"),value:p(P),onChange:e=>E({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(L)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),K&&(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:p(O),onChange:e=>E({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),k&&(0,a.createElement)("div",{className:"block-editor-block-list__insertion-point-inserter qsm-add-new-ques-wrapper"},(0,a.createElement)(c.Button,{icon:y,label:(0,n.__)("Add New Question","quiz-master-next"),tooltipPosition:"bottom",onClick:()=>se(),variant:"secondary",className:"add-new-question-btn block-editor-inserter__toggle"}))))))},__experimentalLabel(e,{context:t}){const{title:a}=e,n=e?.metadata?.name;if("list-view"===t&&(n||a?.length>0))return n||a}})})(); \ No newline at end of file diff --git a/blocks/package-lock.json b/blocks/package-lock.json index 9da18decc..f82d08190 100644 --- a/blocks/package-lock.json +++ b/blocks/package-lock.json @@ -5544,9 +5544,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001534", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001534.tgz", - "integrity": "sha512-vlPVrhsCS7XaSh2VvWluIQEzVhefrUQcEsQWSS5A5V+dM07uv1qHeQzAOTGIMy9i3e9bH15+muvI/UHojVgS/Q==", + "version": "1.0.30001599", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001599.tgz", + "integrity": "sha512-LRAQHZ4yT1+f9LemSMeqdMpMxZcc4RMWdj4tiFe3G8tNkWK+E58g+/tzotb5cU6TbcVJLr4fySiAW7XmxQvZQA==", "dev": true, "funding": [ { diff --git a/blocks/src/component/icon.js b/blocks/src/component/icon.js index 7da1edec6..6f2b2a344 100644 --- a/blocks/src/component/icon.js +++ b/blocks/src/component/icon.js @@ -44,4 +44,13 @@ export const warningIcon = () => ( ) } /> +); + +//plus icon +export const plusIcon = () => ( + ( + + ) } + /> ); \ No newline at end of file diff --git a/blocks/src/editor.scss b/blocks/src/editor.scss index c31081b7b..043c8c95a 100644 --- a/blocks/src/editor.scss +++ b/blocks/src/editor.scss @@ -70,10 +70,21 @@ } .wp-block-qsm-quiz-question { + &.is-highlighted{ + padding: 0 1rem; + } + + .block-editor-block-list__insertion-point-inserter.qsm-add-new-ques-wrapper{ + position: relative; + bottom: -10px; + left: auto; + z-index: 9; + } /*Question Title*/ .qsm-question-title { color: $qsm_wp_primary_color; font-size: 1.38rem; + padding-top: 0.8rem; } /*Question description*/ diff --git a/blocks/src/question/edit.js b/blocks/src/question/edit.js index 7240aad41..79eab2168 100644 --- a/blocks/src/question/edit.js +++ b/blocks/src/question/edit.js @@ -27,7 +27,7 @@ import { } from '@wordpress/components'; import FeaturedImage from '../component/FeaturedImage'; import SelectAddCategory from '../component/SelectAddCategory'; -import { warningIcon } from "../component/icon"; +import { warningIcon, plusIcon } from "../component/icon"; import { qsmIsEmpty, qsmStripTags, qsmFormData, qsmValueOrDefault, qsmDecodeHtml, qsmUniqueArray, qsmMatchingValueKeyArray } from '../helper'; @@ -227,7 +227,7 @@ export default function Edit( props ) { //add classes const blockProps = useBlockProps( { - className: isParentOfSelectedBlock ? ' in-editing-mode':'' , + className: isParentOfSelectedBlock ? ' in-editing-mode is-highlighted ':'' , } ); const QUESTION_TEMPLATE = [ @@ -595,14 +595,22 @@ export default function Edit( props ) { /> ) } - + className='add-new-question-btn block-editor-inserter__toggle' + > + +
+ ) + } + }
From b3d2d8e816808609229aea67ecb9e36938c1fa41 Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Thu, 21 Mar 2024 11:30:57 +0530 Subject: [PATCH 25/27] single function to create quiz in both editor --- php/admin/functions.php | 199 +--------------------------------------- 1 file changed, 1 insertion(+), 198 deletions(-) diff --git a/php/admin/functions.php b/php/admin/functions.php index 0506166fb..f62da50f1 100644 --- a/php/admin/functions.php +++ b/php/admin/functions.php @@ -874,204 +874,7 @@ class="qsm-wizard-step-text">
- quiz_settings->load_setting_fields( 'quiz_options' ); - global $globalQuizsetting; - $quiz_setting_option = array( - 'form_type' => array( - 'option_name' => __( 'Form Type', 'quiz-master-next' ), - 'value' => $globalQuizsetting['form_type'], - 'default' => 0, - 'type' => 'select', - 'options' => array( - array( - 'label' => __( 'Quiz', 'quiz-master-next' ), - 'value' => 0, - ), - array( - 'label' => __( 'Survey', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'Simple Form', 'quiz-master-next' ), - 'value' => 2, - ), - ), - ), - 'system' => array( - 'option_name' => __( 'Grading System', 'quiz-master-next' ), - 'value' => $globalQuizsetting['system'], - 'default' => 0, - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Correct/Incorrect', 'quiz-master-next' ), - 'value' => 0, - ), - array( - 'label' => __( 'Points', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'Both', 'quiz-master-next' ), - 'value' => 3, - ), - ), - 'help' => __( 'Select the system for grading the quiz.', 'quiz-master-next' ), - ), - 'enable_contact_form' => array( - 'option_name' => __( 'Display a contact form before quiz', 'quiz-master-next' ), - 'value' => 0, - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - ), - 'timer_limit' => array( - 'option_name' => __( 'Time Limit (in Minute)', 'quiz-master-next' ), - 'value' => $globalQuizsetting['timer_limit'], - 'type' => 'number', - 'default' => 0, - 'help' => __( 'Leave 0 for no time limit', 'quiz-master-next' ), - ), - 'pagination' => array( - 'option_name' => __( 'Questions Per Page', 'quiz-master-next' ), - 'value' => $globalQuizsetting['pagination'], - 'type' => 'number', - 'default' => 0, - 'help' => __( 'Override the default pagination created on questions tab', 'quiz-master-next' ), - ), - 'enable_pagination_quiz' => array( - 'option_name' => __( 'Show current page number', 'quiz-master-next' ), - 'value' => $globalQuizsetting['enable_pagination_quiz'], - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - ), - 'show_question_featured_image_in_result' => array( - 'option_name' => __( 'Show question featured image in results page', 'quiz-master-next' ), - 'value' => $globalQuizsetting['show_question_featured_image_in_result'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - ), - 'progress_bar' => array( - 'option_name' => __( 'Show progress bar', 'quiz-master-next' ), - 'value' => $globalQuizsetting['enable_pagination_quiz'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - ), - 'require_log_in' => array( - 'option_name' => __( 'Require User Login', 'quiz-master-next' ), - 'value' => $globalQuizsetting['require_log_in'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - 'help' => __( 'Enabling this allows only logged in users to take the quiz', 'quiz-master-next' ), - ), - 'disable_first_page' => array( - 'option_name' => __( 'Disable first page on quiz', 'quiz-master-next' ), - 'value' => $globalQuizsetting['disable_first_page'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 1, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 0, - ), - ), - 'default' => 0, - ), - 'comment_section' => array( - 'option_name' => __( 'Enable Comment box', 'quiz-master-next' ), - 'value' => $globalQuizsetting['comment_section'], - 'type' => 'radio', - 'options' => array( - array( - 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 0, - ), - array( - 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 1, - ), - ), - 'default' => 1, - 'help' => __( 'Allow users to enter their comments after the quiz', 'quiz-master-next' ), - ), - ); - $quiz_setting_option = apply_filters( 'qsm_quiz_wizard_settings_option', $quiz_setting_option ); - if ( $quiz_setting_option ) { - foreach ( $quiz_setting_option as $key => $single_setting ) { - $index = array_search( $key, array_column( $all_settings, 'id' ), true ); - if ( is_int( $index ) && isset( $all_settings[ $index ] ) ) { - $field = $all_settings[ $index ]; - $field['label'] = $single_setting['option_name']; - $field['default'] = $single_setting['value']; - } else { - $field = array( - 'id' => $key, - 'label' => $single_setting['option_name'], - 'type' => isset( $single_setting['type'] ) ? $single_setting['type'] : 'radio', - 'options' => isset( $single_setting['options'] ) ? $single_setting['options'] : array(), - 'default' => $single_setting['value'], - 'help' => isset( $single_setting['help'] ) ? $single_setting['help'] : "", - ); - } - echo '
'; - QSM_Fields::generate_field( $field, $single_setting['value'] ); - echo '
'; - } - } else { - esc_html_e( 'No settings found!', 'quiz-master-next' ); - } - ?> +
From 3a82d7247d232610c9f65a4a7be38c5f9e22d00d Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Thu, 21 Mar 2024 13:54:30 +0530 Subject: [PATCH 26/27] remove bottom space in quiz question --- blocks/build/index.asset.php | 2 +- blocks/build/index.css | 2 +- blocks/src/editor.scss | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index 85d88b4c7..dd8690bdd 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => 'fff12f87c4a842c35239'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '3bec0faae5335384534d'); diff --git a/blocks/build/index.css b/blocks/build/index.css index fe6cd3155..569c1b2ea 100644 --- a/blocks/build/index.css +++ b/blocks/build/index.css @@ -1 +1 @@ -.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.editor-styles-wrapper .qsm-advance-settings{display:flex;flex-direction:column;gap:2rem}.qsm-placeholder-quiz-create-form{width:75%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question.is-highlighted{padding:0 1rem}.wp-block-qsm-quiz-question .block-editor-block-list__insertion-point-inserter.qsm-add-new-ques-wrapper{bottom:-10px;left:auto;position:relative;z-index:9}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem;padding-top:.8rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{color:#666;font-size:1rem}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input:disabled{border-color:inherit}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=checkbox]:disabled,.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=radio]:disabled{opacity:1}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666}.wp-block-qsm-quiz-question .add-new-question-btn{margin-top:2rem}.qsm-advance-q-modal{justify-content:center;max-width:580px;text-align:center}.qsm-advance-q-modal .qsm-title{margin-top:0}.qsm-advance-q-modal .qsm-modal-btn-wrapper{display:flex;gap:1rem;justify-content:center}.qsm-advance-q-modal .qsm-modal-btn-wrapper .components-external-link{color:#fff;text-decoration:none} +.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.editor-styles-wrapper .qsm-advance-settings{display:flex;flex-direction:column;gap:2rem}.qsm-placeholder-quiz-create-form{width:75%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question.is-highlighted{padding:0 1rem}.wp-block-qsm-quiz-question .block-editor-block-list__insertion-point-inserter.qsm-add-new-ques-wrapper{bottom:25px;height:20px;left:auto;position:relative;z-index:9}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem;padding-top:.8rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{color:#666;font-size:1rem}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input:disabled{border-color:inherit}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=checkbox]:disabled,.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=radio]:disabled{opacity:1}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666}.wp-block-qsm-quiz-question .add-new-question-btn{margin-top:2rem}.qsm-advance-q-modal{justify-content:center;max-width:580px;text-align:center}.qsm-advance-q-modal .qsm-title{margin-top:0}.qsm-advance-q-modal .qsm-modal-btn-wrapper{display:flex;gap:1rem;justify-content:center}.qsm-advance-q-modal .qsm-modal-btn-wrapper .components-external-link{color:#fff;text-decoration:none} diff --git a/blocks/src/editor.scss b/blocks/src/editor.scss index 043c8c95a..4f460ebf8 100644 --- a/blocks/src/editor.scss +++ b/blocks/src/editor.scss @@ -76,9 +76,10 @@ .block-editor-block-list__insertion-point-inserter.qsm-add-new-ques-wrapper{ position: relative; - bottom: -10px; + bottom: 25px; left: auto; z-index: 9; + height: 20px; } /*Question Title*/ .qsm-question-title { From 630d13fa384a9bbc6e723c877b79f89867bc6b9a Mon Sep 17 00:00:00 2001 From: randhirexpresstech Date: Tue, 26 Mar 2024 13:32:28 +0530 Subject: [PATCH 27/27] answer block highlight dotted and publish quiz on publish page --- blocks/block.php | 20 ++++++++++++++++++++ blocks/build/block.json | 4 ++++ blocks/build/index.asset.php | 2 +- blocks/build/index.css | 2 +- blocks/build/index.js | 2 +- blocks/build/question/index.asset.php | 2 +- blocks/build/question/index.js | 2 +- blocks/src/block.json | 1 + blocks/src/component/icon.js | 2 +- blocks/src/edit.js | 19 ++++++++++++++++++- blocks/src/editor.scss | 8 ++++++++ blocks/src/index.js | 25 +------------------------ 12 files changed, 58 insertions(+), 31 deletions(-) diff --git a/blocks/block.php b/blocks/block.php index 3bb4c0154..d04d0cf86 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -616,6 +616,26 @@ public function save_quiz( WP_REST_Request $request ) { $mlwQuizMasterNext->quizCreator->edit_quiz_name( $quiz_id, $quiz_name, $post_id ); } } + + //Update status + if ( ! empty( $quiz_id ) && ! empty( $post_id ) ) { + + //Default post status + $post_status = 'publish'; + + //page status which conatin quiz + if ( ! empty( $_POST['post_status'] )) { + $post_status = sanitize_key( wp_unslash( $_POST['post_status'] ) ); + } + + //Update quiz status + if ( 'publish' === $post_status ) { + wp_update_post( array( + 'ID' => $post_id, + 'post_status' => 'publish', + ) ); + } + } //Save Pages if ( ! empty( $_POST['quizData']['pages'] ) ) { diff --git a/blocks/build/block.json b/blocks/build/block.json index 45873767b..372e2ac66 100644 --- a/blocks/build/block.json +++ b/blocks/build/block.json @@ -30,6 +30,10 @@ "quiz-master-next/quizID": "quizID", "quiz-master-next/quizAttr": "quizAttr" }, + "usesContext": [ + "postId", + "postStatus" + ], "example": {}, "supports": { "html": false diff --git a/blocks/build/index.asset.php b/blocks/build/index.asset.php index dd8690bdd..03fa1bfc3 100644 --- a/blocks/build/index.asset.php +++ b/blocks/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '3bec0faae5335384534d'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-notices'), 'version' => '9ae62c1e6dbc6a16c846'); diff --git a/blocks/build/index.css b/blocks/build/index.css index 569c1b2ea..4db4b6899 100644 --- a/blocks/build/index.css +++ b/blocks/build/index.css @@ -1 +1 @@ -.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.editor-styles-wrapper .qsm-advance-settings{display:flex;flex-direction:column;gap:2rem}.qsm-placeholder-quiz-create-form{width:75%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question.is-highlighted{padding:0 1rem}.wp-block-qsm-quiz-question .block-editor-block-list__insertion-point-inserter.qsm-add-new-ques-wrapper{bottom:25px;height:20px;left:auto;position:relative;z-index:9}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem;padding-top:.8rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{color:#666;font-size:1rem}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input:disabled{border-color:inherit}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=checkbox]:disabled,.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=radio]:disabled{opacity:1}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666}.wp-block-qsm-quiz-question .add-new-question-btn{margin-top:2rem}.qsm-advance-q-modal{justify-content:center;max-width:580px;text-align:center}.qsm-advance-q-modal .qsm-title{margin-top:0}.qsm-advance-q-modal .qsm-modal-btn-wrapper{display:flex;gap:1rem;justify-content:center}.qsm-advance-q-modal .qsm-modal-btn-wrapper .components-external-link{color:#fff;text-decoration:none} +.block-editor-block-inspector .qsm-inspector-label{display:inline-block;font-size:11px;font-weight:500;line-height:1.4;margin-bottom:.5rem;padding:0;text-transform:uppercase}.block-editor-block-inspector .qsm-inspector-label .qsm-inspector-label-value{padding-left:.5rem}.block-editor-block-inspector .qsm-inspector-label-value{font-weight:400;text-transform:capitalize}.block-editor-block-inspector .qsm-no-mb{margin-bottom:0}.qsm-placeholder-select-create-quiz{align-items:center;display:flex;gap:1rem;margin-bottom:1rem}.qsm-placeholder-select-create-quiz .components-base-control{max-width:50%}.qsm-ptb-1{padding:1rem 0}.qsm-error-text{color:#fd3e3e}.editor-styles-wrapper .qsm-placeholder-wrapper .components-placeholder__fieldset{flex-direction:column}.editor-styles-wrapper .qsm-advance-settings{display:flex;flex-direction:column;gap:2rem}.qsm-placeholder-quiz-create-form{width:75%}.qsm-placeholder-quiz-create-form .components-button{width:-moz-fit-content;width:fit-content}.wp-block-qsm-quiz-question.is-highlighted{padding:0 1rem}.wp-block-qsm-quiz-question .block-editor-block-list__insertion-point-inserter.qsm-add-new-ques-wrapper{bottom:25px;height:20px;left:auto;position:relative;z-index:9}.wp-block-qsm-quiz-question .qsm-question-title{color:#1f8cbe;font-size:1.38rem;padding-top:.8rem}.wp-block-qsm-quiz-question .qsm-question-correct-answer-info,.wp-block-qsm-quiz-question .qsm-question-description,.wp-block-qsm-quiz-question .qsm-question-hint{color:#666;font-size:1rem}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option{padding-left:.8rem}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option.block-editor-block-list__block.is-highlighted:after{border:2px dotted #c3c5cc;box-shadow:none}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input:disabled{border-color:inherit}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=checkbox]:disabled,.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option input[type=radio]:disabled{opacity:1}.wp-block-qsm-quiz-question .wp-block-qsm-quiz-answer-option .qsm-question-answer-option.rich-text{margin-left:5px}.wp-block-qsm-quiz-question .qsm-question-answer-option{color:#666;font-size:.9rem;margin-left:1rem}.wp-block-qsm-quiz-question.in-editing-mode .qsm-question-title{color:#666}.wp-block-qsm-quiz-question .add-new-question-btn{margin-top:2rem}.qsm-advance-q-modal{justify-content:center;max-width:580px;text-align:center}.qsm-advance-q-modal .qsm-title{margin-top:0}.qsm-advance-q-modal .qsm-modal-btn-wrapper{display:flex;gap:1rem;justify-content:center}.qsm-advance-q-modal .qsm-modal-btn-wrapper .components-external-link{color:#fff;text-decoration:none} diff --git a/blocks/build/index.js b/blocks/build/index.js index e3a320357..ad8727a25 100644 --- a/blocks/build/index.js +++ b/blocks/build/index.js @@ -1 +1 @@ -(()=>{"use strict";var e,t={818:(e,t,n)=>{const a=window.wp.element,s=window.wp.blocks,i=window.wp.i18n,r=window.wp.apiFetch;var o=n.n(r);const l=window.wp.htmlEntities,u=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,d=window.wp.components,q=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},_=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},z=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let a=0;a`${e}${z(8)}${t?`.${z(7)}`:""}`,w=(e,t="")=>q(e)?t:e,f=()=>{};function v({className:e="",quizAttr:t,setAttributes:n,data:s,onChangeFunc:i=f}){var r,o,l,u,c;const m=(()=>{if(s.defaultvalue=s.default,!q(s?.options))switch(s.type){case"checkbox":1===s.options.length&&(s.type="toggle"),s.label=s.options[0].label;break;case"radio":1==s.options.length?(s.label=s.options[0].label,s.type="toggle"):s.type="select"}return s.label=q(s.label)?"":_(s.label),s.help=q(s.help)?"":_(s.help),s})(),{id:p,label:g="",type:h,help:z="",options:b=[],defaultvalue:w}=m;return(0,a.createElement)(a.Fragment,null,"toggle"===h&&(0,a.createElement)(d.ToggleControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>i(q(t[p])||"1"!=t[p]?1:0,p)}),"select"===h&&(0,a.createElement)(d.SelectControl,{label:g,value:null!==(r=t[p])&&void 0!==r?r:w,options:b,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"number"===h&&(0,a.createElement)(d.TextControl,{type:"number",label:g,value:null!==(o=t[p])&&void 0!==o?o:w,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"text"===h&&(0,a.createElement)(d.TextControl,{type:"text",label:g,value:null!==(l=t[p])&&void 0!==l?l:w,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"textarea"===h&&(0,a.createElement)(d.TextareaControl,{label:g,value:null!==(u=t[p])&&void 0!==u?u:w,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"checkbox"===h&&(0,a.createElement)(d.CheckboxControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>i(q(t[p])||"1"!=t[p]?1:0,p)}),"radio"===h&&(0,a.createElement)(d.RadioControl,{label:g,help:z,selected:null!==(c=t[p])&&void 0!==c?c:w,options:b,onChange:e=>i(e,p)}))}const y=()=>(0,a.createElement)(d.Icon,{icon:()=>(0,a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,a.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))}),E=window.wp.compose;(0,s.registerBlockType)("qsm/quiz",{icon:y,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:s,isSelected:r,clientId:_}=e,{createNotice:z}=(0,m.useDispatch)(c.store),f=qsmBlockData.globalQuizsetting,{quizID:E,postID:k,quizAttr:x=f}=n,[D,I]=(0,a.useState)(qsmBlockData.QSMQuizList),[C,B]=(0,a.useState)({error:!1,msg:""}),[S,N]=(0,a.useState)(!1),[O,A]=(0,a.useState)(!1),[P,T]=(0,a.useState)(!1),[M,Q]=(0,a.useState)([]),H=qsmBlockData.quizOptions,F=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),{getBlock:j}=(0,m.useSelect)(u.store);(0,a.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{L()}),100),!q(E)&&0{if(E==t.value)return e=!0,!0})),e?K(E):(s({quizID:void 0}),B({error:!0,msg:(0,i.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const L=()=>{let e=document.getElementById("modal-advanced-question-type");q(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");q(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},K=e=>{!q(e)&&0{if("success"==t.status){B({error:!1,msg:""});let n=t.result;if(s({quizID:parseInt(e),postID:n.post_id,quizAttr:{...x,...n}}),!q(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:w(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),Q(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},R=(e,t)=>{let n=x;n[t]=e,s({quizAttr:{...n}})};(0,a.useEffect)((()=>{if(F){let e=(()=>{let e=j(_);if(q(e))return!1;e=e.innerBlocks;let t={quiz_id:x.quiz_id,post_id:x.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,s=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,i=w(a?.answerEditor,"text"),r=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=w(t?.content);q(a?.answerEditor)||"rich"!==a.answerEditor||(n=g((0,l.decodeEntities)(n)));let s=[n,w(t?.points),w(t?.isCorrect)];"image"!==i||q(t?.caption)||s.push(t?.caption),r.push(s)})),s.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:x.quiz_id,postID:x.post_id,answerEditor:i,type:w(a?.type,"0"),name:g(w(a?.description)),question_title:w(a?.title),answerInfo:g(w(a?.correctAnswerInfo)),comments:w(a?.commentBox,"1"),hint:w(a?.hint),category:w(a?.category),multicategories:w(a?.multicategories,[]),required:w(a?.required,0),answers:r,featureImageID:w(a?.featureImageID),featureImageSrc:w(a?.featureImageSrc),page:n,other_settings:{...w(a?.settings,{}),required:w(a?.required,0)}})})),t.pages.push(s),t.qpages.push({id:a,quizID:x.quiz_id,pagekey:q(e.attributes.pageKey)?b():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:x.quiz_name,quiz_id:x.quiz_id,post_id:x.post_id},P&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==x[e]&&null!==x[e]&&(t.quiz[e]=x[e])})),t})();A(!0),e=h({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[F]);const V=(0,u.useBlockProps)(),$=(0,u.useInnerBlocksProps)(V,{template:M,allowedBlocks:["qsm/quiz-page"]});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(u.InspectorControls,null,(0,a.createElement)(d.PanelBody,{title:(0,i.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("label",{className:"qsm-inspector-label"},(0,i.__)("Status","quiz-master-next")+":",(0,a.createElement)("span",{className:"qsm-inspector-label-value"},x.post_status)),(0,a.createElement)(d.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name"),className:"qsm-no-mb"}),(!q(E)||"0"!=E)&&(0,a.createElement)("p",null,(0,a.createElement)(d.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+E+"&tab=options"},(0,i.__)("Advance Quiz Settings","quiz-master-next"))))),q(E)||"0"==E?(0,a.createElement)("div",{...V}," ",(0,a.createElement)(d.Placeholder,{className:"qsm-placeholder-wrapper",icon:y,label:(0,i.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,i.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,a.createElement)(a.Fragment,null,!q(D)&&0K(e),disabled:S,__nextHasNoMarginBottom:!0}),(0,a.createElement)("span",null,(0,i.__)("OR","quiz-master-next")),(0,a.createElement)(d.Button,{variant:"link",onClick:()=>N(!S)},(0,i.__)("Add New","quiz-master-next"))),(q(D)||S)&&(0,a.createElement)(d.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,a.createElement)(d.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:x?.quiz_name||"",onChange:e=>R(e,"quiz_name")}),(0,a.createElement)(d.Button,{variant:"link",onClick:()=>T(!P)},(0,i.__)("Advance options","quiz-master-next")),(0,a.createElement)("div",{className:"qsm-advance-settings"},P&&H.map((e=>(0,a.createElement)(v,{key:"qsm-settings"+e.id,data:e,quizAttr:x,setAttributes:s,onChangeFunc:R})))),(0,a.createElement)(d.Button,{variant:"primary",disabled:O||q(x.quiz_name),onClick:()=>(()=>{if(q(x.quiz_name))return void console.log("empty quiz_name");A(!0);let e=h({quiz_name:x.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===x[t]||null===x[t]?"":e.append(t,x[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(A(!1),"success"==e.status){let t=h({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:0,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=h({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",b()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&K(e.quizID)}))}})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))}z(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),z("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,i.__)("Create Quiz","quiz-master-next"))),C.error&&(0,a.createElement)("p",{className:"qsm-error-text"},C.msg)))," "):(0,a.createElement)("div",{...$}))},save:e=>null});const k=(0,E.createHigherOrderComponent)((e=>t=>{const{name:n,className:s,attributes:i,setAttributes:r,isSelected:o,clientId:l,context:u}=t;return"core/group"!==n?(0,a.createElement)(e,{key:"edit",...t}):(console.log("props",t),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(e,{key:"edit",...t})))}),"withMyPluginControls");wp.hooks.addFilter("editor.BlockEdit","my-plugin/with-inspector-controls",k)}},n={};function a(e){var s=n[e];if(void 0!==s)return s.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.m=t,e=[],a.O=(t,n,s,i)=>{if(!n){var r=1/0;for(c=0;c=i)&&Object.keys(a.O).every((e=>a.O[e](n[l])))?n.splice(l--,1):(o=!1,i0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[n,s,i]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={826:0,431:0};a.O.j=t=>0===e[t];var t=(t,n)=>{var s,i,[r,o,l]=n,u=0;if(r.some((t=>0!==e[t]))){for(s in o)a.o(o,s)&&(a.m[s]=o[s]);if(l)var c=l(a)}for(t&&t(n);ua(818)));s=a.O(s)})(); \ No newline at end of file +(()=>{"use strict";var e,t={818:(e,t,n)=>{const a=window.wp.blocks,s=window.wp.element,i=window.wp.i18n,r=window.wp.apiFetch;var o=n.n(r);const l=window.wp.htmlEntities,u=window.wp.blockEditor,c=window.wp.notices,m=window.wp.data,p=window.wp.editor,d=window.wp.components,q=e=>null==e||""===e,g=e=>{var t=document.createElement("textarea");return t.innerHTML=e,t.value},_=e=>{let t=document.createElement("div");return t.innerHTML=g(e),t.innerText},h=(e=!1)=>{let t=new FormData;if(t.append("qsm_block_api_call","1"),!1!==e)for(let n in e)e.hasOwnProperty(n)&&t.append(n,e[n]);return t},z=e=>{let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let a=0;a`${e}${z(8)}${t?`.${z(7)}`:""}`,f=(e,t="")=>q(e)?t:e,v=()=>{};function w({className:e="",quizAttr:t,setAttributes:n,data:a,onChangeFunc:i=v}){var r,o,l,u,c;const m=(()=>{if(a.defaultvalue=a.default,!q(a?.options))switch(a.type){case"checkbox":1===a.options.length&&(a.type="toggle"),a.label=a.options[0].label;break;case"radio":1==a.options.length?(a.label=a.options[0].label,a.type="toggle"):a.type="select"}return a.label=q(a.label)?"":_(a.label),a.help=q(a.help)?"":_(a.help),a})(),{id:p,label:g="",type:h,help:z="",options:b=[],defaultvalue:f}=m;return(0,s.createElement)(s.Fragment,null,"toggle"===h&&(0,s.createElement)(d.ToggleControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>i(q(t[p])||"1"!=t[p]?1:0,p)}),"select"===h&&(0,s.createElement)(d.SelectControl,{label:g,value:null!==(r=t[p])&&void 0!==r?r:f,options:b,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"number"===h&&(0,s.createElement)(d.TextControl,{type:"number",label:g,value:null!==(o=t[p])&&void 0!==o?o:f,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"text"===h&&(0,s.createElement)(d.TextControl,{type:"text",label:g,value:null!==(l=t[p])&&void 0!==l?l:f,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"textarea"===h&&(0,s.createElement)(d.TextareaControl,{label:g,value:null!==(u=t[p])&&void 0!==u?u:f,onChange:e=>i(e,p),help:z,__nextHasNoMarginBottom:!0}),"checkbox"===h&&(0,s.createElement)(d.CheckboxControl,{label:g,help:z,checked:!q(t[p])&&"1"==t[p],onChange:()=>i(q(t[p])||"1"!=t[p]?1:0,p)}),"radio"===h&&(0,s.createElement)(d.RadioControl,{label:g,help:z,selected:null!==(c=t[p])&&void 0!==c?c:f,options:b,onChange:e=>i(e,p)}))}const E=()=>(0,s.createElement)(d.Icon,{icon:()=>(0,s.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("rect",{width:"24",height:"24",rx:"3",fill:"black"}),(0,s.createElement)("path",{d:"M17.8146 17.8349C19.3188 16.3426 20.25 14.2793 20.25 12C20.2485 7.44425 16.5267 3.75 11.9348 3.75C7.34282 3.75 3.62109 7.44425 3.62109 12C3.62109 16.5558 7.34282 20.25 11.9348 20.25H18.9988C19.4682 20.25 19.7074 19.7112 19.3813 19.3885L17.8146 17.8334V17.8349ZM11.8753 17.5195C8.72666 17.5195 6.17388 15.0737 6.17388 12.0569C6.17388 9.04022 8.72666 6.59442 11.8753 6.59442C15.024 6.59442 17.5768 9.04022 17.5768 12.0569C17.5768 15.0737 15.024 17.5195 11.8753 17.5195Z",fill:"white"}))});window.wp.compose,(0,a.registerBlockType)("qsm/quiz",{icon:E,edit:function(e){if("undefined"==typeof qsmBlockData)return null;const{className:t,attributes:n,setAttributes:a,isSelected:r,clientId:_,context:z}=e,v=z.postId,{createNotice:y}=(0,m.useDispatch)(c.store),k=qsmBlockData.globalQuizsetting,{quizID:x,postID:D,quizAttr:I=k}=n,[C,B]=(0,s.useState)(qsmBlockData.QSMQuizList),[S,N]=(0,s.useState)({error:!1,msg:""}),[O,A]=(0,s.useState)(!1),[P,T]=(0,s.useState)(!1),[M,Q]=(0,s.useState)(!1),[H,F]=(0,s.useState)([]),j=qsmBlockData.quizOptions,L=(0,m.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:n}=e(p.store);return n()&&!t()}),[]),K=(0,m.useSelect)((e=>e("core/editor")),[]),{getBlock:R}=(0,m.useSelect)(u.store);(0,s.useEffect)((()=>{let e=!0;if(e&&("0"==qsmBlockData.is_pro_activated&&setTimeout((()=>{V()}),100),!q(x)&&0{if(x==t.value)return e=!0,!0})),e?$(x):(a({quizID:void 0}),N({error:!0,msg:(0,i.__)("Quiz not found. Please select an existing quiz or create a new one.","quiz-master-next")}))}return()=>{e=!1}}),[]);const V=()=>{let e=document.getElementById("modal-advanced-question-type");q(e)&&o()({path:"/quiz-survey-master/v1/quiz/advance-ques-type-upgrade-popup",method:"POST"}).then((e=>{let t=document.getElementById("wpbody-content");q(t)||"success"!=e.status||t.insertAdjacentHTML("afterbegin",e.result)})).catch((e=>{console.log("error",e)}))},$=e=>{!q(e)&&0{if("success"==t.status){N({error:!1,msg:""});let n=t.result;if(a({quizID:parseInt(e),postID:n.post_id,quizAttr:{...I,...n}}),!q(n.qpages)){let e=[];n.qpages.forEach((t=>{let n=[];q(t.question_arr)||t.question_arr.forEach((e=>{if(!q(e)){let t=[];!q(e.answers)&&0{t.push(["qsm/quiz-answer-option",{optionID:n,content:e[0],points:e[1],isCorrect:e[2],caption:f(e[3])}])})),n.push(["qsm/quiz-question",{questionID:e.question_id,type:e.question_type_new,answerEditor:e.settings.answerEditor,title:e.settings.question_title,description:e.question_name,required:e.settings.required,hint:e.hints,answers:e.answers,correctAnswerInfo:e.question_answer_info,category:e.category,multicategories:e.multicategories,commentBox:e.comments,matchAnswer:e.settings.matchAnswer,featureImageID:e.settings.featureImageID,featureImageSrc:e.settings.featureImageSrc,settings:e.settings},t])}})),e.push(["qsm/quiz-page",{pageID:t.id,pageKey:t.pagekey,hidePrevBtn:t.hide_prevbtn,quizID:t.quizID},n])})),F(e)}}else console.log("error "+t.msg)})).catch((e=>{console.log("error",e)}))},Z=(e,t)=>{let n=I;n[t]=e,a({quizAttr:{...n}})};(0,s.useEffect)((()=>{if(L){let e=(()=>{let e=R(_);if(q(e))return!1;e=e.innerBlocks;let t={quiz_id:I.quiz_id,post_id:I.post_id,quiz:{},pages:[],qpages:[],questions:[]},n=0;return e.forEach((e=>{if("qsm/quiz-page"===e.name){let a=e.attributes.pageID,s=[];!q(e.innerBlocks)&&0{if("qsm/quiz-question"!==e.name)return!0;let a=e.attributes,i=f(a?.answerEditor,"text"),r=[];!q(e.innerBlocks)&&0{if("qsm/quiz-answer-option"!==e.name)return!0;let t=e.attributes,n=f(t?.content);q(a?.answerEditor)||"rich"!==a.answerEditor||(n=g((0,l.decodeEntities)(n)));let s=[n,f(t?.points),f(t?.isCorrect)];"image"!==i||q(t?.caption)||s.push(t?.caption),r.push(s)})),s.push(a.questionID),a.isChanged&&t.questions.push({id:a.questionID,quizID:I.quiz_id,postID:I.post_id,answerEditor:i,type:f(a?.type,"0"),name:g(f(a?.description)),question_title:f(a?.title),answerInfo:g(f(a?.correctAnswerInfo)),comments:f(a?.commentBox,"1"),hint:f(a?.hint),category:f(a?.category),multicategories:f(a?.multicategories,[]),required:f(a?.required,0),answers:r,featureImageID:f(a?.featureImageID),featureImageSrc:f(a?.featureImageSrc),page:n,other_settings:{...f(a?.settings,{}),required:f(a?.required,0)}})})),t.pages.push(s),t.qpages.push({id:a,quizID:I.quiz_id,pagekey:q(e.attributes.pageKey)?b():e.attributes.pageKey,hide_prevbtn:e.attributes.hidePrevBtn,questions:s}),n++}})),t.quiz={quiz_name:I.quiz_name,quiz_id:I.quiz_id,post_id:I.post_id},M&&["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((e=>{void 0!==I[e]&&null!==I[e]&&(t.quiz[e]=I[e])})),t})();T(!0);let t="publish";q(K)||(t=K.getEditedPostAttribute("status")),q(t)&&(t="publish"),e=h({save_entire_quiz:"1",quizData:JSON.stringify(e),qsm_block_quiz_nonce:qsmBlockData.nonce,page_post_id:q(v)?0:v,post_status:t,nonce:qsmBlockData.saveNonce}),o()({path:"/quiz-survey-master/v1/quiz/save_quiz",method:"POST",body:e}).then((e=>{y(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),y("error",e.message,{isDismissible:!0,type:"snackbar"})}))}}),[L]);const J=(0,u.useBlockProps)(),U=(0,u.useInnerBlocksProps)(J,{template:H,allowedBlocks:["qsm/quiz-page"]});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.InspectorControls,null,(0,s.createElement)(d.PanelBody,{title:(0,i.__)("Quiz settings","quiz-master-next"),initialOpen:!0},(0,s.createElement)("label",{className:"qsm-inspector-label"},(0,i.__)("Status","quiz-master-next")+":",(0,s.createElement)("span",{className:"qsm-inspector-label-value"},I.post_status)),(0,s.createElement)(d.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:I?.quiz_name||"",onChange:e=>Z(e,"quiz_name"),className:"qsm-no-mb"}),(!q(x)||"0"!=x)&&(0,s.createElement)("p",null,(0,s.createElement)(d.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+x+"&tab=options"},(0,i.__)("Advance Quiz Settings","quiz-master-next"))))),q(x)||"0"==x?(0,s.createElement)("div",{...J}," ",(0,s.createElement)(d.Placeholder,{className:"qsm-placeholder-wrapper",icon:E,label:(0,i.__)("Quiz And Survey Master","quiz-master-next"),instructions:(0,i.__)("Easily and quickly add quizzes and surveys inside the block editor.","quiz-master-next")},(0,s.createElement)(s.Fragment,null,!q(C)&&0$(e),disabled:O,__nextHasNoMarginBottom:!0}),(0,s.createElement)("span",null,(0,i.__)("OR","quiz-master-next")),(0,s.createElement)(d.Button,{variant:"link",onClick:()=>A(!O)},(0,i.__)("Add New","quiz-master-next"))),(q(C)||O)&&(0,s.createElement)(d.__experimentalVStack,{spacing:"3",className:"qsm-placeholder-quiz-create-form"},(0,s.createElement)(d.TextControl,{label:(0,i.__)("Quiz Name *","quiz-master-next"),help:(0,i.__)("Enter a name for this Quiz","quiz-master-next"),value:I?.quiz_name||"",onChange:e=>Z(e,"quiz_name")}),(0,s.createElement)(d.Button,{variant:"link",onClick:()=>Q(!M)},(0,i.__)("Advance options","quiz-master-next")),(0,s.createElement)("div",{className:"qsm-advance-settings"},M&&j.map((e=>(0,s.createElement)(w,{key:"qsm-settings"+e.id,data:e,quizAttr:I,setAttributes:a,onChangeFunc:Z})))),(0,s.createElement)(d.Button,{variant:"primary",disabled:P||q(I.quiz_name),onClick:()=>(()=>{if(q(I.quiz_name))return void console.log("empty quiz_name");T(!0);let e=h({quiz_name:I.quiz_name,qsm_new_quiz_nonce:qsmBlockData.qsm_new_quiz_nonce});["form_type","system","timer_limit","pagination","enable_contact_form","enable_pagination_quiz","show_question_featured_image_in_result","progress_bar","require_log_in","disable_first_page","comment_section"].forEach((t=>void 0===I[t]||null===I[t]?"":e.append(t,I[t]))),o()({path:"/quiz-survey-master/v1/quiz/create_quiz",method:"POST",body:e}).then((e=>{if(T(!1),"success"==e.status){let t=h({id:null,quizID:e.quizID,answerEditor:"text",type:"0",name:"",question_title:"",answerInfo:"",comments:"1",hint:"",category:"",required:0,answers:[],page:0});o()({path:"/quiz-survey-master/v1/questions",method:"POST",body:t}).then((t=>{if("success"==t.status){let n=t.id,a=h({action:qsmBlockData.save_pages_action,quiz_id:e.quizID,nonce:qsmBlockData.saveNonce,post_id:e.quizPostID});a.append("pages[0][]",n),a.append("qpages[0][id]",1),a.append("qpages[0][quizID]",e.quizID),a.append("qpages[0][pagekey]",b()),a.append("qpages[0][hide_prevbtn]",0),a.append("qpages[0][questions][]",n),o()({url:qsmBlockData.ajax_url,method:"POST",body:a}).then((t=>{"success"==t.status&&$(e.quizID)}))}})).catch((e=>{console.log("error",e),y("error",e.message,{isDismissible:!0,type:"snackbar"})}))}y(e.status,e.msg,{isDismissible:!0,type:"snackbar"})})).catch((e=>{console.log("error",e),y("error",e.message,{isDismissible:!0,type:"snackbar"})}))})()},(0,i.__)("Create Quiz","quiz-master-next"))),S.error&&(0,s.createElement)("p",{className:"qsm-error-text"},S.msg)))," "):(0,s.createElement)("div",{...U}))},save:e=>null})}},n={};function a(e){var s=n[e];if(void 0!==s)return s.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.m=t,e=[],a.O=(t,n,s,i)=>{if(!n){var r=1/0;for(c=0;c=i)&&Object.keys(a.O).every((e=>a.O[e](n[l])))?n.splice(l--,1):(o=!1,i0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[n,s,i]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={826:0,431:0};a.O.j=t=>0===e[t];var t=(t,n)=>{var s,i,[r,o,l]=n,u=0;if(r.some((t=>0!==e[t]))){for(s in o)a.o(o,s)&&(a.m[s]=o[s]);if(l)var c=l(a)}for(t&&t(n);ua(818)));s=a.O(s)})(); \ No newline at end of file diff --git a/blocks/build/question/index.asset.php b/blocks/build/question/index.asset.php index 981f19975..3697cd262 100644 --- a/blocks/build/question/index.asset.php +++ b/blocks/build/question/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '8c84bc3be26cb4988adf'); + array('wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '45906d9cb21e070d8451'); diff --git a/blocks/build/question/index.js b/blocks/build/question/index.js index 56d1d90ec..7503ac0b7 100644 --- a/blocks/build/question/index.js +++ b/blocks/build/question/index.js @@ -2,4 +2,4 @@ // Translators: %s: The selected image alt text. (0,n.__)("Current image: %s"),h.alt_text),!h.alt_text&&(0,n.sprintf)( // Translators: %s: The selected image filename. -(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:f,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:E,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&w),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),_.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:y})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[E,f]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),w=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,x)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},v(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},v(E)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},b)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(o)||_||(p(!0),l()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:o,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;l()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(f(e.result),C(e.result),s(""),u(0),t(a,w(term.id)),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:o,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,E),required:!0}),0u(e),selectedId:m,tree:E}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||_},b)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},y=()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",ariaHidden:"true",focusable:"false"},(0,a.createElement)("path",{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}))}),k=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(k.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){var r;if("undefined"==typeof qsmBlockData)return null;const{className:m,attributes:u,setAttributes:E,isSelected:f,clientId:w,context:x}=e,k=(0,s.useSelect)((e=>f||e("core/block-editor").hasSelectedInnerBlock(w,!0))),v=x["quiz-master-next/quizID"],{quiz_name:B,post_id:z,rest_nonce:D}=x["quiz-master-next/quizAttr"],{createNotice:I}=(x["quiz-master-next/pageID"],(0,s.useDispatch)(o.store)),{getBlockRootClientId:N,getBlockIndex:S}=(0,s.useSelect)(i.store),{insertBlock:T}=(0,s.useDispatch)(i.store),{isChanged:A=!1,questionID:M,type:L,description:P,title:F,correctAnswerInfo:O,commentBox:H,category:Q,multicategories:R=[],hint:U,featureImageID:j,featureImageSrc:V,answers:W,answerEditor:Z,matchAnswer:$,required:G,settings:J={}}=u,[K,X]=(0,a.useState)(!d(O)),[Y,ee]=(0,a.useState)(!1),te="1"==qsmBlockData.is_pro_activated,ae=e=>14{let e=J?.file_upload_type||qsmBlockData.file_upload_type.default;return d(e)?[]:e.split(",")};(0,a.useEffect)((()=>{let e=!0;if(e&&(d(M)||"0"==M||!d(M)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(M,w))){let e=h({id:null,rest_nonce:D,quizID:v,quiz_name:B,postID:z,answerEditor:q(Z,"text"),type:q(L,"0"),name:p(q(P)),question_title:q(F),answerInfo:p(q(O)),comments:q(H,"1"),hint:q(U),category:q(Q),multicategories:[],required:q(G,0),answers:W,page:0,featureImageID:j,featureImageSrc:V,matchAnswer:null});l()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;E({questionID:t})}})).catch((e=>{console.log("error",e),I("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&f&&!1===A&&E({isChanged:!0}),()=>{e=!1}}),[M,L,P,F,O,H,Q,R,U,j,V,W,Z,$,G,J]);const le=(0,i.useBlockProps)({className:k?" in-editing-mode is-highlighted ":""}),ie=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=ie(e,t);a=[...a,...n]}return _(a)},oe=["12","7","3","5","14"].includes(L)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"",se=()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);T(a,S(w)+1,N(w),!0)};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>se()}),(0,a.createElement)(c.ToolbarButton,{icon:"welcome-add-page",label:(0,n.__)("Add New Page","quiz-master-next"),onClick:()=>(()=>{const e=(0,t.createBlock)("qsm/quiz-page"),a=N(w),n=S(a)+1,r=N(a);T(e,n,r,!0)})()}))),Y&&(0,a.createElement)(c.Modal,{contentLabel:(0,n.__)("Use QSM Editor for Advanced Question","quiz-master-next"),className:"qsm-advance-q-modal",isDismissible:!1,size:"small",__experimentalHideHeader:!0},(0,a.createElement)("div",{className:"qsm-modal-body"},(0,a.createElement)("h3",{className:"qsm-title"},(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"54",height:"54",viewBox:"0 0 54 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{d:"M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z",stroke:"#B45309",strokeWidth:"1.65929",strokeLinecap:"round",strokeLinejoin:"round"}))}),(0,a.createElement)("br",null),(0,n.__)("Use QSM editor for Advanced Question","quiz-master-next")),(0,a.createElement)("p",{className:"qsm-description"},(0,n.__)("Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.","quiz-master-next")),(0,a.createElement)("div",{className:"qsm-modal-btn-wrapper"},(0,a.createElement)(c.Button,{variant:"secondary",onClick:()=>ee(!1)},(0,n.__)("Cancel","quiz-master-next")),(0,a.createElement)(c.Button,{variant:"primary",onClick:()=>{}},(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,n.__)("Add Question from quiz editor","quiz-master-next")))))),ae(L)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+M),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...le},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+F),(0,a.createElement)("p",null,(0,n.__)("Edit question in QSM ","quiz-master-next"),(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,n.__)("editor","quiz-master-next"))))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+M),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:L||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||te||!["15","16","17"].includes(e))te&&ae(e)?ee(!0):E({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[L])?"":qsmBlockData.question_type_description[L]+" "+oe,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),["0","4","1","10","13"].includes(L)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:Z||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>E({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d(G)&&"1"==G,onChange:()=>E({required:d(G)||"1"!=G?1:0})}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Show Correct Answer Info","quiz-master-next"),checked:K,onChange:()=>X(!K)})),"11"==L&&(0,a.createElement)(c.PanelBody,{title:(0,n.__)("File Settings","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{type:"number",label:qsmBlockData.file_upload_limit.heading,value:null!==(r=J?.file_upload_limit)&&void 0!==r?r:qsmBlockData.file_upload_limit.default,onChange:e=>E({settings:{...J,file_upload_limit:e}})}),(0,a.createElement)("label",{className:"qsm-inspector-label"},qsmBlockData.file_upload_type.heading),Object.keys(qsmBlockData.file_upload_type.options).map((e=>{return(0,a.createElement)(c.CheckboxControl,{key:"filetype-"+e,label:ne[e],checked:(t=e,re().includes(t)),onChange:()=>(e=>{let t=re();t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),t=t.join(","),E({settings:{...J,file_upload_type:t}})})(e)});var t}))),(0,a.createElement)(b,{isCategorySelected:e=>R.includes(e),setUnsetCatgory:(e,t)=>{let a=d(R)||0===R.length?d(Q)?[]:[Q]:R;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{ie(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=ie(e,t);a=[...a,...n]}a=_(a),E({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Hint","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{label:"",value:U,onChange:e=>E({hint:g(e)})})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading,initialOpen:!1},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:H||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>E({commentBox:e}),__nextHasNoMarginBottom:!0})),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(C,{featureImageID:j,onUpdateImage:e=>{E({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{E({featureImageID:void 0,featureImageSrc:void 0})}}))),(0,a.createElement)("div",{...le},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:F,onChange:e=>E({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),k&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here... (optional)","quiz-master-next"),value:p(P),onChange:e=>E({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(L)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),K&&(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:p(O),onChange:e=>E({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),k&&(0,a.createElement)("div",{className:"block-editor-block-list__insertion-point-inserter qsm-add-new-ques-wrapper"},(0,a.createElement)(c.Button,{icon:y,label:(0,n.__)("Add New Question","quiz-master-next"),tooltipPosition:"bottom",onClick:()=>se(),variant:"secondary",className:"add-new-question-btn block-editor-inserter__toggle"}))))))},__experimentalLabel(e,{context:t}){const{title:a}=e,n=e?.metadata?.name;if("list-view"===t&&(n||a?.length>0))return n||a}})})(); \ No newline at end of file +(0,n.__)("The current image has no alternative text. The file name is: %s"),h.slug)),(0,a.createElement)(i.MediaUploadCheck,{fallback:x},(0,a.createElement)(i.MediaUpload,{title:f,onSelect:e=>{q(e),t(e)},unstableFeaturedImageFlow:!0,allowedTypes:E,modalClass:"editor-post-featured-image__media-modal",render:({open:t})=>(0,a.createElement)("div",{className:"editor-post-featured-image__container"},(0,a.createElement)(c.Button,{ref:_,className:e?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":e?(0,n.__)("Edit or replace the image"):null,"aria-describedby":e?`editor-post-featured-image-${e}-describedby`:null},!!e&&h&&(0,a.createElement)(c.ResponsiveWrapper,{naturalWidth:h.width,naturalHeight:h.height,isInline:!0},(0,a.createElement)("img",{src:h.url,alt:h.alt_text})),p&&(0,a.createElement)(c.Spinner,null),!e&&!p&&w),!!e&&(0,a.createElement)(c.__experimentalHStack,{className:"editor-post-featured-image__actions"},(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:t,"aria-hidden":"true"},(0,n.__)("Replace")),(0,a.createElement)(c.Button,{className:"editor-post-featured-image__action",onClick:()=>{r(),_.current.focus()}},(0,n.__)("Remove"))),(0,a.createElement)(c.DropZone,{onFilesDrop:y})),value:e})))},b=({isCategorySelected:e,setUnsetCatgory:t})=>{const[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)(""),[m,u]=(0,a.useState)(0),[_,p]=(0,a.useState)(!1),[g,q]=(0,a.useState)(!1),[E,f]=(0,a.useState)(qsmBlockData?.hierarchicalCategoryList),w=e=>{let t={};return e.forEach((e=>{if(t[e.id]=e,0{let t=[];return e.forEach((e=>{if(t.push(e.name),0n.map((n=>(0,a.createElement)("div",{key:n.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,a.createElement)(c.CheckboxControl,{label:n.name,checked:e(n.id),onChange:()=>t(n.id,x)}),!!n.children.length&&(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},v(n.children)))));return(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Categories","quiz-master-next"),initialOpen:!0},(0,a.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":(0,n.__)("Categories","quiz-master-next")},v(E)),(0,a.createElement)("div",{className:"qsm-ptb-1"},(0,a.createElement)(c.Button,{variant:"link",onClick:()=>i(!r)},b)),r&&(0,a.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g||d(o)||_||(p(!0),l()({url:qsmBlockData.ajax_url,method:"POST",body:h({action:"save_new_category",name:o,parent:m})}).then((e=>{if(!d(e.term_id)){let a=e.term_id;l()({path:"/quiz-survey-master/v1/quiz/hierarchical-category-list",method:"POST"}).then((e=>{"success"==e.status&&(f(e.result),C(e.result),s(""),u(0),t(a,w(term.id)),p(!1))}))}})))}},(0,a.createElement)(c.Flex,{direction:"column",gap:"1"},(0,a.createElement)(c.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:(0,n.__)("Category Name","quiz-master-next"),value:o,onChange:e=>((e,t)=>{t=k(t),console.log("categories",t),t.includes(e)?q(e):(q(!1),s(e))})(e,E),required:!0}),0u(e),selectedId:m,tree:E}),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",disabled:g||_},b)),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("p",{className:"qsm-error-text"},!1!==g&&(0,n.__)("Category ","quiz-master-next")+g+(0,n.__)(" already exists.","quiz-master-next"))))))},y=()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false"},(0,a.createElement)("path",{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}))}),k=JSON.parse('{"u2":"qsm/quiz-question"}');(0,t.registerBlockType)(k.u2,{icon:()=>(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{x:"0.102539",y:"0.101562",width:"24",height:"24",rx:"4.68852",fill:"#ADADAD"}),(0,a.createElement)("path",{d:"M17.0475 17.191C17.2367 17.3683 17.3313 17.5752 17.3313 17.8117C17.3313 18.06 17.2426 18.2787 17.0653 18.4679C16.8879 18.6453 16.6751 18.734 16.4268 18.734C16.1667 18.734 15.9538 18.6512 15.7883 18.4857L14.937 17.6521C13.8492 18.4088 12.5959 18.7872 11.177 18.7872C10.0301 18.7872 9.01325 18.533 8.12646 18.0245C7.2515 17.5161 6.57163 16.8126 6.08685 15.914C5.6139 15.0035 5.37742 13.9631 5.37742 12.7925C5.37742 11.5273 5.64937 10.41 6.19327 9.44044C6.74898 8.45907 7.48206 7.70234 8.3925 7.17027C9.31475 6.6382 10.308 6.37216 11.3721 6.37216C12.4481 6.37216 13.459 6.64411 14.4049 7.18801C15.3508 7.72008 16.1075 8.46498 16.6751 9.42271C17.2426 10.3804 17.5264 11.4505 17.5264 12.6329C17.5264 14.0636 17.1007 15.3287 16.2494 16.4283L17.0475 17.191ZM11.177 17.1732C12.0874 17.1732 12.9269 16.9249 13.6955 16.4283L12.5604 15.311C12.3949 15.1454 12.3121 14.9799 12.3121 14.8144C12.3121 14.6015 12.4244 14.3887 12.6491 14.1759C12.8855 13.9631 13.122 13.8566 13.3585 13.8566C13.5122 13.8566 13.6364 13.9039 13.7309 13.9985L14.9724 15.1868C15.4927 14.4183 15.7528 13.5492 15.7528 12.5797C15.7528 11.7284 15.5518 10.9539 15.1498 10.2563C14.7596 9.54686 14.2335 8.99114 13.5713 8.58913C12.9092 8.18712 12.1998 7.98611 11.443 7.98611C10.6981 7.98611 9.99462 8.18121 9.33249 8.57139C8.67036 8.94975 8.13828 9.49956 7.73627 10.2208C7.34609 10.9421 7.15099 11.7756 7.15099 12.7216C7.15099 13.6083 7.32244 14.3887 7.66533 15.0627C8.02005 15.7366 8.49891 16.2569 9.10192 16.6234C9.71676 16.99 10.4085 17.1732 11.177 17.1732Z",fill:"white"}))}),edit:function(e){var r;if("undefined"==typeof qsmBlockData)return null;const{className:m,attributes:u,setAttributes:E,isSelected:f,clientId:w,context:x}=e,k=(0,s.useSelect)((e=>f||e("core/block-editor").hasSelectedInnerBlock(w,!0))),v=x["quiz-master-next/quizID"],{quiz_name:B,post_id:z,rest_nonce:D}=x["quiz-master-next/quizAttr"],{createNotice:I}=(x["quiz-master-next/pageID"],(0,s.useDispatch)(o.store)),{getBlockRootClientId:N,getBlockIndex:S}=(0,s.useSelect)(i.store),{insertBlock:T}=(0,s.useDispatch)(i.store),{isChanged:A=!1,questionID:M,type:L,description:P,title:F,correctAnswerInfo:O,commentBox:H,category:Q,multicategories:R=[],hint:U,featureImageID:j,featureImageSrc:V,answers:W,answerEditor:Z,matchAnswer:$,required:G,settings:J={}}=u,[K,X]=(0,a.useState)(!d(O)),[Y,ee]=(0,a.useState)(!1),te="1"==qsmBlockData.is_pro_activated,ae=e=>14{let e=J?.file_upload_type||qsmBlockData.file_upload_type.default;return d(e)?[]:e.split(",")};(0,a.useEffect)((()=>{let e=!0;if(e&&(d(M)||"0"==M||!d(M)&&((e,t)=>{const a=(0,s.select)("core/block-editor").getClientIdsWithDescendants();return!d(a)&&a.some((a=>{const{questionID:n}=(0,s.select)("core/block-editor").getBlockAttributes(a);return t!==a&&n===e}))})(M,w))){let e=h({id:null,rest_nonce:D,quizID:v,quiz_name:B,postID:z,answerEditor:q(Z,"text"),type:q(L,"0"),name:p(q(P)),question_title:q(F),answerInfo:p(q(O)),comments:q(H,"1"),hint:q(U),category:q(Q),multicategories:[],required:q(G,0),answers:W,page:0,featureImageID:j,featureImageSrc:V,matchAnswer:null});l()({path:"/quiz-survey-master/v1/questions",method:"POST",body:e}).then((e=>{if("success"==e.status){let t=e.id;E({questionID:t})}})).catch((e=>{console.log("error",e),I("error",e.message,{isDismissible:!0,type:"snackbar"})}))}return()=>{e=!1}}),[]),(0,a.useEffect)((()=>{let e=!0;return e&&f&&!1===A&&E({isChanged:!0}),()=>{e=!1}}),[M,L,P,F,O,H,Q,R,U,j,V,W,Z,$,G,J]);const le=(0,i.useBlockProps)({className:k?" in-editing-mode is-highlighted ":""}),ie=(e,t)=>{let a=[];if(!d(t[e])&&"0"!=t[e].parent&&(e=t[e].parent,a.push(e),!d(t[e])&&"0"!=t[e].parent)){let n=ie(e,t);a=[...a,...n]}return _(a)},oe=["12","7","3","5","14"].includes(L)?(0,n.__)("Note: Add only correct answer options with their respective points score.","quiz-master-next"):"",se=()=>{if(d(e?.name))return console.log("block name not found"),!0;const a=(0,t.createBlock)(e.name);T(a,S(w)+1,N(w),!0)};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BlockControls,null,(0,a.createElement)(c.ToolbarGroup,null,(0,a.createElement)(c.ToolbarButton,{icon:"plus-alt2",label:(0,n.__)("Add New Question","quiz-master-next"),onClick:()=>se()}),(0,a.createElement)(c.ToolbarButton,{icon:"welcome-add-page",label:(0,n.__)("Add New Page","quiz-master-next"),onClick:()=>(()=>{const e=(0,t.createBlock)("qsm/quiz-page"),a=N(w),n=S(a)+1,r=N(a);T(e,n,r,!0)})()}))),Y&&(0,a.createElement)(c.Modal,{contentLabel:(0,n.__)("Use QSM Editor for Advanced Question","quiz-master-next"),className:"qsm-advance-q-modal",isDismissible:!1,size:"small",__experimentalHideHeader:!0},(0,a.createElement)("div",{className:"qsm-modal-body"},(0,a.createElement)("h3",{className:"qsm-title"},(0,a.createElement)(c.Icon,{icon:()=>(0,a.createElement)("svg",{width:"54",height:"54",viewBox:"0 0 54 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{d:"M27.1855 23.223V28.0626M15.1794 32.4196C14.0618 34.3554 15.4595 36.7739 17.6934 36.7739H36.6776C38.9102 36.7739 40.3079 34.3554 39.1916 32.4196L29.7008 15.9675C28.5832 14.0317 25.7878 14.0317 24.6702 15.9675L15.1794 32.4196ZM27.1855 31.9343H27.1945V31.9446H27.1855V31.9343Z",stroke:"#B45309",strokeWidth:"1.65929",strokeLinecap:"round",strokeLinejoin:"round"}))}),(0,a.createElement)("br",null),(0,n.__)("Use QSM editor for Advanced Question","quiz-master-next")),(0,a.createElement)("p",{className:"qsm-description"},(0,n.__)("Currently, the block editor doesn't support advanced question type. We are working on it. Alternatively, you can add advanced questions from your QSM's quiz editor.","quiz-master-next")),(0,a.createElement)("div",{className:"qsm-modal-btn-wrapper"},(0,a.createElement)(c.Button,{variant:"secondary",onClick:()=>ee(!1)},(0,n.__)("Cancel","quiz-master-next")),(0,a.createElement)(c.Button,{variant:"primary",onClick:()=>{}},(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,n.__)("Add Question from quiz editor","quiz-master-next")))))),ae(L)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+M),(0,a.createElement)("h3",null,(0,n.__)("Advanced Question Type","quiz-master-next")))),(0,a.createElement)("div",{...le},(0,a.createElement)("h4",{className:"qsm-question-title qsm-error-text"},(0,n.__)("Advanced Question Type : ","quiz-master-next")+F),(0,a.createElement)("p",null,(0,n.__)("Edit question in QSM ","quiz-master-next"),(0,a.createElement)(c.ExternalLink,{href:qsmBlockData.quiz_settings_url+"&quiz_id="+v},(0,n.__)("editor","quiz-master-next"))))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Question settings","quiz-master-next"),initialOpen:!0},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,n.__)("ID","quiz-master-next")+": "+M),(0,a.createElement)(c.SelectControl,{label:qsmBlockData.question_type.label,value:L||qsmBlockData.question_type.default,onChange:e=>(e=>{if(d(MicroModal)||te||!["15","16","17"].includes(e))te&&ae(e)?ee(!0):E({type:e});else{let e=document.getElementById("modal-advanced-question-type");d(e)||MicroModal.show("modal-advanced-question-type")}})(e),help:d(qsmBlockData.question_type_description[L])?"":qsmBlockData.question_type_description[L]+" "+oe,__nextHasNoMarginBottom:!0},!d(qsmBlockData.question_type.options)&&qsmBlockData.question_type.options.map((e=>(0,a.createElement)("optgroup",{label:e.category,key:"qtypes"+e.category},e.types.map((e=>(0,a.createElement)("option",{value:e.slug,key:"qtype"+e.slug},e.name))))))),["0","4","1","10","13"].includes(L)&&(0,a.createElement)(c.SelectControl,{label:qsmBlockData.answerEditor.label,value:Z||qsmBlockData.answerEditor.default,options:qsmBlockData.answerEditor.options,onChange:e=>E({answerEditor:e}),__nextHasNoMarginBottom:!0}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Required","quiz-master-next"),checked:!d(G)&&"1"==G,onChange:()=>E({required:d(G)||"1"!=G?1:0})}),(0,a.createElement)(c.ToggleControl,{label:(0,n.__)("Show Correct Answer Info","quiz-master-next"),checked:K,onChange:()=>X(!K)})),"11"==L&&(0,a.createElement)(c.PanelBody,{title:(0,n.__)("File Settings","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{type:"number",label:qsmBlockData.file_upload_limit.heading,value:null!==(r=J?.file_upload_limit)&&void 0!==r?r:qsmBlockData.file_upload_limit.default,onChange:e=>E({settings:{...J,file_upload_limit:e}})}),(0,a.createElement)("label",{className:"qsm-inspector-label"},qsmBlockData.file_upload_type.heading),Object.keys(qsmBlockData.file_upload_type.options).map((e=>{return(0,a.createElement)(c.CheckboxControl,{key:"filetype-"+e,label:ne[e],checked:(t=e,re().includes(t)),onChange:()=>(e=>{let t=re();t.includes(e)?t=t.filter((t=>t!=e)):t.push(e),t=t.join(","),E({settings:{...J,file_upload_type:t}})})(e)});var t}))),(0,a.createElement)(b,{isCategorySelected:e=>R.includes(e),setUnsetCatgory:(e,t)=>{let a=d(R)||0===R.length?d(Q)?[]:[Q]:R;if(a.includes(e))a=a.filter((t=>t!=e)),a.forEach((n=>{ie(n,t).includes(e)&&(a=a.filter((e=>e!=n)))}));else{a.push(e);let n=ie(e,t);a=[...a,...n]}a=_(a),E({category:"",multicategories:[...a]})}}),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Hint","quiz-master-next"),initialOpen:!1},(0,a.createElement)(c.TextControl,{label:"",value:U,onChange:e=>E({hint:g(e)})})),(0,a.createElement)(c.PanelBody,{title:qsmBlockData.commentBox.heading,initialOpen:!1},(0,a.createElement)(c.SelectControl,{label:qsmBlockData.commentBox.label,value:H||qsmBlockData.commentBox.default,options:qsmBlockData.commentBox.options,onChange:e=>E({commentBox:e}),__nextHasNoMarginBottom:!0})),(0,a.createElement)(c.PanelBody,{title:(0,n.__)("Featured image","quiz-master-next"),initialOpen:!0},(0,a.createElement)(C,{featureImageID:j,onUpdateImage:e=>{E({featureImageID:e.id,featureImageSrc:e.url})},onRemoveImage:e=>{E({featureImageID:void 0,featureImageSrc:void 0})}}))),(0,a.createElement)("div",{...le},(0,a.createElement)(i.RichText,{tagName:"h4",title:(0,n.__)("Question title","quiz-master-next"),"aria-label":(0,n.__)("Question title","quiz-master-next"),placeholder:(0,n.__)("Type your question here","quiz-master-next"),value:F,onChange:e=>E({title:g(e)}),allowedFormats:[],withoutInteractiveFormatting:!0,className:"qsm-question-title"}),k&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Question description","quiz-master-next"),"aria-label":(0,n.__)("Question description","quiz-master-next"),placeholder:(0,n.__)("Description goes here... (optional)","quiz-master-next"),value:p(P),onChange:e=>E({description:e}),className:"qsm-question-description",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),!["8","11","6","9"].includes(L)&&(0,a.createElement)(i.InnerBlocks,{allowedBlocks:["qsm/quiz-answer-option"],template:[["qsm/quiz-answer-option",{optionID:"0"}],["qsm/quiz-answer-option",{optionID:"1"}]]}),K&&(0,a.createElement)(i.RichText,{tagName:"p",title:(0,n.__)("Correct Answer Info","quiz-master-next"),"aria-label":(0,n.__)("Correct Answer Info","quiz-master-next"),placeholder:(0,n.__)("Correct answer info goes here","quiz-master-next"),value:p(O),onChange:e=>E({correctAnswerInfo:e}),className:"qsm-question-correct-answer-info",__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}),k&&(0,a.createElement)("div",{className:"block-editor-block-list__insertion-point-inserter qsm-add-new-ques-wrapper"},(0,a.createElement)(c.Button,{icon:y,label:(0,n.__)("Add New Question","quiz-master-next"),tooltipPosition:"bottom",onClick:()=>se(),variant:"secondary",className:"add-new-question-btn block-editor-inserter__toggle"}))))))},__experimentalLabel(e,{context:t}){const{title:a}=e,n=e?.metadata?.name;if("list-view"===t&&(n||a?.length>0))return n||a}})})(); \ No newline at end of file diff --git a/blocks/src/block.json b/blocks/src/block.json index 448069156..763d22a52 100644 --- a/blocks/src/block.json +++ b/blocks/src/block.json @@ -24,6 +24,7 @@ "quiz-master-next/quizID": "quizID", "quiz-master-next/quizAttr": "quizAttr" }, + "usesContext": [ "postId", "postStatus" ], "example": {}, "supports": { "html": false diff --git a/blocks/src/component/icon.js b/blocks/src/component/icon.js index 6f2b2a344..d588a6d9c 100644 --- a/blocks/src/component/icon.js +++ b/blocks/src/component/icon.js @@ -50,7 +50,7 @@ export const warningIcon = () => ( export const plusIcon = () => ( ( - + ) } /> ); \ No newline at end of file diff --git a/blocks/src/edit.js b/blocks/src/edit.js index cfa74765a..f782a0564 100644 --- a/blocks/src/edit.js +++ b/blocks/src/edit.js @@ -32,7 +32,9 @@ export default function Edit( props ) { return null; } - const { className, attributes, setAttributes, isSelected, clientId } = props; + const { className, attributes, setAttributes, isSelected, clientId, context } = props; + + const page_post_id = context['postId']; const { createNotice } = useDispatch( noticesStore ); //quiz attribute const globalQuizsetting = qsmBlockData.globalQuizsetting; @@ -67,6 +69,10 @@ export default function Edit( props ) { return isSavingPost() && ! isAutosavingPost(); }, [] ); + const editorSelectors = useSelect( ( select ) => { + return select( 'core/editor' ); + }, [] ); + const { getBlock } = useSelect( blockEditorStore ); /**Initialize block from server */ @@ -478,11 +484,22 @@ export default function Edit( props ) { let quizData = getQuizDataToSave(); //save quiz status setSaveQuiz( true ); + + //post status + let post_status = 'publish'; + if ( ! qsmIsEmpty( editorSelectors ) ) { + post_status = editorSelectors.getEditedPostAttribute( 'status' ); + } + if ( qsmIsEmpty( post_status ) ) { + post_status = 'publish'; + } quizData = qsmFormData({ 'save_entire_quiz': '1', 'quizData': JSON.stringify( quizData ), 'qsm_block_quiz_nonce' : qsmBlockData.nonce, + 'page_post_id' : qsmIsEmpty( page_post_id ) ? 0: page_post_id , + 'post_status' : post_status, "nonce": qsmBlockData.saveNonce,//save pages nonce }); diff --git a/blocks/src/editor.scss b/blocks/src/editor.scss index 4f460ebf8..cd3844700 100644 --- a/blocks/src/editor.scss +++ b/blocks/src/editor.scss @@ -98,12 +98,20 @@ /*Question options*/ .wp-block-qsm-quiz-answer-option{ + padding-left: 0.8rem; + &.block-editor-block-list__block.is-highlighted:after{ + box-shadow: none; + border: 2px dotted #c3c5cc; + } input:disabled{ border-color: inherit; } input[type="radio"]:disabled, input[type="checkbox"]:disabled{ opacity: 1; } + .qsm-question-answer-option.rich-text{ + margin-left: 5px; + } } .qsm-question-answer-option{ color: $qsm_primary_color; diff --git a/blocks/src/index.js b/blocks/src/index.js index dd01cde3b..b3ee36cf2 100644 --- a/blocks/src/index.js +++ b/blocks/src/index.js @@ -13,27 +13,4 @@ registerBlockType( metadata.name, { */ edit: Edit, save: save, -} ); - - -const withMyPluginControls = createHigherOrderComponent( ( BlockEdit ) => { - return ( props ) => { - const { name, className, attributes, setAttributes, isSelected, clientId, context } = props; - if ( 'core/group' !== name ) { - return ; - } - - console.log("props",props); - return ( - <> - - - ); - }; -}, 'withMyPluginControls' ); - -wp.hooks.addFilter( - 'editor.BlockEdit', - 'my-plugin/with-inspector-controls', - withMyPluginControls -); \ No newline at end of file +} ); \ No newline at end of file