| 1 |
/******/ (() => { // webpackBootstrap |
| 2 |
/******/ "use strict"; |
| 3 |
/******/ var __webpack_modules__ = ({ |
| 4 |
|
| 5 |
/***/ "./assets/src/apps/js/blocks/course-elements/course-progress/edit.js" |
| 6 |
/*!***************************************************************************!*\ |
| 7 |
!*** ./assets/src/apps/js/blocks/course-elements/course-progress/edit.js ***! |
| 8 |
\***************************************************************************/ |
| 9 |
(__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 10 |
|
| 11 |
__webpack_require__.r(__webpack_exports__); |
| 12 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 13 |
/* harmony export */ edit: () => (/* binding */ edit) |
| 14 |
/* harmony export */ }); |
| 15 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 16 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 17 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 18 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 19 |
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| 20 |
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
const edit = props => { |
| 25 |
const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)(); |
| 26 |
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 27 |
...blockProps |
| 28 |
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 29 |
className: "course-progress" |
| 30 |
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, 'Course passing progress: 0%'), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 31 |
className: "line" |
| 32 |
}), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, 'Start date: 2025')))); |
| 33 |
}; |
| 34 |
|
| 35 |
/***/ }, |
| 36 |
|
| 37 |
/***/ "./assets/src/apps/js/blocks/course-elements/course-progress/save.js" |
| 38 |
/*!***************************************************************************!*\ |
| 39 |
!*** ./assets/src/apps/js/blocks/course-elements/course-progress/save.js ***! |
| 40 |
\***************************************************************************/ |
| 41 |
(__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 42 |
|
| 43 |
__webpack_require__.r(__webpack_exports__); |
| 44 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 45 |
/* harmony export */ save: () => (/* binding */ save) |
| 46 |
/* harmony export */ }); |
| 47 |
const save = props => null; |
| 48 |
|
| 49 |
/***/ }, |
| 50 |
|
| 51 |
/***/ "./assets/src/apps/js/blocks/utilBlock.js" |
| 52 |
/*!************************************************!*\ |
| 53 |
!*** ./assets/src/apps/js/blocks/utilBlock.js ***! |
| 54 |
\************************************************/ |
| 55 |
(__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 56 |
|
| 57 |
__webpack_require__.r(__webpack_exports__); |
| 58 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 59 |
/* harmony export */ checkTemplatesCanLoadBlock: () => (/* binding */ checkTemplatesCanLoadBlock) |
| 60 |
/* harmony export */ }); |
| 61 |
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 62 |
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); |
| 63 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 64 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); |
| 65 |
/** |
| 66 |
* Check if the block can be loaded in the current template. |
| 67 |
* |
| 68 |
* @since 4.2.8.4 |
| 69 |
* @version 1.0.0 |
| 70 |
*/ |
| 71 |
|
| 72 |
|
| 73 |
let currentPostIdOld = null; |
| 74 |
const checkTemplatesCanLoadBlock = (templates, metadata, callBack) => { |
| 75 |
(0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.subscribe)(() => { |
| 76 |
const metaDataNew = { |
| 77 |
...metadata |
| 78 |
}; |
| 79 |
const store = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/editor') || null; |
| 80 |
if (!store || typeof store.getCurrentPostId !== 'function' || !store.getCurrentPostId()) { |
| 81 |
return; |
| 82 |
} |
| 83 |
const currentPostId = store.getCurrentPostId(); |
| 84 |
if (currentPostId === null) { |
| 85 |
return; |
| 86 |
} |
| 87 |
if (currentPostIdOld === currentPostId) { |
| 88 |
return; |
| 89 |
} |
| 90 |
currentPostIdOld = currentPostId; |
| 91 |
if ((0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.getBlockType)(metaDataNew.name)) { |
| 92 |
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.unregisterBlockType)(metaDataNew.name); |
| 93 |
if (templates.includes(currentPostId)) { |
| 94 |
metaDataNew.ancestor = null; |
| 95 |
callBack(metaDataNew); |
| 96 |
} else { |
| 97 |
if (!metaDataNew.ancestor) { |
| 98 |
metaDataNew.ancestor = []; |
| 99 |
} |
| 100 |
callBack(metaDataNew); |
| 101 |
} |
| 102 |
} |
| 103 |
}); |
| 104 |
}; |
| 105 |
|
| 106 |
|
| 107 |
/***/ }, |
| 108 |
|
| 109 |
/***/ "react" |
| 110 |
/*!************************!*\ |
| 111 |
!*** external "React" ***! |
| 112 |
\************************/ |
| 113 |
(module) { |
| 114 |
|
| 115 |
module.exports = window["React"]; |
| 116 |
|
| 117 |
/***/ }, |
| 118 |
|
| 119 |
/***/ "@wordpress/block-editor" |
| 120 |
/*!*************************************!*\ |
| 121 |
!*** external ["wp","blockEditor"] ***! |
| 122 |
\*************************************/ |
| 123 |
(module) { |
| 124 |
|
| 125 |
module.exports = window["wp"]["blockEditor"]; |
| 126 |
|
| 127 |
/***/ }, |
| 128 |
|
| 129 |
/***/ "@wordpress/blocks" |
| 130 |
/*!********************************!*\ |
| 131 |
!*** external ["wp","blocks"] ***! |
| 132 |
\********************************/ |
| 133 |
(module) { |
| 134 |
|
| 135 |
module.exports = window["wp"]["blocks"]; |
| 136 |
|
| 137 |
/***/ }, |
| 138 |
|
| 139 |
/***/ "@wordpress/data" |
| 140 |
/*!******************************!*\ |
| 141 |
!*** external ["wp","data"] ***! |
| 142 |
\******************************/ |
| 143 |
(module) { |
| 144 |
|
| 145 |
module.exports = window["wp"]["data"]; |
| 146 |
|
| 147 |
/***/ }, |
| 148 |
|
| 149 |
/***/ "@wordpress/i18n" |
| 150 |
/*!******************************!*\ |
| 151 |
!*** external ["wp","i18n"] ***! |
| 152 |
\******************************/ |
| 153 |
(module) { |
| 154 |
|
| 155 |
module.exports = window["wp"]["i18n"]; |
| 156 |
|
| 157 |
/***/ }, |
| 158 |
|
| 159 |
/***/ "./assets/src/apps/js/blocks/course-elements/course-progress/block.json" |
| 160 |
/*!******************************************************************************!*\ |
| 161 |
!*** ./assets/src/apps/js/blocks/course-elements/course-progress/block.json ***! |
| 162 |
\******************************************************************************/ |
| 163 |
(module) { |
| 164 |
|
| 165 |
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"learnpress/course-progress","title":"Course Progress","category":"learnpress-course-elements","description":"Renders template Progress Course PHP templates.","textdomain":"learnpress","keywords":["progress single course","learnpress"],"icon":"chart-line","ancestor":["learnpress/single-course"],"usesContext":[],"supports":{"multiple":false,"align":["wide","full"],"html":false,"typography":{"fontSize":true,"lineHeight":false,"fontWeight":true,"__experimentalFontFamily":false,"__experimentalTextDecoration":false,"__experimentalFontStyle":false,"__experimentalFontWeight":true,"__experimentalLetterSpacing":false,"__experimentalTextTransform":true,"__experimentalDefaultControls":{"fontSize":true}},"color":{"background":false,"text":true,"link":false,"gradients":false,"__experimentalDefaultControls":{"text":true}},"spacing":{"padding":true,"margin":true,"__experimentalDefaultControls":{"margin":false,"padding":false}}}}'); |
| 166 |
|
| 167 |
/***/ } |
| 168 |
|
| 169 |
/******/ }); |
| 170 |
/************************************************************************/ |
| 171 |
/******/ // The module cache |
| 172 |
/******/ var __webpack_module_cache__ = {}; |
| 173 |
/******/ |
| 174 |
/******/ // The require function |
| 175 |
/******/ function __webpack_require__(moduleId) { |
| 176 |
/******/ // Check if module is in cache |
| 177 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 178 |
/******/ if (cachedModule !== undefined) { |
| 179 |
/******/ return cachedModule.exports; |
| 180 |
/******/ } |
| 181 |
/******/ // Create a new module (and put it into the cache) |
| 182 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 183 |
/******/ // no module.id needed |
| 184 |
/******/ // no module.loaded needed |
| 185 |
/******/ exports: {} |
| 186 |
/******/ }; |
| 187 |
/******/ |
| 188 |
/******/ // Execute the module function |
| 189 |
/******/ if (!(moduleId in __webpack_modules__)) { |
| 190 |
/******/ delete __webpack_module_cache__[moduleId]; |
| 191 |
/******/ var e = new Error("Cannot find module '" + moduleId + "'"); |
| 192 |
/******/ e.code = 'MODULE_NOT_FOUND'; |
| 193 |
/******/ throw e; |
| 194 |
/******/ } |
| 195 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 196 |
/******/ |
| 197 |
/******/ // Return the exports of the module |
| 198 |
/******/ return module.exports; |
| 199 |
/******/ } |
| 200 |
/******/ |
| 201 |
/************************************************************************/ |
| 202 |
/******/ /* webpack/runtime/compat get default export */ |
| 203 |
/******/ (() => { |
| 204 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
| 205 |
/******/ __webpack_require__.n = (module) => { |
| 206 |
/******/ var getter = module && module.__esModule ? |
| 207 |
/******/ () => (module['default']) : |
| 208 |
/******/ () => (module); |
| 209 |
/******/ __webpack_require__.d(getter, { a: getter }); |
| 210 |
/******/ return getter; |
| 211 |
/******/ }; |
| 212 |
/******/ })(); |
| 213 |
/******/ |
| 214 |
/******/ /* webpack/runtime/define property getters */ |
| 215 |
/******/ (() => { |
| 216 |
/******/ // define getter functions for harmony exports |
| 217 |
/******/ __webpack_require__.d = (exports, definition) => { |
| 218 |
/******/ for(var key in definition) { |
| 219 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 220 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 221 |
/******/ } |
| 222 |
/******/ } |
| 223 |
/******/ }; |
| 224 |
/******/ })(); |
| 225 |
/******/ |
| 226 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 227 |
/******/ (() => { |
| 228 |
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| 229 |
/******/ })(); |
| 230 |
/******/ |
| 231 |
/******/ /* webpack/runtime/make namespace object */ |
| 232 |
/******/ (() => { |
| 233 |
/******/ // define __esModule on exports |
| 234 |
/******/ __webpack_require__.r = (exports) => { |
| 235 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 236 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 237 |
/******/ } |
| 238 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 239 |
/******/ }; |
| 240 |
/******/ })(); |
| 241 |
/******/ |
| 242 |
/************************************************************************/ |
| 243 |
var __webpack_exports__ = {}; |
| 244 |
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. |
| 245 |
(() => { |
| 246 |
/*!****************************************************************************!*\ |
| 247 |
!*** ./assets/src/apps/js/blocks/course-elements/course-progress/index.js ***! |
| 248 |
\****************************************************************************/ |
| 249 |
__webpack_require__.r(__webpack_exports__); |
| 250 |
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./edit */ "./assets/src/apps/js/blocks/course-elements/course-progress/edit.js"); |
| 251 |
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./save */ "./assets/src/apps/js/blocks/course-elements/course-progress/save.js"); |
| 252 |
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./assets/src/apps/js/blocks/course-elements/course-progress/block.json"); |
| 253 |
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 254 |
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__); |
| 255 |
/* harmony import */ var _utilBlock_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utilBlock.js */ "./assets/src/apps/js/blocks/utilBlock.js"); |
| 256 |
/** |
| 257 |
* Register block course process. |
| 258 |
*/ |
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
const templatesName = ['learnpress/learnpress//single-lp_course', 'learnpress/learnpress//single-lp_course-offline']; |
| 266 |
(0,_utilBlock_js__WEBPACK_IMPORTED_MODULE_4__.checkTemplatesCanLoadBlock)(templatesName, _block_json__WEBPACK_IMPORTED_MODULE_2__, metadataNew => { |
| 267 |
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__.registerBlockType)(metadataNew.name, { |
| 268 |
...metadataNew, |
| 269 |
edit: _edit__WEBPACK_IMPORTED_MODULE_0__.edit, |
| 270 |
save: _save__WEBPACK_IMPORTED_MODULE_1__.save |
| 271 |
}); |
| 272 |
}); |
| 273 |
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { |
| 274 |
..._block_json__WEBPACK_IMPORTED_MODULE_2__, |
| 275 |
edit: _edit__WEBPACK_IMPORTED_MODULE_0__.edit, |
| 276 |
save: _save__WEBPACK_IMPORTED_MODULE_1__.save |
| 277 |
}); |
| 278 |
})(); |
| 279 |
|
| 280 |
/******/ })() |
| 281 |
; |
| 282 |
//# sourceMappingURL=course-progress.js.map |