PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.2.0
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.2.0
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / assets / js / dist / frontend / modal.js

modal.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.2.0, at assets/js/dist/frontend/modal.js

460 lines 16.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ "use strict";
3 /******/ var __webpack_modules__ = ({
4
5 /***/ "./assets/src/apps/js/frontend/modal/index.js":
6 /*!****************************************************!*\
7 !*** ./assets/src/apps/js/frontend/modal/index.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 */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14 /* harmony export */ });
15 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
16 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
17 /* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store */ "./assets/src/apps/js/frontend/modal/store/index.js");
18 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
19 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
20 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
21 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__);
22
23 /**
24 * Create Modal popup.
25 * Edit: Use React Hook.
26 *
27 * @author Nhamdv - ThimPress.
28 */
29
30
31
32
33 const Modal = _ref => {
34 let {
35 children
36 } = _ref;
37 const {
38 show,
39 hide,
40 confirm
41 } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.dispatch)('learnpress/modal');
42 const isShow = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useSelect)(select => {
43 const isOpen = select('learnpress/modal').isOpen();
44 return isOpen;
45 });
46 const message = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useSelect)(select => {
47 const getMessage = select('learnpress/modal').getMessage();
48 return getMessage;
49 });
50 const dataConfirm = c => event => {
51 confirm(c);
52 };
53 const styles = {
54 display: isShow ? 'block' : 'none'
55 };
56 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)("div", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
57 id: "lp-modal-overlay",
58 style: styles
59 }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
60 id: "lp-modal-window",
61 style: styles
62 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
63 id: "lp-modal-content",
64 dangerouslySetInnerHTML: {
65 __html: message
66 }
67 }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
68 id: "lp-modal-buttons"
69 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("button", {
70 className: "lp-button modal-button-ok",
71 onClick: dataConfirm('yes')
72 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('OK', 'learnpress'))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("button", {
73 className: "lp-button modal-button-cancel",
74 onClick: dataConfirm('no')
75 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Cancel', 'learnpress')))))), children);
76 };
77 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Modal);
78
79 /***/ }),
80
81 /***/ "./assets/src/apps/js/frontend/modal/store/actions.js":
82 /*!************************************************************!*\
83 !*** ./assets/src/apps/js/frontend/modal/store/actions.js ***!
84 \************************************************************/
85 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
86
87 __webpack_require__.r(__webpack_exports__);
88 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
89 /* harmony export */ "confirm": () => (/* binding */ confirm),
90 /* harmony export */ "hide": () => (/* binding */ hide),
91 /* harmony export */ "show": () => (/* binding */ show)
92 /* harmony export */ });
93 function show(message, cb) {
94 return {
95 type: 'SHOW_MODAL',
96 message,
97 cb
98 };
99 }
100 function hide() {
101 return {
102 type: 'HIDE_MODAL'
103 };
104 }
105 function confirm(value) {
106 return {
107 type: 'CONFIRM',
108 value
109 };
110 }
111
112 /***/ }),
113
114 /***/ "./assets/src/apps/js/frontend/modal/store/index.js":
115 /*!**********************************************************!*\
116 !*** ./assets/src/apps/js/frontend/modal/store/index.js ***!
117 \**********************************************************/
118 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
119
120 __webpack_require__.r(__webpack_exports__);
121 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
122 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
123 /* harmony export */ });
124 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
125 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
126 /* harmony import */ var _reducer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./reducer */ "./assets/src/apps/js/frontend/modal/store/reducer.js");
127 /* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "./assets/src/apps/js/frontend/modal/store/actions.js");
128 /* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "./assets/src/apps/js/frontend/modal/store/selectors.js");
129 /* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares */ "./assets/src/apps/js/frontend/modal/store/middlewares.js");
130
131
132
133
134
135 const {
136 controls: dataControls
137 } = LP.dataControls;
138 const store = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.registerStore)('learnpress/modal', {
139 reducer: _reducer__WEBPACK_IMPORTED_MODULE_1__["default"],
140 selectors: _selectors__WEBPACK_IMPORTED_MODULE_3__,
141 actions: _actions__WEBPACK_IMPORTED_MODULE_2__,
142 controls: {
143 ...dataControls
144 }
145 });
146 (0,_middlewares__WEBPACK_IMPORTED_MODULE_4__["default"])(store);
147 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (store);
148
149 /***/ }),
150
151 /***/ "./assets/src/apps/js/frontend/modal/store/middlewares.js":
152 /*!****************************************************************!*\
153 !*** ./assets/src/apps/js/frontend/modal/store/middlewares.js ***!
154 \****************************************************************/
155 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
156
157 __webpack_require__.r(__webpack_exports__);
158 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
159 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
160 /* harmony export */ });
161 /* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! refx */ "./node_modules/refx/refx.js");
162 /* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(refx__WEBPACK_IMPORTED_MODULE_0__);
163 /**
164 * External dependencies
165 */
166
167 const effects = {
168 ENROLL_COURSE_X: (action, store) => {
169 enrollCourse: (action, store) => {
170 const {
171 dispatch
172 } = store;
173
174 //dispatch()
175 };
176 }
177 };
178
179 /**
180 * Applies the custom middlewares used specifically in the editor module.
181 *
182 * @param {Object} store Store Object.
183 *
184 * @return {Object} Update Store Object.
185 */
186 function applyMiddlewares(store) {
187 let enhancedDispatch = () => {
188 throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
189 };
190 const middlewareAPI = {
191 getState: store.getState,
192 dispatch: function () {
193 return enhancedDispatch(...arguments);
194 }
195 };
196 enhancedDispatch = refx__WEBPACK_IMPORTED_MODULE_0___default()(effects)(middlewareAPI)(store.dispatch);
197 store.dispatch = enhancedDispatch;
198 return store;
199 }
200 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (applyMiddlewares);
201
202 /***/ }),
203
204 /***/ "./assets/src/apps/js/frontend/modal/store/reducer.js":
205 /*!************************************************************!*\
206 !*** ./assets/src/apps/js/frontend/modal/store/reducer.js ***!
207 \************************************************************/
208 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
209
210 __webpack_require__.r(__webpack_exports__);
211 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
212 /* harmony export */ "Modal": () => (/* binding */ Modal),
213 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
214 /* harmony export */ });
215 const STORE_DATA = {};
216 const Modal = function () {
217 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STORE_DATA;
218 let action = arguments.length > 1 ? arguments[1] : undefined;
219 switch (action.type) {
220 case 'SHOW_MODAL':
221 return {
222 ...state,
223 isOpen: true,
224 message: action.message,
225 cb: action.cb
226 };
227 case 'HIDE_MODAL':
228 return {
229 ...state,
230 isOpen: false,
231 message: false,
232 cb: null
233 };
234 case 'CONFIRM':
235 state.cb && setTimeout(() => {
236 state.cb();
237 }, 10);
238 return {
239 ...state,
240 confirm: action.value
241 };
242 }
243 return state;
244 };
245 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Modal);
246
247 /***/ }),
248
249 /***/ "./assets/src/apps/js/frontend/modal/store/selectors.js":
250 /*!**************************************************************!*\
251 !*** ./assets/src/apps/js/frontend/modal/store/selectors.js ***!
252 \**************************************************************/
253 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
254
255 __webpack_require__.r(__webpack_exports__);
256 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
257 /* harmony export */ "confirm": () => (/* binding */ confirm),
258 /* harmony export */ "getMessage": () => (/* binding */ getMessage),
259 /* harmony export */ "isOpen": () => (/* binding */ isOpen)
260 /* harmony export */ });
261 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
262 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
263
264 function isOpen(state) {
265 return state.isOpen;
266 }
267 function getMessage(state) {
268 return state.message;
269 }
270 function confirm(state, message, cb) {
271 const {
272 show,
273 hide
274 } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.dispatch)('learnpress/modal');
275 if (!state.message) {
276 show(message, cb);
277 } else {
278 hide();
279 return state.confirm;
280 }
281 return 'no';
282 }
283
284 /***/ }),
285
286 /***/ "./node_modules/refx/refx.js":
287 /*!***********************************!*\
288 !*** ./node_modules/refx/refx.js ***!
289 \***********************************/
290 /***/ ((module) => {
291
292
293
294 function flattenIntoMap( map, effects ) {
295 var i;
296 if ( Array.isArray( effects ) ) {
297 for ( i = 0; i < effects.length; i++ ) {
298 flattenIntoMap( map, effects[ i ] );
299 }
300 } else {
301 for ( i in effects ) {
302 map[ i ] = ( map[ i ] || [] ).concat( effects[ i ] );
303 }
304 }
305 }
306
307 function refx( effects ) {
308 var map = {},
309 middleware;
310
311 flattenIntoMap( map, effects );
312
313 middleware = function( store ) {
314 return function( next ) {
315 return function( action ) {
316 var handlers = map[ action.type ],
317 result = next( action ),
318 i, handlerAction;
319
320 if ( handlers ) {
321 for ( i = 0; i < handlers.length; i++ ) {
322 handlerAction = handlers[ i ]( action, store );
323 if ( handlerAction ) {
324 store.dispatch( handlerAction );
325 }
326 }
327 }
328
329 return result;
330 };
331 };
332 };
333
334 middleware.effects = map;
335
336 return middleware;
337 }
338
339 module.exports = refx;
340
341
342 /***/ }),
343
344 /***/ "@wordpress/data":
345 /*!******************************!*\
346 !*** external ["wp","data"] ***!
347 \******************************/
348 /***/ ((module) => {
349
350 module.exports = window["wp"]["data"];
351
352 /***/ }),
353
354 /***/ "@wordpress/element":
355 /*!*********************************!*\
356 !*** external ["wp","element"] ***!
357 \*********************************/
358 /***/ ((module) => {
359
360 module.exports = window["wp"]["element"];
361
362 /***/ }),
363
364 /***/ "@wordpress/i18n":
365 /*!******************************!*\
366 !*** external ["wp","i18n"] ***!
367 \******************************/
368 /***/ ((module) => {
369
370 module.exports = window["wp"]["i18n"];
371
372 /***/ })
373
374 /******/ });
375 /************************************************************************/
376 /******/ // The module cache
377 /******/ var __webpack_module_cache__ = {};
378 /******/
379 /******/ // The require function
380 /******/ function __webpack_require__(moduleId) {
381 /******/ // Check if module is in cache
382 /******/ var cachedModule = __webpack_module_cache__[moduleId];
383 /******/ if (cachedModule !== undefined) {
384 /******/ return cachedModule.exports;
385 /******/ }
386 /******/ // Create a new module (and put it into the cache)
387 /******/ var module = __webpack_module_cache__[moduleId] = {
388 /******/ // no module.id needed
389 /******/ // no module.loaded needed
390 /******/ exports: {}
391 /******/ };
392 /******/
393 /******/ // Execute the module function
394 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
395 /******/
396 /******/ // Return the exports of the module
397 /******/ return module.exports;
398 /******/ }
399 /******/
400 /************************************************************************/
401 /******/ /* webpack/runtime/compat get default export */
402 /******/ (() => {
403 /******/ // getDefaultExport function for compatibility with non-harmony modules
404 /******/ __webpack_require__.n = (module) => {
405 /******/ var getter = module && module.__esModule ?
406 /******/ () => (module['default']) :
407 /******/ () => (module);
408 /******/ __webpack_require__.d(getter, { a: getter });
409 /******/ return getter;
410 /******/ };
411 /******/ })();
412 /******/
413 /******/ /* webpack/runtime/define property getters */
414 /******/ (() => {
415 /******/ // define getter functions for harmony exports
416 /******/ __webpack_require__.d = (exports, definition) => {
417 /******/ for(var key in definition) {
418 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
419 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
420 /******/ }
421 /******/ }
422 /******/ };
423 /******/ })();
424 /******/
425 /******/ /* webpack/runtime/hasOwnProperty shorthand */
426 /******/ (() => {
427 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
428 /******/ })();
429 /******/
430 /******/ /* webpack/runtime/make namespace object */
431 /******/ (() => {
432 /******/ // define __esModule on exports
433 /******/ __webpack_require__.r = (exports) => {
434 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
435 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
436 /******/ }
437 /******/ Object.defineProperty(exports, '__esModule', { value: true });
438 /******/ };
439 /******/ })();
440 /******/
441 /************************************************************************/
442 var __webpack_exports__ = {};
443 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
444 (() => {
445 /*!**********************************************!*\
446 !*** ./assets/src/apps/js/frontend/modal.js ***!
447 \**********************************************/
448 __webpack_require__.r(__webpack_exports__);
449 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
450 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
451 /* harmony export */ });
452 /* harmony import */ var _modal_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modal/index */ "./assets/src/apps/js/frontend/modal/index.js");
453
454 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_modal_index__WEBPACK_IMPORTED_MODULE_0__["default"]);
455 })();
456
457 (window.LP = window.LP || {}).modal = __webpack_exports__;
458 /******/ })()
459 ;
460 //# sourceMappingURL=modal.js.map