@servicetitan/dte-unlayer 0.72.0 → 0.74.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.
@@ -6,6 +6,12 @@ export const constGenericsEditor = {
6
6
  userConfigProperty: 'config',
7
7
  };
8
8
 
9
+ export interface UnlayerEditorESignPlaceholderInfo {
10
+ id: number;
11
+ placeholder: string;
12
+ displayName: string;
13
+ }
14
+
9
15
  export interface UnlayerEditorUnit {
10
16
  id: string;
11
17
  generic: string;
@@ -30,6 +36,7 @@ export interface UnlayerEventConfig {
30
36
 
31
37
  export interface UnlayerEventRegister {
32
38
  units?: UnlayerEditorUnit[];
39
+ eSignPlaceholders?: UnlayerEditorESignPlaceholderInfo[];
33
40
  customTools?: {
34
41
  key: string;
35
42
  title?: string;
@@ -38,6 +45,6 @@ export interface UnlayerEventRegister {
38
45
  }
39
46
 
40
47
  export interface UnlayerToolMetaData {
41
- title: string;
48
+ key: string;
42
49
  description?: string;
43
50
  }
package/src/store.ts CHANGED
@@ -206,6 +206,7 @@ export class UnlayerStore {
206
206
  const data: UnlayerEventRegister = {
207
207
  customTools: this.props.tools.map(tool => ({ key: tool.key })),
208
208
  toolTwins: this.props.toolTwins,
209
+ eSignPlaceholders: this.props.eSignPlaceholders,
209
210
  units: this.props.units?.map(unit => ({
210
211
  ...unit,
211
212
  values: {
package/src/tools.ts CHANGED
@@ -226,8 +226,8 @@ export const unlayerCustomToolsGetRegisterUrls = (tools: UnlayerEditorCustomTool
226
226
 
227
227
  export const unlayerCustomToolMetaData = (tools: UnlayerEditorCustomTool[]): string => {
228
228
  const toolMetaData = tools.reduce((acc: Record<string, UnlayerToolMetaData>, tool) => {
229
- acc[tool.key] = {
230
- title: tool.title,
229
+ acc[tool.title] = {
230
+ key: tool.key,
231
231
  description: tool.description,
232
232
  };
233
233
  return acc;
@@ -1,4 +1,8 @@
1
- import { UnlayerEditorTwin, UnlayerEditorUnit } from './shared/const';
1
+ import {
2
+ UnlayerEditorESignPlaceholderInfo,
3
+ UnlayerEditorTwin,
4
+ UnlayerEditorUnit,
5
+ } from './shared/const';
2
6
  import { SchemaObject } from './shared/schema';
3
7
 
4
8
  export interface UnlayerDesignTool {
@@ -62,6 +66,7 @@ export interface CreateUnlayerEditorProps {
62
66
  customCSS?: string | string[] | undefined;
63
67
  customJS?: string | string[] | undefined;
64
68
  mergeTags?: UnlayerEditorMergeTagInfo[] | undefined;
69
+ eSignPlaceholders?: UnlayerEditorESignPlaceholderInfo[] | undefined;
65
70
  genericConfigMode?: boolean;
66
71
  generics?: true | string[];
67
72
  units?: UnlayerEditorUnit[];
package/src/unlayer.tsx CHANGED
@@ -134,6 +134,7 @@ export const createUnlayerEditor = (
134
134
  {
135
135
  customCSS,
136
136
  customJS,
137
+ eSignPlaceholders,
137
138
  hideAllTools,
138
139
  hideBodyMenuItem,
139
140
  hideContentControls,
@@ -204,6 +205,21 @@ export const createUnlayerEditor = (
204
205
  return out;
205
206
  }, {} as Record<string, any>);
206
207
 
208
+ const eSignComponentPlaceholders = {
209
+ properties: {
210
+ eSignPlaceholder: {
211
+ editor: {
212
+ data: {
213
+ options: eSignPlaceholders?.map(placeholder => ({
214
+ label: placeholder.displayName,
215
+ value: placeholder.placeholder,
216
+ })),
217
+ },
218
+ },
219
+ },
220
+ },
221
+ };
222
+
207
223
  const result = (window as any).unlayer.createEditor({
208
224
  displayMode: 'web',
209
225
  devices: ['desktop'],
@@ -223,10 +239,10 @@ export const createUnlayerEditor = (
223
239
  theme: 'classic_light',
224
240
  },
225
241
  tools: {
226
- button: { enabled: false },
227
- html: { enabled: false },
228
- menu: { enabled: false },
229
- form: { enabled: false },
242
+ 'button': { enabled: false },
243
+ 'html': { enabled: false },
244
+ 'menu': { enabled: false },
245
+ 'form': { enabled: false },
230
246
  ...(noCoreTools
231
247
  ? {
232
248
  columns: { enabled: false },
@@ -237,6 +253,7 @@ export const createUnlayerEditor = (
237
253
  }
238
254
  : {}),
239
255
  ...unitsConfig,
256
+ 'custom#esign': eSignComponentPlaceholders,
240
257
  },
241
258
  editor: {
242
259
  autoSelectOnDrop: true,