import { importShared } from './__federation_fn_import-DO0f8H2g.js';
import { j as jsxRuntimeExports } from './jsx-runtime-XI9uIe3W.js';
import { a } from './styles-BM99U_aC.js';
import { T as TRANSACTIONAL_LIB_TYPE, t as transactionalLibDefinitionSchemaEntry } from './transactional-lib-definition-CVLLLsxd.js';

const {createLibraryWebConfig} = await importShared('@baseplate-dev/project-builder-lib');

const {useBlockUnsavedChangesNavigate,useDefinitionSchema,useProjectDefinition,useResettableForm} = await importShared('@baseplate-dev/project-builder-lib/web');

const {Alert,AlertDescription,AlertTitle,FormActionBar,InputFieldController,SectionList,SectionListSection,SectionListSectionContent,SectionListSectionDescription,SectionListSectionHeader,SectionListSectionTitle} = await importShared('@baseplate-dev/ui-components');
function TransactionalLibEditComponent({
  packageDefinition
}) {
  const { saveDefinitionWithFeedback } = useProjectDefinition();
  const transactionalLibSchema = useDefinitionSchema(
    transactionalLibDefinitionSchemaEntry.definitionSchema
  );
  const formProps = useResettableForm({
    resolver: a(
      transactionalLibSchema
    ),
    values: packageDefinition
  });
  const { control, handleSubmit, reset } = formProps;
  const onSubmit = handleSubmit(
    (data) => saveDefinitionWithFeedback((draftConfig) => {
      draftConfig.libraries = draftConfig.libraries.map(
        (lib) => lib.id === packageDefinition.id ? data : lib
      );
    })
  );
  useBlockUnsavedChangesNavigate({ control, reset, onSubmit });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "form",
    {
      className: "email:w-full email:max-w-7xl email:space-y-4 email:px-4",
      onSubmit,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(SectionList, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(SectionListSection, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(SectionListSectionHeader, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(SectionListSectionTitle, { children: "General" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(SectionListSectionDescription, { children: "Basic configuration for your transactional email library." })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(SectionListSectionContent, { className: "email:space-y-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InputFieldController, { label: "Name", control, name: "name" }) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(SectionListSection, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(SectionListSectionHeader, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(SectionListSectionTitle, { children: "Customization" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(SectionListSectionDescription, { children: "How to customize your transactional email library." })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(SectionListSectionContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AlertTitle, { children: "Customize Your Email Theme" }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDescription, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "email:mb-2", children: "After syncing, customize the constants in your transactional library:" }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "email:list-inside email:list-disc email:space-y-1 email:text-sm", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "email:rounded-sm email:bg-muted email:px-1", children: "src/constants/theme.ts" }),
                    " ",
                    "- Colors, typography, and spacing tokens"
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "email:rounded-sm email:bg-muted email:px-1", children: "src/components/layout.tsx" }),
                    " ",
                    "- Email header, footer, and branding"
                  ] })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "email:mt-2 email:text-sm email:text-muted-foreground", children: "These files are generated once and won't be overwritten during future syncs." })
              ] })
            ] }) })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(FormActionBar, { form: formProps })
      ]
    }
  );
}
const transactionalLibWebConfig = createLibraryWebConfig({
  name: transactionalLibDefinitionSchemaEntry.name,
  displayName: "Transactional Email Library",
  EditComponent: TransactionalLibEditComponent,
  createDefinition: ({ id, name }) => ({
    id,
    name,
    type: TRANSACTIONAL_LIB_TYPE
  })
});

const {createPluginModule,libraryTypeSpec} = await importShared('@baseplate-dev/project-builder-lib');
const web = createPluginModule({
  name: "web",
  dependencies: {
    libraryType: libraryTypeSpec
  },
  initialize: ({ libraryType }) => {
    libraryType.webConfigs.add(transactionalLibWebConfig);
  }
});

export { web as default };
//# sourceMappingURL=__federation_expose_emailTransactional-libWeb-CoP5-yh3.js.map
