/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // 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 }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1); /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _edit_jsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /** * WordPress dependencies */ var addFilter = wp.hooks.addFilter; /** * Internal dependencies */ /** * Custom block Edit output for FacebookFanpage block. * * @param {JSX} edit Original block edit. * @param {Object} blockProps Block data. * * @return {JSX} Block edit. */ function editRender(edit, blockProps) { if ('canvas/facebook-fanpage' === blockProps.name) { return wp.element.createElement(_edit_jsx__WEBPACK_IMPORTED_MODULE_0__["default"], blockProps); } return edit; } addFilter('canvas.customBlock.editRender', 'canvas/facebook-fanpage/editRender', editRender); /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return FacebookFanpageBlockEdit; }); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var throttle_debounce__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } /** * External dependencies */ /** * WordPress dependencies */ var __ = wp.i18n.__; var _wp$element = wp.element, Component = _wp$element.Component, Fragment = _wp$element.Fragment, createRef = _wp$element.createRef; var _wp$components = wp.components, Placeholder = _wp$components.Placeholder, Disabled = _wp$components.Disabled; /** * Component */ var FacebookFanpageBlockEdit = /*#__PURE__*/ function (_Component) { _inherits(FacebookFanpageBlockEdit, _Component); function FacebookFanpageBlockEdit() { var _this; _classCallCheck(this, FacebookFanpageBlockEdit); _this = _possibleConstructorReturn(this, _getPrototypeOf(FacebookFanpageBlockEdit).apply(this, arguments)); _this.fbRef = createRef(); _this.maybeInit = Object(throttle_debounce__WEBPACK_IMPORTED_MODULE_1__["debounce"])(300, _this.maybeInit.bind(_assertThisInitialized(_this))); return _this; } _createClass(FacebookFanpageBlockEdit, [{ key: "componentDidMount", value: function componentDidMount() { this.maybeInit(); } }, { key: "componentDidUpdate", value: function componentDidUpdate() { this.maybeInit(); } }, { key: "maybeInit", value: function maybeInit() { var href = this.props.attributes.href; if (!this.fbRef || !this.fbRef.current) { return; } if (!href || !window.FB || !window.FB.XFBML) { return; } var $ref = this.fbRef.current; var _this$props$attribute = this.props.attributes, showCover = _this$props$attribute.showCover, showFacepile = _this$props$attribute.showFacepile, showPosts = _this$props$attribute.showPosts, smallHeader = _this$props$attribute.smallHeader; var hideCover = showCover ? 'false' : 'true'; showFacepile = showFacepile ? 'true' : 'false'; showPosts = showPosts ? 'true' : 'false'; smallHeader = smallHeader ? 'true' : 'false'; // check if already rendered var $query = $ref.getAttribute('fb-iframe-plugin-query'); if ($query) { var queryObj = false; try { // thanks https://stackoverflow.com/questions/8648892/convert-url-parameters-to-a-javascript-object queryObj = JSON.parse('{"' + decodeURIComponent($query).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'); } catch (e) { queryObj = false; } if (queryObj && queryObj.href === href && queryObj.hide_cover === hideCover && queryObj.show_facepile === showFacepile && queryObj.show_posts === showPosts && queryObj.small_header === smallHeader) { return; } } // try to re-render if ($ref.attributes['fb-xfbml-state']) { $ref.attributes['fb-xfbml-state'] = 're-rendering'; } FB.XFBML.parse($ref.parentNode); } }, { key: "render", value: function render() { var setAttributes = this.props.setAttributes; var className = this.props.className; var _this$props$attribute2 = this.props.attributes, href = _this$props$attribute2.href, showCover = _this$props$attribute2.showCover, showFacepile = _this$props$attribute2.showFacepile, showPosts = _this$props$attribute2.showPosts, smallHeader = _this$props$attribute2.smallHeader, canvasClassName = _this$props$attribute2.canvasClassName; className = classnames__WEBPACK_IMPORTED_MODULE_0___default()('fb-page-wrapper', canvasClassName, className); return wp.element.createElement(Fragment, null, href ? wp.element.createElement(Disabled, null, wp.element.createElement("div", { className: className }, wp.element.createElement("div", { className: "fb-page", ref: this.fbRef, "data-href": href, "data-hide-cover": showCover ? 'false' : 'true', "data-show-facepile": showFacepile ? 'true' : 'false', "data-show-posts": showPosts ? 'true' : 'false', "data-small-header": smallHeader ? 'true' : 'false', "data-adapt-container-width": "true" }))) : wp.element.createElement(Placeholder, null, __('Please, enter Facebook Fanpage URL.'))); } }]); return FacebookFanpageBlockEdit; }(Component); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames () { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg) && arg.length) { var inner = classNames.apply(null, arg); if (inner) { classes.push(inner); } } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } } return classes.join(' '); } if ( true && module.exports) { classNames.default = classNames; module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return classNames; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} }()); /***/ }), /* 4 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return throttle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return debounce; }); /* eslint-disable no-undefined,no-param-reassign,no-shadow */ /** * Throttle execution of a function. Especially useful for rate limiting * execution of handlers on events like resize and scroll. * * @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful. * @param {Boolean} [noTrailing] Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds, * the internal counter is reset) * @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is, * to `callback` when the throttled-function is executed. * @param {Boolean} [debounceMode] If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end), * schedule `callback` to execute after `delay` ms. * * @return {Function} A new, throttled, function. */ function throttle (delay, noTrailing, callback, debounceMode) { /* * After wrapper has stopped being called, this timeout ensures that * `callback` is executed at the proper times in `throttle` and `end` * debounce modes. */ var timeoutID; var cancelled = false; // Keep track of the last time `callback` was executed. var lastExec = 0; // Function to clear existing timeout function clearExistingTimeout() { if (timeoutID) { clearTimeout(timeoutID); } } // Function to cancel next exec function cancel() { clearExistingTimeout(); cancelled = true; } // `noTrailing` defaults to falsy. if (typeof noTrailing !== 'boolean') { debounceMode = callback; callback = noTrailing; noTrailing = undefined; } /* * The `wrapper` function encapsulates all of the throttling / debouncing * functionality and when executed will limit the rate at which `callback` * is executed. */ function wrapper() { var self = this; var elapsed = Date.now() - lastExec; var args = arguments; if (cancelled) { return; } // Execute `callback` and update the `lastExec` timestamp. function exec() { lastExec = Date.now(); callback.apply(self, args); } /* * If `debounceMode` is true (at begin) this is used to clear the flag * to allow future `callback` executions. */ function clear() { timeoutID = undefined; } if (debounceMode && !timeoutID) { /* * Since `wrapper` is being called for the first time and * `debounceMode` is true (at begin), execute `callback`. */ exec(); } clearExistingTimeout(); if (debounceMode === undefined && elapsed > delay) { /* * In throttle mode, if `delay` time has been exceeded, execute * `callback`. */ exec(); } else if (noTrailing !== true) { /* * In trailing throttle mode, since `delay` time has not been * exceeded, schedule `callback` to execute `delay` ms after most * recent execution. * * If `debounceMode` is true (at begin), schedule `clear` to execute * after `delay` ms. * * If `debounceMode` is false (at end), schedule `callback` to * execute after `delay` ms. */ timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay); } } wrapper.cancel = cancel; // Return the wrapper function. return wrapper; } /* eslint-disable no-undefined */ /** * Debounce execution of a function. Debouncing, unlike throttling, * guarantees that a function is only executed a single time, either at the * very beginning of a series of calls, or at the very end. * * @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful. * @param {Boolean} [atBegin] Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call. * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset). * @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is, * to `callback` when the debounced-function is executed. * * @return {Function} A new, debounced function. */ function debounce (delay, atBegin, callback) { return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false); } /***/ }) /******/ ]);