"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_add_buttons_exports = {};
__export(get_add_buttons_exports, {
  getAddButtons: () => getAddButtons,
  toolbarsToAddIn: () => toolbarsToAddIn
});
module.exports = __toCommonJS(get_add_buttons_exports);
var import_wix_ui_icons_common = require("@wix/wix-ui-icons-common");
var import_v1 = require("./../ricos-schema/legacy/wix/rich_content/v1/index.js");
var import_ricos_types = require("./../ricos-types/index.js");
var import_editor_common = require("./../editor-common/index.js");
var import_constants = require("./constants.js");
var import_data_hooks = require("./data-hooks.js");
var import_insert_modal = require("./modals/insert-modal.js");
const toolbarsToAddIn = [
  import_editor_common.TOOLBARS.MOBILE,
  import_editor_common.TOOLBARS.FOOTER,
  import_editor_common.TOOLBARS.SIDE
];
const getAddButtons = (config, services) => {
  const { exposeEmbedButtons = [] } = config || {};
  const {
    modals,
    context: { isMobile }
  } = services;
  const toggleInsertModal = ({
    id,
    type,
    referenceElement
  }) => {
    modals?.togglePluginPanel({
      id,
      Component: import_insert_modal.InsertModal,
      componentProps: {
        componentData: { type },
        modalId: id
      },
      isMobile,
      positioning: {
        referenceElement,
        placement: "bottom"
      }
    });
  };
  const buttonsMap = {
    event: {
      id: `${import_ricos_types.Node_Type.APP_EMBED}.event`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.EVENTS,
      dataHook: import_data_hooks.INSERT_EVENT_BUTTON,
      icon: import_wix_ui_icons_common.DateChecked,
      tooltip: "EventsPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_constants.verticalEmbedModals.insertEvent,
          type: import_v1.AppEmbedData_AppType.EVENT,
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "Events_plugin_search_tags",
        group: "embed_wix"
      }
    },
    booking: {
      id: `${import_ricos_types.Node_Type.APP_EMBED}.booking`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.BOOKINGS,
      dataHook: import_data_hooks.INSERT_BOOKINGS_BUTTON,
      icon: import_wix_ui_icons_common.WixBooking,
      tooltip: "BookingsPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_constants.verticalEmbedModals.insertBooking,
          type: import_v1.AppEmbedData_AppType.BOOKING,
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "Bookings_plugin_search_tags",
        group: "embed_wix"
      }
    },
    product: {
      id: `${import_ricos_types.Node_Type.APP_EMBED}.product`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.STORES,
      dataHook: import_data_hooks.INSERT_STORES_BUTTON,
      icon: import_wix_ui_icons_common.Order,
      tooltip: "StoresPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_constants.verticalEmbedModals.insertProduct,
          type: import_v1.AppEmbedData_AppType.PRODUCT,
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "Stores_plugin_search_tags",
        group: "embed_wix"
      }
    }
  };
  return exposeEmbedButtons.map((buttonType) => buttonsMap[buttonType]);
};
//# sourceMappingURL=get-add-buttons.js.map
