"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunkwoocommerce_rtm_custom_emails"] = self["webpackChunkwoocommerce_rtm_custom_emails"] || []).push([["assets_src_js_react_routes_EmailSectionsListRoute_tsx"],{

/***/ 82326:
/*!*****************************************************************************!*\
  !*** ./assets/src/js/react/components/EmailSectionsList/styles.module.scss ***!
  \*****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// extracted by mini-css-extract-plugin\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\"chosen\":\"vB7Tojkh8WD83vEb06p0\",\"ghost\":\"BZFBbvhZ7in7aIKyWaFC\"});\n\n//# sourceURL=webpack://woocommerce-rtm-custom-emails/./assets/src/js/react/components/EmailSectionsList/styles.module.scss?");

/***/ }),

/***/ 6811:
/*!******************************************************************!*\
  !*** ./assets/src/js/react/components/EmailSectionAccordion.tsx ***!
  \******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 99196);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _material_tailwind_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material-tailwind/react */ 59335);\n/* harmony import */ var _material_tailwind_react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @fortawesome/react-fontawesome */ 67814);\n/* harmony import */ var _fortawesome_free_solid_svg_icons_faListCheck__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @fortawesome/free-solid-svg-icons/faListCheck */ 80443);\n/* harmony import */ var _fortawesome_free_solid_svg_icons_faHeading__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @fortawesome/free-solid-svg-icons/faHeading */ 68705);\n/* harmony import */ var _fortawesome_free_solid_svg_icons_faTimes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @fortawesome/free-solid-svg-icons/faTimes */ 59545);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ 94184);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _EmailSectionEdit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./EmailSectionEdit */ 23549);\n/* harmony import */ var _fortawesome_free_solid_svg_icons_faCode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @fortawesome/free-solid-svg-icons/faCode */ 75213);\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef(function ({ open: _open, email, section, onSectionChange }, ref) {\n    const [open, setOpen] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(_open ?? false);\n    (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n        const refObj = ref;\n        if (refObj.current) {\n            refObj.current.setOpen = setOpen;\n        }\n    }, [ref]);\n    return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_1__.Accordion, { open: open },\n        react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_1__.AccordionHeader, { className: classnames__WEBPACK_IMPORTED_MODULE_3___default()('text-base xl:text-lg py-3 px-2 anchor', {\n                'text-gray-400': !section.enable,\n            }), title: section.enable ? section.title : 'This section is disabled', onClick: () => setOpen(currentState => !currentState) },\n            section.title,\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: 'text-end flex-grow group flex gap-2 justify-end' },\n                Boolean(section.condition?.length) &&\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__.FontAwesomeIcon, { className: 'text-red-900 group-hover:text-red-700', title: 'This section is conditional', icon: _fortawesome_free_solid_svg_icons_faListCheck__WEBPACK_IMPORTED_MODULE_5__.faListCheck }),\n                section.showTitle &&\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__.FontAwesomeIcon, { title: 'This displays its title', icon: _fortawesome_free_solid_svg_icons_faHeading__WEBPACK_IMPORTED_MODULE_6__.faHeading }),\n                !section.enable &&\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__.FontAwesomeIcon, { icon: _fortawesome_free_solid_svg_icons_faTimes__WEBPACK_IMPORTED_MODULE_7__.faTimes, className: 'text-red-900 group-hover:text-red-700', title: 'This section is disabled' }),\n                section.builtIn &&\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__.FontAwesomeIcon, { icon: _fortawesome_free_solid_svg_icons_faCode__WEBPACK_IMPORTED_MODULE_8__.faCode, title: 'Built-in section' }))),\n        react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_1__.AccordionBody, { className: 'body' }, open && react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_EmailSectionEdit__WEBPACK_IMPORTED_MODULE_4__[\"default\"], { email: email, section: section, onSectionChange: section => onSectionChange(section?.id, section), onDelete: () => onSectionChange(section.id), ref: ref })));\n}));\n\n\n//# sourceURL=webpack://woocommerce-rtm-custom-emails/./assets/src/js/react/components/EmailSectionAccordion.tsx?");

/***/ }),

/***/ 23549:
/*!*************************************************************!*\
  !*** ./assets/src/js/react/components/EmailSectionEdit.tsx ***!
  \*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 99196);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lib_rjsf_SchemaForm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/rjsf/SchemaForm */ 29561);\n/* harmony import */ var js_schema_email_section_schema_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! js/schema/email-section.schema.json */ 93205);\n/* harmony import */ var js_schema_email_section_uiSchema_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! js/schema/email-section.uiSchema.json */ 11530);\n/* harmony import */ var _lib_datafetching_email__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/datafetching/email */ 21954);\n/* harmony import */ var _material_tailwind_react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @material-tailwind/react */ 59335);\n/* harmony import */ var _material_tailwind_react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @fortawesome/react-fontawesome */ 67814);\n/* harmony import */ var _fortawesome_free_solid_svg_icons_faTrash__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @fortawesome/free-solid-svg-icons/faTrash */ 42619);\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function ({ email, section, onSectionChange, onDelete }, ref) {\n    const { data: conditionFunctionSchema } = (0,_lib_datafetching_email__WEBPACK_IMPORTED_MODULE_4__.useConditionFunctions)(email);\n    const memoizedData = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => {\n        return {\n            ...section,\n            condition: conditionFunctionSchema?.type === 'null' ? null : section.condition\n        };\n    }, [section, conditionFunctionSchema]);\n    const memoizedSchema = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => {\n        const newSchema = structuredClone(js_schema_email_section_schema_json__WEBPACK_IMPORTED_MODULE_2__);\n        if (!newSchema.definitions) {\n            newSchema.definitions = {};\n        }\n        if (conditionFunctionSchema) {\n            newSchema.definitions.condition = conditionFunctionSchema;\n        }\n        if (section.builtIn) {\n            delete newSchema.properties.title;\n            delete newSchema.properties.showTitle;\n            delete newSchema.properties.text;\n        }\n        return newSchema;\n    }, [conditionFunctionSchema]);\n    const onChange = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((data) => {\n        const newSection = structuredClone(section);\n        data.formData && Object.assign(newSection, data.formData);\n        if (memoizedSchema.properties?.condition?.type === 'null') {\n            newSection.condition = null;\n        }\n        onSectionChange(newSection);\n    }, [section]);\n    const omitEmptyNonRequiredFields = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((formData, errors) => {\n        if (!formData) {\n            return errors;\n        }\n        Object.keys(formData).forEach((key) => {\n            const value = formData[key];\n            if (value === undefined || value === null || value === '' && memoizedSchema.required?.includes(key) === false) {\n                delete formData[key];\n            }\n        });\n        return errors;\n    }, [memoizedSchema]);\n    return react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null,\n        react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_5__.Card, null,\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: 'absolute w-full flex justify-end' },\n                react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_5__.Button, { color: 'red', className: '!p-2 flex-grow-0 !rounded-l-0', onClick: onDelete, title: 'Delete' },\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_6__.FontAwesomeIcon, { icon: _fortawesome_free_solid_svg_icons_faTrash__WEBPACK_IMPORTED_MODULE_7__.faTrash }))),\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_5__.CardBody, null,\n                react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_lib_rjsf_SchemaForm__WEBPACK_IMPORTED_MODULE_1__[\"default\"], { idPrefix: section.id || 'new', schema: memoizedSchema, customValidate: omitEmptyNonRequiredFields, uiSchema: js_schema_email_section_uiSchema_json__WEBPACK_IMPORTED_MODULE_3__, data: memoizedData, onChange: onChange, ref: ref }))));\n}));\n\n\n//# sourceURL=webpack://woocommerce-rtm-custom-emails/./assets/src/js/react/components/EmailSectionEdit.tsx?");

/***/ }),

/***/ 20632:
/*!********************************************************************!*\
  !*** ./assets/src/js/react/components/EmailSectionsList/index.tsx ***!
  \********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 99196);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _EmailSectionAccordion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../EmailSectionAccordion */ 6811);\n/* harmony import */ var _material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @material-tailwind/react */ 59335);\n/* harmony import */ var _material_tailwind_react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react_sortablejs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-sortablejs */ 16941);\n/* harmony import */ var react_sortablejs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_sortablejs__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _styles_module_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./styles.module.scss */ 82326);\n/* harmony import */ var _lib_actions_email__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../lib/actions/email */ 72926);\n/* harmony import */ var crypto_random_string__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! crypto-random-string */ 64545);\n/* harmony import */ var _lib_objectMod__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../lib/objectMod */ 86560);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-dom */ 91850);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react-select */ 23157);\n/* harmony import */ var _lib_datafetching_email__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! js/react/lib/datafetching/email */ 21954);\n/* harmony import */ var js_convert_case__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! js-convert-case */ 24417);\n/* harmony import */ var deep_object_diff__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! deep-object-diff */ 47295);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst toast = window.toast;\nfunction cleanupSection(section) {\n    return { ...(0,_lib_objectMod__WEBPACK_IMPORTED_MODULE_7__.omit)(section, 'chosen', 'ghost', 'selected', 'filtered'), text: section.text.trim() };\n}\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__({ email, onEmailUpdated, onEmailChanged }) {\n    const [sections, setSections] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(email.sections);\n    const [hasChanges, setHasChanges] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(false);\n    const [builtInSectionModalOpen, setBuiltInSectionModalOpen] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(false);\n    const { data: builtInSections, isLoading: isLoadingBuiltInSections } = (0,_lib_datafetching_email__WEBPACK_IMPORTED_MODULE_9__.useBuiltInSections)();\n    const [selectedBuiltInSection, setSelectedBuiltInSection] = react__WEBPACK_IMPORTED_MODULE_0___default().useState();\n    const [savingSections, setSavingSections] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(false);\n    const { isLoading: isLoadingConditions, isValidating: isValidatingConditions } = (0,_lib_datafetching_email__WEBPACK_IMPORTED_MODULE_9__.useConditionFunctions)(email);\n    const [toastId, setToastId] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(null);\n    const memoizedIsLoadingConditions = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => isLoadingConditions || isValidatingConditions, [isLoadingConditions, isValidatingConditions]);\n    const revalidateEmails = (0,_lib_datafetching_email__WEBPACK_IMPORTED_MODULE_9__.useEmailsMutate)();\n    (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n        if (!toast) {\n            return;\n        }\n        if (!Boolean(toastId) && memoizedIsLoadingConditions) {\n            setToastId(toast.loading('Loading conditions...', { duration: Infinity }));\n        }\n        else if (toastId && !memoizedIsLoadingConditions) {\n            toast.dismiss();\n            setToastId(null);\n        }\n    }, [memoizedIsLoadingConditions, toastId]);\n    const sectionRefs = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => sections\n        .reduce((carry, section) => ({\n        ...carry,\n        [section.id]: react__WEBPACK_IMPORTED_MODULE_0___default().createRef()\n    }), {}), [sections]);\n    const onSectionChange = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, section) => {\n        const newSections = structuredClone(sections);\n        const index = newSections.findIndex((s) => s.id === id);\n        if (index !== -1) {\n            if (!section) {\n                newSections.splice(index, 1);\n            }\n            else {\n                newSections[index] = section;\n            }\n        }\n        else if (section !== undefined) {\n            newSections.push(section);\n        }\n        let cleanAndOrderedSections = newSections.map((section, index) => ({\n            ...cleanupSection(section),\n            sortOrder: index\n        }));\n        setSections(cleanAndOrderedSections);\n    }, [sections]);\n    const onSaveSections = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(() => {\n        setSavingSections(true);\n        const invalidSectionEntries = Object.entries(sectionRefs).filter(([_, ref]) => {\n            return !(ref.current?.validateForm() ?? true);\n        });\n        if (Boolean(invalidSectionEntries.length)) {\n            toast.error('One or more sections are invalid. Please fix them before saving.');\n            setSavingSections(false);\n            invalidSectionEntries.forEach(([_, ref]) => {\n                ref.current?.setOpen(true);\n            });\n            return;\n        }\n        (0,_lib_actions_email__WEBPACK_IMPORTED_MODULE_5__.saveEmail)({ ...email, sections })\n            .catch((error) => {\n            toast.error('Error saving email sections: ' + error.message);\n        })\n            .then((email) => {\n            toast.success('Email sections saved', { duration: 3000 });\n            onEmailUpdated({ ...email, sections: sections.map(cleanupSection) });\n            setSections(email.sections);\n        })\n            .finally(() => {\n            setSavingSections(false);\n            revalidateEmails();\n        });\n    }, [email, sections]);\n    const addSection = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((section = undefined) => {\n        let id = (0,crypto_random_string__WEBPACK_IMPORTED_MODULE_6__[\"default\"])({ length: 10, type: 'url-safe' });\n        let newSection = {\n            id: id,\n            title: 'New section',\n            text: '',\n            enable: true,\n            showTitle: false,\n            sortOrder: 0,\n            condition: [],\n            builtIn: false,\n            ...(section ?? {})\n        };\n        onSectionChange(id, newSection);\n        setBuiltInSectionModalOpen(false);\n    }, [sections]);\n    const setList = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((newSections) => {\n        let cleanedAndOrderedSections = newSections.map((section, index) => ({\n            ...cleanupSection(section),\n            sortOrder: index\n        }));\n        setSections(cleanedAndOrderedSections);\n    }, [sections]);\n    (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n        if (sections) {\n            const cleanSections = sections.map(cleanupSection);\n            onEmailChanged({ ...email, sections: cleanSections });\n            let changes = (0,deep_object_diff__WEBPACK_IMPORTED_MODULE_11__.diff)(email.sections.map(cleanupSection), cleanSections);\n            setHasChanges(Boolean(Object.keys(changes).length));\n        }\n    }, [sections]);\n    return react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null,\n        react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.ButtonGroup, { size: 'sm', color: 'white', fullWidth: true },\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.Button, { type: 'button', onClick: () => setBuiltInSectionModalOpen(prev => !prev) }, \"Add Template Section\"),\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.Button, { color: 'blue-gray', type: 'button', onClick: () => addSection() }, \"Add section\"),\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.Button, { color: 'blue-gray', type: 'button', disabled: !hasChanges || savingSections, onClick: onSaveSections }, savingSections ?\n                react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", { className: 'inline-flex' },\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.Spinner, { className: 'w-4 h-4 pr-1' }),\n                    \"Saving...\") : 'Save')),\n        react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_sortablejs__WEBPACK_IMPORTED_MODULE_3__.ReactSortable, { list: sections, setList: setList, ghostClass: _styles_module_scss__WEBPACK_IMPORTED_MODULE_4__[\"default\"].ghost, chosenClass: _styles_module_scss__WEBPACK_IMPORTED_MODULE_4__[\"default\"].chosen, animation: 150, delay: 50, handle: '.anchor' }, sections.map((section) => react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_EmailSectionAccordion__WEBPACK_IMPORTED_MODULE_1__[\"default\"], { key: email.id + '-' + section.id, email: email, section: section, onSectionChange: onSectionChange, ref: sectionRefs[section.id] }))),\n        (0,react_dom__WEBPACK_IMPORTED_MODULE_8__.createPortal)(react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.Dialog, { open: builtInSectionModalOpen, animate: {\n                unmount: {},\n                mount: {}\n            }, handler: setBuiltInSectionModalOpen },\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.DialogBody, null,\n                react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_select__WEBPACK_IMPORTED_MODULE_12__[\"default\"], { options: builtInSections\n                        ?.filter(s => !sections.find(section => section.id === s))\n                        ?.map((section) => ({ value: section, label: (0,js_convert_case__WEBPACK_IMPORTED_MODULE_10__.toSentenceCase)(section) })), isLoading: isLoadingBuiltInSections, isMulti: false, onChange: (option) => {\n                        setSelectedBuiltInSection(builtInSections?.find((section) => section === option?.value));\n                    } })),\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.DialogFooter, null,\n                react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.ButtonGroup, null,\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.Button, { color: 'red', onClick: () => setBuiltInSectionModalOpen(false) }, \"Cancel\"),\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_material_tailwind_react__WEBPACK_IMPORTED_MODULE_2__.Button, { color: 'green', onClick: () => addSection({\n                            id: selectedBuiltInSection,\n                            title: (0,js_convert_case__WEBPACK_IMPORTED_MODULE_10__.toSentenceCase)(selectedBuiltInSection),\n                            builtIn: true\n                        }) }, \"Add\")))), document.body));\n}\n\n\n//# sourceURL=webpack://woocommerce-rtm-custom-emails/./assets/src/js/react/components/EmailSectionsList/index.tsx?");

/***/ }),

/***/ 12254:
/*!***************************************************************!*\
  !*** ./assets/src/js/react/routes/EmailSectionsListRoute.tsx ***!
  \***************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 99196);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-router */ 89250);\n/* harmony import */ var _components_EmailSectionsList__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/EmailSectionsList */ 20632);\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n    const ctx = (0,react_router__WEBPACK_IMPORTED_MODULE_2__.useOutletContext)();\n    const onUpdated = () => { };\n    return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_EmailSectionsList__WEBPACK_IMPORTED_MODULE_1__[\"default\"], { key: ctx.email.id, email: ctx.email, onEmailChanged: onUpdated, onEmailUpdated: onUpdated });\n}\n\n\n//# sourceURL=webpack://woocommerce-rtm-custom-emails/./assets/src/js/react/routes/EmailSectionsListRoute.tsx?");

/***/ }),

/***/ 93205:
/*!********************************************************!*\
  !*** ./assets/src/js/schema/email-section.schema.json ***!
  \********************************************************/
/***/ ((module) => {

eval("module.exports = JSON.parse('{\"title\":\"Email Section\",\"type\":\"object\",\"properties\":{\"title\":{\"title\":\"Title\",\"type\":\"string\"},\"enable\":{\"title\":\"Enable Section\",\"type\":\"boolean\"},\"showTitle\":{\"title\":\"Show Title\",\"type\":\"boolean\"},\"text\":{\"title\":\"Text\",\"type\":\"string\"},\"condition\":{\"title\":\"Condition\",\"$ref\":\"#/definitions/condition\"}},\"definitions\":{\"condition\":{\"type\":\"null\"}}}');\n\n//# sourceURL=webpack://woocommerce-rtm-custom-emails/./assets/src/js/schema/email-section.schema.json?");

/***/ }),

/***/ 11530:
/*!**********************************************************!*\
  !*** ./assets/src/js/schema/email-section.uiSchema.json ***!
  \**********************************************************/
/***/ ((module) => {

eval("module.exports = JSON.parse('{\"ui:options\":{\"fieldsetProperties\":{\"className\":\"form-grid grid-cols-2\"},\"submitButtonOptions\":{\"norender\":true}},\"title\":{\"classNames\":\"col-span-full\"},\"text\":{\"classNames\":\"col-span-full\",\"ui:widget\":\"RichTextWidget\"},\"enable\":{\"classNames\":\"col-span-1\"},\"showTitle\":{\"classNames\":\"col-span-1\"},\"condition\":{\"classNames\":\"col-span-full\",\"items\":{\"hideLabel\":true,\"function\":{\"title\":\"Function\"},\"arguments\":{\"hideLabel\":true}}}}');\n\n//# sourceURL=webpack://woocommerce-rtm-custom-emails/./assets/src/js/schema/email-section.uiSchema.json?");

/***/ })

}]);