Liferay.Loader.define("layout-content-page-editor-web@2.0.166/page_editor/app/services/WidgetService", ['module', 'exports', 'require', '../config/index', './serviceFetch'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _index = require("../config/index");

    var _serviceFetch = _interopRequireDefault(require("./serviceFetch"));

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    /**
     * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
     * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
     */
    var _default = {
      /**
       * Adds a Widget to the current layout
       * @param {object} options
       * @param {function} options.onNetworkStatus
       * @param {string} options.portletId Portlet id of the Widget
       * @param {string} options.parentItemId id of the parent where the portlet is going to be added
       * @param {string} options.position position where the portlet is going to be added
       * @param {string} options.portletId Portlet id of the Widget
       * @param {string} options.segmentsExperienceId Current segmentsExperienceId
       * @return {Promise<object>}
       */
      addPortlet: function addPortlet(_ref) {
        var onNetworkStatus = _ref.onNetworkStatus,
            parentItemId = _ref.parentItemId,
            portletId = _ref.portletId,
            portletItemId = _ref.portletItemId,
            position = _ref.position,
            segmentsExperienceId = _ref.segmentsExperienceId;
        return (0, _serviceFetch.default)(_index.config.addPortletURL, {
          body: {
            parentItemId: parentItemId,
            portletId: portletId,
            portletItemId: portletItemId,
            position: position,
            segmentsExperienceId: segmentsExperienceId
          }
        }, onNetworkStatus, {
          requestGenerateDraft: true
        });
      },
      getWidgets: function getWidgets() {
        return (0, _serviceFetch.default)(_index.config.getWidgetsURL, {}, function () {});
      }
    };
    exports.default = _default;
    //# sourceMappingURL=WidgetService.js.map
  }
});
//# sourceMappingURL=WidgetService.js.map