@servicetitan/dte-unlayer 0.145.0 → 0.146.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tools.ts"],"sourcesContent":["import { constGenericsEditor, UnlayerToolMetaData } from './shared/const';\nimport { editIconSvg } from './shared/edit-icon';\nimport { unlayerToolsParseUnitKey } from './shared/tools';\nimport { versions } from './unlayer';\n\nimport {\n UnlayerDesignCustomTool,\n UnlayerDesignFormat,\n UnlayerDesignTool,\n UnlayerEditorCustomTool,\n} from './unlayer-interface';\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const unlayerGetDefaultDesign = (): UnlayerDesignFormat => ({\n counters: {\n u_column: 1,\n u_row: 1,\n u_content_custom_generic_list_of_fields: 1,\n },\n body: {\n rows: [\n {\n cells: [1],\n columns: [\n {\n contents: [],\n values: {\n backgroundColor: '',\n padding: '0px',\n border: {},\n _meta: {\n htmlID: 'u_column_1',\n htmlClassNames: 'u_column',\n },\n },\n },\n ],\n values: {\n displayCondition: null,\n columns: false,\n backgroundColor: '',\n columnsBackgroundColor: '',\n backgroundImage: {\n url: '',\n fullWidth: true,\n repeat: false,\n center: true,\n cover: false,\n },\n padding: '0px',\n hideDesktop: false,\n hideMobile: false,\n noStackMobile: false,\n _meta: {\n htmlID: 'u_row_1',\n htmlClassNames: 'u_row',\n },\n selectable: true,\n draggable: true,\n duplicatable: true,\n deletable: true,\n },\n },\n ],\n values: {\n backgroundColor: 'rgba(0,0,0,0)',\n backgroundImage: {\n url: '',\n fullWidth: true,\n repeat: false,\n center: true,\n cover: false,\n },\n contentWidth: '100%',\n contentAlign: 'center',\n fontFamily: {\n label: 'Arial',\n value: 'arial,helvetica,sans-serif',\n },\n preheaderText: '',\n linkStyle: {\n body: true,\n linkColor: '#0000ee',\n linkHoverColor: '#0000ee',\n linkUnderline: true,\n linkHoverUnderline: true,\n },\n _meta: {\n htmlID: 'u_body',\n htmlClassNames: 'u_body',\n },\n },\n },\n schemaVersion: versions.schema,\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport const unlayerToolsIterate = (\n design: UnlayerDesignFormat,\n cb: (tool: UnlayerDesignTool) => boolean | undefined | void\n) => {\n for (const row of design?.body?.rows ?? []) {\n for (const column of row.columns) {\n for (const content of column.contents) {\n if (cb(content) === false) {\n return;\n }\n }\n }\n }\n};\n\nexport const unlayerToolsIterateCustom = (\n design: UnlayerDesignFormat,\n cb: (tool: UnlayerDesignCustomTool) => boolean | undefined | void\n) => {\n unlayerToolsIterate(design, tool => {\n if (tool.type === 'custom' && tool.slug) {\n return cb(tool as any);\n }\n });\n};\n\nexport const unlayerToolsListCustomKeys = (design: UnlayerDesignFormat): string[] => {\n return Array.from(new Set(unlayerToolsListCustom(design).map(tool => tool.slug)));\n};\n\nexport const unlayerToolsFind = (\n design: UnlayerDesignFormat,\n cb: (tool: UnlayerDesignTool) => boolean | void\n): UnlayerDesignTool | undefined => {\n let out: UnlayerDesignTool | undefined;\n\n unlayerToolsIterate(design, tool => {\n if (cb(tool)) {\n out = tool;\n return false;\n }\n });\n\n return out;\n};\n\nexport interface UnlayerCustomToolsStat {\n counters: Record<string, number>;\n missing: string[];\n notSupported: string[];\n}\n\nexport const unlayerToolsCustomStat = (\n design: UnlayerDesignFormat,\n tools?: { key: string; isRequired?: boolean }[],\n units?: { id: string; generic: string; isRequired?: boolean }[]\n): UnlayerCustomToolsStat => {\n const counters: Record<string, number> = {};\n const notSupported = new Set<string>();\n const unitIDs = new Set<string>();\n\n unlayerToolsIterateCustom(design, tool => {\n if (!counters[tool.slug]) {\n counters[tool.slug] = 0;\n }\n\n counters[tool.slug]++;\n\n const isUnit = unlayerToolsParseUnitKey(tool.slug);\n\n if (isUnit) {\n unitIDs.add(isUnit.id);\n }\n\n if (\n (isUnit && !units?.some(unit => unit.id === isUnit.id)) ??\n (!isUnit && !tools?.some(t => t.key === tool.slug))\n ) {\n notSupported.add(tool.slug);\n }\n });\n\n return {\n counters,\n notSupported: Array.from(notSupported),\n\n missing: [\n ...(tools\n ?.filter(tool => tool.isRequired && !counters[tool.key])\n .map(tool => tool.key) ?? []),\n ...(units\n ?.filter(unit => unit.isRequired && !unitIDs.has(unit.id))\n .map(unit => unit.id) ?? []),\n ],\n };\n};\n\nexport const unlayerToolsListCustom = (design: UnlayerDesignFormat): UnlayerDesignCustomTool[] => {\n const tools: UnlayerDesignCustomTool[] = [];\n\n unlayerToolsIterateCustom(design, tool => {\n tools.push(tool);\n });\n\n return tools;\n};\n\nexport const unlayerToolsBuildDesign = (tools: UnlayerDesignTool[]): UnlayerDesignFormat => {\n const design = unlayerGetDefaultDesign();\n\n design.body.rows[0].columns[0].contents = tools;\n return design;\n};\n\nexport const unlayerUnitsGetIdFromValues = (values?: any): string | undefined =>\n values?.[constGenericsEditor.adminConfigProperty]?.crossId;\nexport const unlayerUnitsGetTitleFromValues = (values?: any): string | undefined =>\n values?.[constGenericsEditor.adminConfigProperty]?.title;\n\nexport const unlayerUnitsGetId = (tool: UnlayerDesignTool): string | undefined =>\n unlayerUnitsGetIdFromValues(tool.values);\nexport const unlayerUnitsGetTitle = (tool: UnlayerDesignTool): string | undefined =>\n unlayerUnitsGetTitleFromValues(tool.values);\n\nexport const unlayerCustomToolsGetRegisterUrls = (tools: UnlayerEditorCustomTool[]): string[] =>\n Array.from(\n new Set(tools.map(tool => (tool.groupUrl ? `${tool.groupUrl}/index.js` : tool.url)))\n );\n\nexport const unlayerCustomToolMetaData = (tools: UnlayerEditorCustomTool[]): string => {\n const toolMetaData = tools.reduce((acc: Record<string, UnlayerToolMetaData>, tool) => {\n acc[tool.title] = {\n key: tool.key,\n description: tool.description,\n };\n return acc;\n }, {});\n\n return `\n window.dteStore.setToolMetaData(${JSON.stringify(toolMetaData)});\n `;\n};\n\nexport const unlayerCustomEmptyToolState = (): string => {\n const divElement = document.createElement('div');\n const editIconContainer = document.createElement('div');\n const textContainer = document.createElement('div');\n\n divElement.classList.add('unlayer-custom-empty-tool-state');\n editIconContainer.classList.add('unlayer-custom-empty-tool-state-icon');\n textContainer.classList.add('unlayer-custom-empty-tool-state-text');\n\n editIconContainer.innerHTML = editIconSvg;\n textContainer.innerText = 'Please choose \\n\\r your component';\n divElement.appendChild(editIconContainer);\n divElement.appendChild(textContainer);\n return `\n document.querySelector('.tab-content .tab-pane').innerHTML = \\`${divElement.outerHTML}\\`;\n `;\n};\n"],"names":["constGenericsEditor","editIconSvg","unlayerToolsParseUnitKey","versions","unlayerGetDefaultDesign","counters","u_column","u_row","u_content_custom_generic_list_of_fields","body","rows","cells","columns","contents","values","backgroundColor","padding","border","_meta","htmlID","htmlClassNames","displayCondition","columnsBackgroundColor","backgroundImage","url","fullWidth","repeat","center","cover","hideDesktop","hideMobile","noStackMobile","selectable","draggable","duplicatable","deletable","contentWidth","contentAlign","fontFamily","label","value","preheaderText","linkStyle","linkColor","linkHoverColor","linkUnderline","linkHoverUnderline","schemaVersion","schema","unlayerToolsIterate","design","cb","row","column","content","unlayerToolsIterateCustom","tool","type","slug","unlayerToolsListCustomKeys","Array","from","Set","unlayerToolsListCustom","map","unlayerToolsFind","out","unlayerToolsCustomStat","tools","units","notSupported","unitIDs","isUnit","add","id","some","unit","t","key","missing","filter","isRequired","has","push","unlayerToolsBuildDesign","unlayerUnitsGetIdFromValues","adminConfigProperty","crossId","unlayerUnitsGetTitleFromValues","title","unlayerUnitsGetId","unlayerUnitsGetTitle","unlayerCustomToolsGetRegisterUrls","groupUrl","unlayerCustomToolMetaData","toolMetaData","reduce","acc","description","JSON","stringify","unlayerCustomEmptyToolState","divElement","document","createElement","editIconContainer","textContainer","classList","innerHTML","innerText","appendChild","outerHTML"],"mappings":"AAAA,SAASA,mBAAmB,QAA6B,iBAAiB;AAC1E,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1D,SAASC,QAAQ,QAAQ,YAAY;AASrC,uDA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AG;IAC1BP,WAAWQ,WAAW,CAACL;IACvBH,WAAWQ,WAAW,CAACJ;IACvB,OAAO,CAAC;uEAC2D,EAAEJ,WAAWS,SAAS,CAAC;IAC1F,CAAC;AACL,EAAE"}
1
+ {"version":3,"sources":["../src/tools.ts"],"sourcesContent":["import { constGenericsEditor, UnlayerToolMetaData } from './shared/const';\nimport { editIconSvg } from './shared/edit-icon';\nimport { unlayerToolsParseUnitKey } from './shared/tools';\nimport { versions } from './unlayer';\n\nimport {\n UnlayerDesignCustomTool,\n UnlayerDesignFormat,\n UnlayerDesignTool,\n UnlayerEditorCustomTool,\n} from './unlayer-interface';\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const unlayerGetDefaultDesign = (): UnlayerDesignFormat => ({\n counters: {\n u_column: 1,\n u_row: 1,\n u_content_custom_generic_list_of_fields: 1,\n },\n body: {\n rows: [\n {\n cells: [1],\n columns: [\n {\n contents: [],\n values: {\n backgroundColor: '',\n padding: '0px',\n border: {},\n _meta: {\n htmlID: 'u_column_1',\n htmlClassNames: 'u_column',\n },\n },\n },\n ],\n values: {\n displayCondition: null,\n columns: false,\n backgroundColor: '',\n columnsBackgroundColor: '',\n backgroundImage: {\n url: '',\n fullWidth: true,\n repeat: false,\n center: true,\n cover: false,\n },\n padding: '0px',\n hideDesktop: false,\n hideMobile: false,\n noStackMobile: false,\n _meta: {\n htmlID: 'u_row_1',\n htmlClassNames: 'u_row',\n },\n selectable: true,\n draggable: true,\n duplicatable: true,\n deletable: true,\n },\n },\n ],\n values: {\n backgroundColor: 'rgba(0,0,0,0)',\n backgroundImage: {\n url: '',\n fullWidth: true,\n repeat: false,\n center: true,\n cover: false,\n },\n contentWidth: '100%',\n contentAlign: 'center',\n fontFamily: {\n label: 'Arial',\n value: 'arial,helvetica,sans-serif',\n },\n preheaderText: '',\n linkStyle: {\n body: true,\n linkColor: '#0000ee',\n linkHoverColor: '#0000ee',\n linkUnderline: true,\n linkHoverUnderline: true,\n },\n _meta: {\n htmlID: 'u_body',\n htmlClassNames: 'u_body',\n },\n },\n },\n schemaVersion: versions.schema,\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport const unlayerToolsIterate = (\n design: UnlayerDesignFormat,\n cb: (tool: UnlayerDesignTool) => boolean | undefined | void\n) => {\n for (const row of design?.body?.rows ?? []) {\n for (const column of row.columns) {\n for (const content of column.contents) {\n if (cb(content) === false) {\n return;\n }\n }\n }\n }\n};\n\nexport const unlayerToolsIterateCustom = (\n design: UnlayerDesignFormat,\n cb: (tool: UnlayerDesignCustomTool) => boolean | undefined | void\n) => {\n unlayerToolsIterate(design, tool => {\n if (tool.type === 'custom' && tool.slug) {\n return cb(tool as any);\n }\n });\n};\n\nexport const unlayerToolsListCustomKeys = (design: UnlayerDesignFormat): string[] => {\n return Array.from(new Set(unlayerToolsListCustom(design).map(tool => tool.slug)));\n};\n\nexport const unlayerToolsFind = (\n design: UnlayerDesignFormat,\n cb: (tool: UnlayerDesignTool) => boolean | void\n): UnlayerDesignTool | undefined => {\n let out: UnlayerDesignTool | undefined;\n\n unlayerToolsIterate(design, tool => {\n if (cb(tool)) {\n out = tool;\n return false;\n }\n });\n\n return out;\n};\n\nexport interface UnlayerCustomToolsStat {\n counters: Record<string, number>;\n missing: string[];\n notSupported: string[];\n}\n\nexport const unlayerToolsCustomStat = (\n design: UnlayerDesignFormat,\n tools?: { key: string; isRequired?: boolean }[],\n units?: { id: string; generic: string; isRequired?: boolean }[]\n): UnlayerCustomToolsStat => {\n const counters: Record<string, number> = {};\n const notSupported = new Set<string>();\n const unitIDs = new Set<string>();\n\n unlayerToolsIterateCustom(design, tool => {\n if (!counters[tool.slug]) {\n counters[tool.slug] = 0;\n }\n\n counters[tool.slug]++;\n\n const isUnit = unlayerToolsParseUnitKey(tool.slug);\n\n if (isUnit) {\n unitIDs.add(isUnit.id);\n }\n\n if (\n (isUnit && !units?.some(unit => unit.id === isUnit.id)) ??\n (!isUnit && !tools?.some(t => t.key === tool.slug))\n ) {\n notSupported.add(tool.slug);\n }\n });\n\n return {\n counters,\n notSupported: Array.from(notSupported),\n\n missing: [\n ...(tools\n ?.filter(tool => tool.isRequired && !counters[tool.key])\n .map(tool => tool.key) ?? []),\n ...(units\n ?.filter(unit => unit.isRequired && !unitIDs.has(unit.id))\n .map(unit => unit.id) ?? []),\n ],\n };\n};\n\nexport const unlayerToolsListCustom = (design: UnlayerDesignFormat): UnlayerDesignCustomTool[] => {\n const tools: UnlayerDesignCustomTool[] = [];\n\n unlayerToolsIterateCustom(design, tool => {\n tools.push(tool);\n });\n\n return tools;\n};\n\nexport const unlayerToolsBuildDesign = (tools: UnlayerDesignTool[]): UnlayerDesignFormat => {\n const design = unlayerGetDefaultDesign();\n\n design.body.rows[0].columns[0].contents = tools;\n return design;\n};\n\nexport const unlayerUnitsGetIdFromValues = (values?: any): string | undefined =>\n values?.[constGenericsEditor.adminConfigProperty]?.crossId;\nexport const unlayerUnitsGetTitleFromValues = (values?: any): string | undefined =>\n values?.[constGenericsEditor.adminConfigProperty]?.title;\n\nexport const unlayerUnitsGetId = (tool: UnlayerDesignTool): string | undefined =>\n unlayerUnitsGetIdFromValues(tool.values);\nexport const unlayerUnitsGetTitle = (tool: UnlayerDesignTool): string | undefined =>\n unlayerUnitsGetTitleFromValues(tool.values);\n\nexport const unlayerCustomToolsGetRegisterUrls = (tools: UnlayerEditorCustomTool[]): string[] =>\n Array.from(\n new Set(tools.map(tool => (tool.groupUrl ? `${tool.groupUrl}/index.js` : tool.url)))\n );\n\nexport const unlayerCustomToolMetaData = (tools: UnlayerEditorCustomTool[]): string => {\n const toolMetaData = tools.reduce((acc: Record<string, UnlayerToolMetaData>, tool) => {\n acc[tool.title] = {\n key: tool.key,\n description: tool.description,\n };\n return acc;\n }, {});\n\n return `\n window.dteStore.setToolMetaData(${JSON.stringify(toolMetaData)});\n `;\n};\n\nexport const unlayerCustomEmptyToolState = (): string => {\n const divElement = document.createElement('div');\n const editIconContainer = document.createElement('div');\n const textContainer = document.createElement('div');\n\n divElement.classList.add('unlayer-custom-empty-tool-state');\n editIconContainer.classList.add('unlayer-custom-empty-tool-state-icon');\n textContainer.classList.add('unlayer-custom-empty-tool-state-text');\n\n editIconContainer.innerHTML = editIconSvg;\n textContainer.innerText = 'Please choose \\n\\r your component';\n divElement.appendChild(editIconContainer);\n divElement.appendChild(textContainer);\n return `\n document.querySelector('.tab-content .tab-pane').innerHTML = \\`${divElement.outerHTML}\\`;\n `;\n};\n"],"names":["constGenericsEditor","editIconSvg","unlayerToolsParseUnitKey","versions","unlayerGetDefaultDesign","counters","u_column","u_row","u_content_custom_generic_list_of_fields","body","rows","cells","columns","contents","values","backgroundColor","padding","border","_meta","htmlID","htmlClassNames","displayCondition","columnsBackgroundColor","backgroundImage","url","fullWidth","repeat","center","cover","hideDesktop","hideMobile","noStackMobile","selectable","draggable","duplicatable","deletable","contentWidth","contentAlign","fontFamily","label","value","preheaderText","linkStyle","linkColor","linkHoverColor","linkUnderline","linkHoverUnderline","schemaVersion","schema","unlayerToolsIterate","design","cb","row","column","content","unlayerToolsIterateCustom","tool","type","slug","unlayerToolsListCustomKeys","Array","from","Set","unlayerToolsListCustom","map","unlayerToolsFind","out","unlayerToolsCustomStat","tools","units","notSupported","unitIDs","isUnit","add","id","some","unit","t","key","missing","filter","isRequired","has","push","unlayerToolsBuildDesign","unlayerUnitsGetIdFromValues","adminConfigProperty","crossId","unlayerUnitsGetTitleFromValues","title","unlayerUnitsGetId","unlayerUnitsGetTitle","unlayerCustomToolsGetRegisterUrls","groupUrl","unlayerCustomToolMetaData","toolMetaData","reduce","acc","description","JSON","stringify","unlayerCustomEmptyToolState","divElement","document","createElement","editIconContainer","textContainer","classList","innerHTML","innerText","appendChild","outerHTML"],"mappings":"AAAA,SAASA,mBAAmB,QAA6B,iBAAiB;AAC1E,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1D,SAASC,QAAQ,QAAQ,YAAY;AASrC,uDAAuD,GACvD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,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/unlayer.tsx"],"sourcesContent":["import { emitDisplayCondition } from './display-conditions/displayConditionController';\nimport { editorCoreScript, editorCoreStyles, editorCoreTools } from './editor-core';\nimport { constGenericsEditor } from './shared/const';\nimport { unlayerSupportedFonts } from './shared/fonts';\nimport {\n unlayerCustomEmptyToolState,\n unlayerCustomToolMetaData,\n unlayerCustomToolsGetRegisterUrls,\n} from './tools';\nimport { CreateUnlayerEditorProps } from './unlayer-interface';\n\nexport interface UnlayerExport {\n html: string;\n chunks: any;\n design: any;\n demoData?: Record<string, unknown>;\n}\n\nexport interface Unlayer {\n addEventListener(event: string, cb: (arg: any) => void): void;\n removeEventListener(event: string, cb: (arg: any) => void): void;\n registerCallback(type: string, cb: (...args: any[]) => void): void;\n unregisterCallback(type: string, cb: (...args: any[]) => void): void;\n registerProvider(type: string, cb: (...args: any[]) => void): void;\n unregisterProvider(type: string, cb: (...args: any[]) => void): void;\n loadDesign(design: any): void;\n saveDesign(callback: (design: any) => void): void;\n exportHtml(callback: (data: UnlayerExport) => void): void;\n setMergeTags(tags: any): void;\n createViewer(opts: { render: (values: any) => string }): any;\n registerTool(tool: any): void;\n setBodyValues(values: any): void;\n}\n\nexport enum DesignUpdatedEventType {\n ContentAdded = 'content:added',\n ContentMoved = 'content:moved',\n ContentRemoved = 'content:removed',\n ContentModified = 'content:modified',\n RowAdded = 'row:added',\n RowMoved = 'row:moved',\n RowRemoved = 'row:removed',\n RowModified = 'row:modified',\n ColumnAdded = 'column:added',\n ColumnRemoved = 'column:removed',\n ColumnModified = 'column:modified',\n BodyModified = 'body:modified',\n}\n\nexport interface EventDesignUpdated {\n type: DesignUpdatedEventType;\n item: {\n type: string;\n slug?: string;\n values: any;\n };\n}\n\n/**\n * !!! IMPORTANT !!!\n * do not forget to update schema version when updating unlayer version\n * it is important for templates export and should be in sync\n * to know correct schema version, open unlayer editor and check output design ('schema' property)\n */\nexport const versions = {\n unlayer: '1.421.0',\n schema: 24,\n};\n\nexport const handlePreselectTool = (preselectToolSlug: string) => {\n return `\n const element = document.querySelector('.u_content_custom_${preselectToolSlug}');\n if (element) {\n element.click();\n }\n `;\n};\n\nexport const hideUnlayerContentsControls = () => {\n return `\n .blockbuilder-layer-controls-contents, .blockbuilder-layer-controls-rows {\n display: none !important;\n }\n\n .blockbuilder-options-header .text-right .icon-delete, .blockbuilder-options-header .text-right .icon-duplicate {\n display: none !important;\n }\n `;\n};\n\nexport const hideUnlayerBodyMenuItem = () => {\n return `\n .nav-item.tab-body {\n display: none !important;\n }\n `;\n};\n\nconst injectEditorCoreStyles = () => {\n const cssText = editorCoreStyles?.trim();\n\n if (!cssText) {\n return '';\n }\n\n return `\n (function () {\n var css = ${JSON.stringify(cssText)};\n var id = 'dte-unlayer-core-styles';\n if (document.getElementById(id)) {\n return;\n }\n var style = document.createElement('style');\n style.id = id;\n style.type = 'text/css';\n style.appendChild(document.createTextNode(css));\n document.head.appendChild(style);\n })();\n `;\n};\n\nexport const hideMobileTabletPreview = () => `\n [data-key=\"preview-tablet\"],\n [data-key=\"resolution\"],\n [data-key=\"dark-mode\"],\n [data-key=\"preview-desktop\"],\n [data-key=\"preview-mobile\"] {\n display: none !important;\n }\n`;\nexport const hideUnlayerTools = () => {\n return `\n .blockbuilder-content-tools {\n display: none !important;\n }\n \n .unlayer-custom-empty-tool-state {\n display: flex;\n margin-top: 150px;\n flex-direction: column;\n justify-content: center;\n }\n \n .unlayer-custom-empty-tool-state-icon {\n text-align: center;\n margin-bottom: 12px;\n }\n \n .unlayer-custom-empty-tool-state-icon svg{\n color: #606162;\n }\n \n .unlayer-custom-empty-tool-state-text {\n text-align: center;\n font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: normal;\n color: #606162;\n line-height: 13px;\n }\n `;\n};\n\nexport const createUnlayerEditor = (\n container: HTMLDivElement,\n {\n customCSS,\n customJS,\n displayConditions,\n eSignFieldTypes,\n eSignRecipients,\n enableHTMLEditing,\n enableHTMLEditingReadonly,\n hideAllTools,\n hideBodyMenuItem,\n hideContentControls,\n latest,\n mergeTags,\n noCoreTools,\n tools,\n units,\n }: CreateUnlayerEditorProps,\n): Unlayer => {\n const customScripts = [\n editorCoreScript,\n editorCoreTools,\n injectEditorCoreStyles(),\n 'window.dteStore.sendData(\"--core-loaded\")',\n ...unlayerCustomToolsGetRegisterUrls(tools),\n unlayerCustomToolMetaData(tools),\n ...(customJS ? (Array.isArray(customJS) ? customJS : [customJS]) : []),\n hideAllTools ? unlayerCustomEmptyToolState() : '',\n 'window.dteStore.sendData(\"--data-loaded\")',\n ].filter(js => !!js?.trim());\n const customStyles = [\n editorCoreStyles,\n ...(customCSS ? (Array.isArray(customCSS) ? customCSS : [customCSS]) : []),\n /*\n * @TODO this is workaround for hiding all tools from unlayer sidebar.\n * Will be better to use unlayer functionality for this but it is not implemented yet\n */\n hideMobileTabletPreview(),\n hideAllTools ? hideUnlayerTools() : '',\n hideContentControls ? hideUnlayerContentsControls() : '',\n hideBodyMenuItem ? hideUnlayerBodyMenuItem() : '',\n ].filter(css => !!css?.trim());\n\n /**\n * Unlayer supports only passing id of container, but when we use shadowDOM (MFE),\n * getElementById can't find element in it\n * so making this dirty hack to let unlayer find container in DOM\n */\n const id = container.id;\n const currentFind = document.getElementById;\n document.getElementById = function (elementId: string) {\n if (id === elementId) {\n return container;\n }\n\n return currentFind.call(document, id);\n };\n\n const acv = constGenericsEditor.adminConfigProperty;\n\n const eSignTypeMapping = (eSignFieldTypes ?? []).map(key => ({\n label: key,\n value: key.charAt(0).toLowerCase() + key.replace(/ /g, '').slice(1),\n }));\n\n const unitsConfig = (units ?? []).reduce(\n (out, unit) => {\n out[`custom#${unit.generic}:unit:${unit.id}`] = {\n data: {\n [acv]: unit.values[acv],\n },\n properties: {\n [constGenericsEditor.userConfigProperty]: {\n editor: {\n data: { [acv]: unit.values[acv] },\n },\n },\n [constGenericsEditor.infoDataProperty]: {\n editor: {\n data: { title: unit.title },\n },\n },\n },\n };\n return out;\n },\n {} as Record<string, any>,\n );\n\n const eSignComponentRecipients = {\n properties: {\n eSignRecipient: {\n editor: {\n data: {\n options: eSignRecipients?.map(item => ({\n label: item.displayName,\n value: item.name,\n })),\n },\n },\n },\n eSignFieldType: {\n editor: {\n data: {\n options: eSignTypeMapping,\n },\n },\n },\n },\n };\n\n const result = (window as any).unlayer.createEditor({\n displayMode: 'web',\n devices: ['desktop'],\n features: {\n preview: true,\n userUploads: false,\n stockImages: false,\n textEditor: {\n tables: true,\n },\n },\n mergeTags: mergeTags?.reduce(\n (out, tag) => {\n out[tag.id] = { name: tag.name, value: tag.propertyPath };\n\n return out;\n },\n {} as Record<string, { name: string; value: string }>,\n ),\n projectId: 5713,\n version: latest ? undefined : versions.unlayer,\n appearance: {\n theme: 'classic_light',\n },\n tools: {\n 'carousel': { enabled: false },\n 'button': { enabled: false },\n 'html': {\n enabled: enableHTMLEditing,\n properties: {\n html: {\n editor: {\n widgetParams: {\n codeMirrorOptions: {\n readOnly: enableHTMLEditingReadonly,\n },\n },\n },\n },\n },\n },\n 'table': {\n enabled: true,\n },\n 'menu': { enabled: false },\n 'form': { enabled: false },\n ...(noCoreTools\n ? {\n columns: { enabled: false },\n text: { enabled: false },\n heading: { enabled: false },\n divider: { enabled: false },\n image: { enabled: false },\n }\n : {}),\n ...unitsConfig,\n 'custom#e-sign': eSignComponentRecipients,\n },\n editor: {\n autoSelectOnDrop: true,\n },\n customJS: customScripts,\n customCSS: customStyles,\n id,\n fonts: {\n showDefaultFonts: false,\n customFonts: unlayerSupportedFonts,\n },\n tabs: {\n content: {},\n body: {},\n blocks: { enabled: false },\n },\n });\n\n document.getElementById = currentFind;\n\n if (displayConditions) {\n result.registerCallback(\n 'displayCondition',\n function (data: any, done: (condition: any) => void) {\n emitDisplayCondition({ data, done });\n },\n );\n }\n\n return result;\n};\n"],"names":["emitDisplayCondition","editorCoreScript","editorCoreStyles","editorCoreTools","constGenericsEditor","unlayerSupportedFonts","unlayerCustomEmptyToolState","unlayerCustomToolMetaData","unlayerCustomToolsGetRegisterUrls","DesignUpdatedEventType","versions","unlayer","schema","handlePreselectTool","preselectToolSlug","hideUnlayerContentsControls","hideUnlayerBodyMenuItem","injectEditorCoreStyles","cssText","trim","JSON","stringify","hideMobileTabletPreview","hideUnlayerTools","createUnlayerEditor","container","customCSS","customJS","displayConditions","eSignFieldTypes","eSignRecipients","enableHTMLEditing","enableHTMLEditingReadonly","hideAllTools","hideBodyMenuItem","hideContentControls","latest","mergeTags","noCoreTools","tools","units","customScripts","Array","isArray","filter","js","customStyles","css","id","currentFind","document","getElementById","elementId","call","acv","adminConfigProperty","eSignTypeMapping","map","key","label","value","charAt","toLowerCase","replace","slice","unitsConfig","reduce","out","unit","generic","data","values","properties","userConfigProperty","editor","infoDataProperty","title","eSignComponentRecipients","eSignRecipient","options","item","displayName","name","eSignFieldType","result","window","createEditor","displayMode","devices","features","preview","userUploads","stockImages","textEditor","tables","tag","propertyPath","projectId","version","undefined","appearance","theme","enabled","html","widgetParams","codeMirrorOptions","readOnly","columns","text","heading","divider","image","autoSelectOnDrop","fonts","showDefaultFonts","customFonts","tabs","content","body","blocks","registerCallback","done"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,kDAAkD;AACvF,SAASC,gBAAgB,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,gBAAgB;AACpF,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SACIC,2BAA2B,EAC3BC,yBAAyB,EACzBC,iCAAiC,QAC9B,UAAU;AA0BjB,OAAO,IAAA,AAAKC,gDAAAA;;;;;;;;;;;;;WAAAA;MAaX;AAWD;;;;;CAKC,GACD,OAAO,MAAMC,WAAW;IACpBC,SAAS;IACTC,QAAQ;AACZ,EAAE;AAEF,OAAO,MAAMC,sBAAsB,CAACC;IAChC,OAAO,CAAC;kEACsD,EAAEA,kBAAkB;;;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AM;gBAC1BM,MAAM;oBAAEN,SAAS;gBAAM;gBACvBO,SAAS;oBAAEP,SAAS;gBAAM;gBAC1BQ,SAAS;oBAAER,SAAS;gBAAM;gBAC1BS,OAAO;oBAAET,SAAS;gBAAM;YAC5B,IACA,CAAC,CAAC;YACR,GAAGrC,WAAW;YACd,iBAAiBY;QACrB;QACAH,QAAQ;YACJsC,kBAAkB;QACtB;QACArF,UAAUc;QACVf,WAAWoB;QACXE;QACAiE,OAAO;YACHC,kBAAkB;YAClBC,aAAa9G;QACjB;QACA+G,MAAM;YACFC,SAAS,CAAC;YACVC,MAAM,CAAC;YACPC,QAAQ;gBAAEjB,SAAS;YAAM;QAC7B;IACJ;IAEApD,SAASC,cAAc,GAAGF;IAE1B,IAAIrB,mBAAmB;QACnBwD,OAAOoC,gBAAgB,CACnB,oBACA,SAAUlD,IAAS,EAAEmD,IAA8B;YAC/CzH,qBAAqB;gBAAEsE;gBAAMmD;YAAK;QACtC;IAER;IAEA,OAAOrC;AACX,EAAE"}
1
+ {"version":3,"sources":["../src/unlayer.tsx"],"sourcesContent":["import { emitDisplayCondition } from './display-conditions/displayConditionController';\nimport { editorCoreScript, editorCoreStyles, editorCoreTools } from './editor-core';\nimport { constGenericsEditor } from './shared/const';\nimport { unlayerSupportedFonts } from './shared/fonts';\nimport {\n unlayerCustomEmptyToolState,\n unlayerCustomToolMetaData,\n unlayerCustomToolsGetRegisterUrls,\n} from './tools';\nimport { CreateUnlayerEditorProps } from './unlayer-interface';\n\nexport interface UnlayerExport {\n html: string;\n chunks: any;\n design: any;\n demoData?: Record<string, unknown>;\n}\n\nexport interface Unlayer {\n addEventListener(event: string, cb: (arg: any) => void): void;\n removeEventListener(event: string, cb: (arg: any) => void): void;\n registerCallback(type: string, cb: (...args: any[]) => void): void;\n unregisterCallback(type: string, cb: (...args: any[]) => void): void;\n registerProvider(type: string, cb: (...args: any[]) => void): void;\n unregisterProvider(type: string, cb: (...args: any[]) => void): void;\n loadDesign(design: any): void;\n saveDesign(callback: (design: any) => void): void;\n exportHtml(callback: (data: UnlayerExport) => void): void;\n setMergeTags(tags: any): void;\n createViewer(opts: { render: (values: any) => string }): any;\n registerTool(tool: any): void;\n setBodyValues(values: any): void;\n}\n\nexport enum DesignUpdatedEventType {\n ContentAdded = 'content:added',\n ContentMoved = 'content:moved',\n ContentRemoved = 'content:removed',\n ContentModified = 'content:modified',\n RowAdded = 'row:added',\n RowMoved = 'row:moved',\n RowRemoved = 'row:removed',\n RowModified = 'row:modified',\n ColumnAdded = 'column:added',\n ColumnRemoved = 'column:removed',\n ColumnModified = 'column:modified',\n BodyModified = 'body:modified',\n}\n\nexport interface EventDesignUpdated {\n type: DesignUpdatedEventType;\n item: {\n type: string;\n slug?: string;\n values: any;\n };\n}\n\n/**\n * !!! IMPORTANT !!!\n * do not forget to update schema version when updating unlayer version\n * it is important for templates export and should be in sync\n * to know correct schema version, open unlayer editor and check output design ('schema' property)\n */\nexport const versions = {\n unlayer: '1.421.0',\n schema: 24,\n};\n\nexport const handlePreselectTool = (preselectToolSlug: string) => {\n return `\n const element = document.querySelector('.u_content_custom_${preselectToolSlug}');\n if (element) {\n element.click();\n }\n `;\n};\n\nexport const hideUnlayerContentsControls = () => {\n return `\n .blockbuilder-layer-controls-contents, .blockbuilder-layer-controls-rows {\n display: none !important;\n }\n\n .blockbuilder-options-header .text-right .icon-delete, .blockbuilder-options-header .text-right .icon-duplicate {\n display: none !important;\n }\n `;\n};\n\nexport const hideUnlayerBodyMenuItem = () => {\n return `\n .nav-item.tab-body {\n display: none !important;\n }\n `;\n};\n\nconst injectEditorCoreStyles = () => {\n const cssText = editorCoreStyles?.trim();\n\n if (!cssText) {\n return '';\n }\n\n return `\n (function () {\n var css = ${JSON.stringify(cssText)};\n var id = 'dte-unlayer-core-styles';\n if (document.getElementById(id)) {\n return;\n }\n var style = document.createElement('style');\n style.id = id;\n style.type = 'text/css';\n style.appendChild(document.createTextNode(css));\n document.head.appendChild(style);\n })();\n `;\n};\n\nexport const hideMobileTabletPreview = () => `\n [data-key=\"preview-tablet\"],\n [data-key=\"resolution\"],\n [data-key=\"dark-mode\"],\n [data-key=\"preview-desktop\"],\n [data-key=\"preview-mobile\"] {\n display: none !important;\n }\n`;\nexport const hideUnlayerTools = () => {\n return `\n .blockbuilder-content-tools {\n display: none !important;\n }\n \n .unlayer-custom-empty-tool-state {\n display: flex;\n margin-top: 150px;\n flex-direction: column;\n justify-content: center;\n }\n \n .unlayer-custom-empty-tool-state-icon {\n text-align: center;\n margin-bottom: 12px;\n }\n \n .unlayer-custom-empty-tool-state-icon svg{\n color: #606162;\n }\n \n .unlayer-custom-empty-tool-state-text {\n text-align: center;\n font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: normal;\n color: #606162;\n line-height: 13px;\n }\n `;\n};\n\nexport const createUnlayerEditor = (\n container: HTMLDivElement,\n {\n customCSS,\n customJS,\n displayConditions,\n eSignFieldTypes,\n eSignRecipients,\n enableHTMLEditing,\n enableHTMLEditingReadonly,\n hideAllTools,\n hideBodyMenuItem,\n hideContentControls,\n latest,\n mergeTags,\n noCoreTools,\n tools,\n units,\n }: CreateUnlayerEditorProps,\n): Unlayer => {\n const customScripts = [\n editorCoreScript,\n editorCoreTools,\n injectEditorCoreStyles(),\n 'window.dteStore.sendData(\"--core-loaded\")',\n ...unlayerCustomToolsGetRegisterUrls(tools),\n unlayerCustomToolMetaData(tools),\n ...(customJS ? (Array.isArray(customJS) ? customJS : [customJS]) : []),\n hideAllTools ? unlayerCustomEmptyToolState() : '',\n 'window.dteStore.sendData(\"--data-loaded\")',\n ].filter(js => !!js?.trim());\n const customStyles = [\n editorCoreStyles,\n ...(customCSS ? (Array.isArray(customCSS) ? customCSS : [customCSS]) : []),\n /*\n * @TODO this is workaround for hiding all tools from unlayer sidebar.\n * Will be better to use unlayer functionality for this but it is not implemented yet\n */\n hideMobileTabletPreview(),\n hideAllTools ? hideUnlayerTools() : '',\n hideContentControls ? hideUnlayerContentsControls() : '',\n hideBodyMenuItem ? hideUnlayerBodyMenuItem() : '',\n ].filter(css => !!css?.trim());\n\n /**\n * Unlayer supports only passing id of container, but when we use shadowDOM (MFE),\n * getElementById can't find element in it\n * so making this dirty hack to let unlayer find container in DOM\n */\n const id = container.id;\n const currentFind = document.getElementById;\n document.getElementById = function (elementId: string) {\n if (id === elementId) {\n return container;\n }\n\n return currentFind.call(document, id);\n };\n\n const acv = constGenericsEditor.adminConfigProperty;\n\n const eSignTypeMapping = (eSignFieldTypes ?? []).map(key => ({\n label: key,\n value: key.charAt(0).toLowerCase() + key.replace(/ /g, '').slice(1),\n }));\n\n const unitsConfig = (units ?? []).reduce(\n (out, unit) => {\n out[`custom#${unit.generic}:unit:${unit.id}`] = {\n data: {\n [acv]: unit.values[acv],\n },\n properties: {\n [constGenericsEditor.userConfigProperty]: {\n editor: {\n data: { [acv]: unit.values[acv] },\n },\n },\n [constGenericsEditor.infoDataProperty]: {\n editor: {\n data: { title: unit.title },\n },\n },\n },\n };\n return out;\n },\n {} as Record<string, any>,\n );\n\n const eSignComponentRecipients = {\n properties: {\n eSignRecipient: {\n editor: {\n data: {\n options: eSignRecipients?.map(item => ({\n label: item.displayName,\n value: item.name,\n })),\n },\n },\n },\n eSignFieldType: {\n editor: {\n data: {\n options: eSignTypeMapping,\n },\n },\n },\n },\n };\n\n const result = (window as any).unlayer.createEditor({\n displayMode: 'web',\n devices: ['desktop'],\n features: {\n preview: true,\n userUploads: false,\n stockImages: false,\n textEditor: {\n tables: true,\n },\n },\n mergeTags: mergeTags?.reduce(\n (out, tag) => {\n out[tag.id] = { name: tag.name, value: tag.propertyPath };\n\n return out;\n },\n {} as Record<string, { name: string; value: string }>,\n ),\n projectId: 5713,\n version: latest ? undefined : versions.unlayer,\n appearance: {\n theme: 'classic_light',\n },\n tools: {\n 'carousel': { enabled: false },\n 'button': { enabled: false },\n 'html': {\n enabled: enableHTMLEditing,\n properties: {\n html: {\n editor: {\n widgetParams: {\n codeMirrorOptions: {\n readOnly: enableHTMLEditingReadonly,\n },\n },\n },\n },\n },\n },\n 'table': {\n enabled: true,\n },\n 'menu': { enabled: false },\n 'form': { enabled: false },\n ...(noCoreTools\n ? {\n columns: { enabled: false },\n text: { enabled: false },\n heading: { enabled: false },\n divider: { enabled: false },\n image: { enabled: false },\n }\n : {}),\n ...unitsConfig,\n 'custom#e-sign': eSignComponentRecipients,\n },\n editor: {\n autoSelectOnDrop: true,\n },\n customJS: customScripts,\n customCSS: customStyles,\n id,\n fonts: {\n showDefaultFonts: false,\n customFonts: unlayerSupportedFonts,\n },\n tabs: {\n content: {},\n body: {},\n blocks: { enabled: false },\n },\n });\n\n document.getElementById = currentFind;\n\n if (displayConditions) {\n result.registerCallback(\n 'displayCondition',\n function (data: any, done: (condition: any) => void) {\n emitDisplayCondition({ data, done });\n },\n );\n }\n\n return result;\n};\n"],"names":["emitDisplayCondition","editorCoreScript","editorCoreStyles","editorCoreTools","constGenericsEditor","unlayerSupportedFonts","unlayerCustomEmptyToolState","unlayerCustomToolMetaData","unlayerCustomToolsGetRegisterUrls","DesignUpdatedEventType","versions","unlayer","schema","handlePreselectTool","preselectToolSlug","hideUnlayerContentsControls","hideUnlayerBodyMenuItem","injectEditorCoreStyles","cssText","trim","JSON","stringify","hideMobileTabletPreview","hideUnlayerTools","createUnlayerEditor","container","customCSS","customJS","displayConditions","eSignFieldTypes","eSignRecipients","enableHTMLEditing","enableHTMLEditingReadonly","hideAllTools","hideBodyMenuItem","hideContentControls","latest","mergeTags","noCoreTools","tools","units","customScripts","Array","isArray","filter","js","customStyles","css","id","currentFind","document","getElementById","elementId","call","acv","adminConfigProperty","eSignTypeMapping","map","key","label","value","charAt","toLowerCase","replace","slice","unitsConfig","reduce","out","unit","generic","data","values","properties","userConfigProperty","editor","infoDataProperty","title","eSignComponentRecipients","eSignRecipient","options","item","displayName","name","eSignFieldType","result","window","createEditor","displayMode","devices","features","preview","userUploads","stockImages","textEditor","tables","tag","propertyPath","projectId","version","undefined","appearance","theme","enabled","html","widgetParams","codeMirrorOptions","readOnly","columns","text","heading","divider","image","autoSelectOnDrop","fonts","showDefaultFonts","customFonts","tabs","content","body","blocks","registerCallback","done"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,kDAAkD;AACvF,SAASC,gBAAgB,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,gBAAgB;AACpF,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SACIC,2BAA2B,EAC3BC,yBAAyB,EACzBC,iCAAiC,QAC9B,UAAU;AA0BjB,OAAO,IAAA,AAAKC,gDAAAA;;;;;;;;;;;;;WAAAA;MAaX;AAWD;;;;;CAKC,GACD,OAAO,MAAMC,WAAW;IACpBC,SAAS;IACTC,QAAQ;AACZ,EAAE;AAEF,OAAO,MAAMC,sBAAsB,CAACC;IAChC,OAAO,CAAC;kEACsD,EAAEA,kBAAkB;;;;IAIlF,CAAC;AACL,EAAE;AAEF,OAAO,MAAMC,8BAA8B;IACvC,OAAO,CAAC;;;;;;;;IAQR,CAAC;AACL,EAAE;AAEF,OAAO,MAAMC,0BAA0B;IACnC,OAAO,CAAC;;;;IAIR,CAAC;AACL,EAAE;AAEF,MAAMC,yBAAyB;IAC3B,MAAMC,UAAUhB,6BAAAA,uCAAAA,iBAAkBiB,IAAI;IAEtC,IAAI,CAACD,SAAS;QACV,OAAO;IACX;IAEA,OAAO,CAAC;;sBAEU,EAAEE,KAAKC,SAAS,CAACH,SAAS;;;;;;;;;;;IAW5C,CAAC;AACL;AAEA,OAAO,MAAMI,0BAA0B,IAAM,CAAC;;;;;;;;AAQ9C,CAAC,CAAC;AACF,OAAO,MAAMC,mBAAmB;IAC5B,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+BR,CAAC;AACL,EAAE;AAEF,OAAO,MAAMC,sBAAsB,CAC/BC,WACA,EACIC,SAAS,EACTC,QAAQ,EAC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+1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/dte-unlayer",
3
- "version": "0.145.0",
3
+ "version": "0.146.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
@@ -16,6 +16,6 @@
16
16
  "webpack": false
17
17
  },
18
18
  "peerDependencies": {
19
- "@servicetitan/anvil2": "^2.0.2"
19
+ "@servicetitan/anvil2": "^3.7.1"
20
20
  }
21
21
  }