PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.3.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.3.9
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.3.9, at assets/js/dist/frontend/modal.js

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