@servicetitan/dte-unlayer 0.158.0 → 0.159.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.
Files changed (147) hide show
  1. package/dist/api-core.js +22 -29
  2. package/dist/api-core.js.map +1 -1
  3. package/dist/api-custom-tools.js +23 -29
  4. package/dist/api-custom-tools.js.map +1 -1
  5. package/dist/business-calendar/BusinessCalendarDrawer.d.ts +19 -0
  6. package/dist/business-calendar/BusinessCalendarDrawer.d.ts.map +1 -0
  7. package/dist/business-calendar/BusinessCalendarDrawer.js +41 -0
  8. package/dist/business-calendar/BusinessCalendarDrawer.js.map +1 -0
  9. package/dist/business-calendar/business-calendar-requests.d.ts +25 -0
  10. package/dist/business-calendar/business-calendar-requests.d.ts.map +1 -0
  11. package/dist/business-calendar/business-calendar-requests.js +46 -0
  12. package/dist/business-calendar/business-calendar-requests.js.map +1 -0
  13. package/dist/business-calendar/business-calendar-state.d.ts +22 -0
  14. package/dist/business-calendar/business-calendar-state.d.ts.map +1 -0
  15. package/dist/business-calendar/business-calendar-state.js +74 -0
  16. package/dist/business-calendar/business-calendar-state.js.map +1 -0
  17. package/dist/business-calendar/useBusinessCalendarRequests.d.ts +15 -0
  18. package/dist/business-calendar/useBusinessCalendarRequests.d.ts.map +1 -0
  19. package/dist/business-calendar/useBusinessCalendarRequests.js +30 -0
  20. package/dist/business-calendar/useBusinessCalendarRequests.js.map +1 -0
  21. package/dist/display-conditions/ConditionGroup.js +15 -89
  22. package/dist/display-conditions/ConditionGroup.js.map +1 -1
  23. package/dist/display-conditions/ConditionGroupsSection.js +2 -70
  24. package/dist/display-conditions/ConditionGroupsSection.js.map +1 -1
  25. package/dist/display-conditions/ConditionRow.js +63 -205
  26. package/dist/display-conditions/ConditionRow.js.map +1 -1
  27. package/dist/display-conditions/DisplayConditionModal.js +40 -190
  28. package/dist/display-conditions/DisplayConditionModal.js.map +1 -1
  29. package/dist/display-conditions/LookupValueControl.js +42 -105
  30. package/dist/display-conditions/LookupValueControl.js.map +1 -1
  31. package/dist/display-conditions/SeparatorWithChip.js +1 -10
  32. package/dist/display-conditions/SeparatorWithChip.js.map +1 -1
  33. package/dist/display-conditions/constants.js +15 -20
  34. package/dist/display-conditions/constants.js.map +1 -1
  35. package/dist/display-conditions/displayConditionController.js +5 -8
  36. package/dist/display-conditions/displayConditionController.js.map +1 -1
  37. package/dist/display-conditions/lookupOptionsController.js +16 -16
  38. package/dist/display-conditions/lookupOptionsController.js.map +1 -1
  39. package/dist/display-conditions/nunjucks.js +98 -116
  40. package/dist/display-conditions/nunjucks.js.map +1 -1
  41. package/dist/display-conditions/schemaDataPoints.js +13 -11
  42. package/dist/display-conditions/schemaDataPoints.js.map +1 -1
  43. package/dist/display-conditions/types.js +23 -67
  44. package/dist/display-conditions/types.js.map +1 -1
  45. package/dist/display-conditions/useConditionForms.js +38 -56
  46. package/dist/display-conditions/useConditionForms.js.map +1 -1
  47. package/dist/display-conditions/useLookupOptions.js +24 -44
  48. package/dist/display-conditions/useLookupOptions.js.map +1 -1
  49. package/dist/e-sign-offset/ESignDateSignedOffsetModal.js +37 -150
  50. package/dist/e-sign-offset/ESignDateSignedOffsetModal.js.map +1 -1
  51. package/dist/e-sign-offset/ESignOffsetRuleRow.js +12 -73
  52. package/dist/e-sign-offset/ESignOffsetRuleRow.js.map +1 -1
  53. package/dist/e-sign-offset/eSignOffsetController.js +5 -8
  54. package/dist/e-sign-offset/eSignOffsetController.js.map +1 -1
  55. package/dist/editor-core-source.d.ts +2 -2
  56. package/dist/editor-core-source.d.ts.map +1 -1
  57. package/dist/editor-core-source.js +3 -3
  58. package/dist/editor-core-source.js.map +1 -1
  59. package/dist/editor-core.js +2 -2
  60. package/dist/editor-core.js.map +1 -1
  61. package/dist/editor.d.ts.map +1 -1
  62. package/dist/editor.js +56 -118
  63. package/dist/editor.js.map +1 -1
  64. package/dist/image-upload-error.js +3 -3
  65. package/dist/image-upload-error.js.map +1 -1
  66. package/dist/index.d.ts +1 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +0 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/loadScript.js +7 -8
  71. package/dist/loadScript.js.map +1 -1
  72. package/dist/log.js +2 -3
  73. package/dist/log.js.map +1 -1
  74. package/dist/merge-tags.js +18 -17
  75. package/dist/merge-tags.js.map +1 -1
  76. package/dist/shared/configs.js +1 -2
  77. package/dist/shared/configs.js.map +1 -1
  78. package/dist/shared/const.d.ts +70 -0
  79. package/dist/shared/const.d.ts.map +1 -1
  80. package/dist/shared/const.js +13 -4
  81. package/dist/shared/const.js.map +1 -1
  82. package/dist/shared/date-calc.js +47 -38
  83. package/dist/shared/date-calc.js.map +1 -1
  84. package/dist/shared/e-sign-offset.js +46 -63
  85. package/dist/shared/e-sign-offset.js.map +1 -1
  86. package/dist/shared/edit-icon.js +0 -1
  87. package/dist/shared/edit-icon.js.map +1 -1
  88. package/dist/shared/fonts.js +16 -17
  89. package/dist/shared/fonts.js.map +1 -1
  90. package/dist/shared/forms.js +16 -38
  91. package/dist/shared/forms.js.map +1 -1
  92. package/dist/shared/instance-id.js +6 -9
  93. package/dist/shared/instance-id.js.map +1 -1
  94. package/dist/shared/nunjucks-helpers.js +2 -5
  95. package/dist/shared/nunjucks-helpers.js.map +1 -1
  96. package/dist/shared/schema.js +52 -96
  97. package/dist/shared/schema.js.map +1 -1
  98. package/dist/shared/tools.js +6 -13
  99. package/dist/shared/tools.js.map +1 -1
  100. package/dist/store.d.ts +15 -1
  101. package/dist/store.d.ts.map +1 -1
  102. package/dist/store.js +851 -548
  103. package/dist/store.js.map +1 -1
  104. package/dist/tools.js +133 -143
  105. package/dist/tools.js.map +1 -1
  106. package/dist/unlayer-interface.d.ts +15 -4
  107. package/dist/unlayer-interface.d.ts.map +1 -1
  108. package/dist/unlayer-interface.js +1 -2
  109. package/dist/unlayer-interface.js.map +1 -1
  110. package/dist/unlayer.js +86 -113
  111. package/dist/unlayer.js.map +1 -1
  112. package/dist/vendor/dte-shared/business-calendar-validation.utils.d.ts +25 -0
  113. package/dist/vendor/dte-shared/business-calendar-validation.utils.js +80 -0
  114. package/dist/vendor/dte-shared/components/business-calendar-section.d.ts +15 -0
  115. package/dist/vendor/dte-shared/components/business-calendar-section.js +14 -0
  116. package/dist/vendor/dte-shared/components/schedule-drawer.d.ts +18 -0
  117. package/dist/vendor/dte-shared/components/schedule-drawer.js +119 -0
  118. package/dist/vendor/dte-shared/components/schedule-picker.d.ts +8 -0
  119. package/dist/vendor/dte-shared/components/schedule-picker.js +88 -0
  120. package/dist/vendor/dte-shared/constants.d.ts +31 -0
  121. package/dist/vendor/dte-shared/constants.js +34 -0
  122. package/dist/vendor/dte-shared/field-schedule-editor-context.d.ts +31 -0
  123. package/dist/vendor/dte-shared/field-schedule-editor-context.js +110 -0
  124. package/dist/vendor/dte-shared/index.d.ts +8 -0
  125. package/dist/vendor/dte-shared/index.js +7 -0
  126. package/dist/vendor/dte-shared/schedule-bindings.utils.d.ts +22 -0
  127. package/dist/vendor/dte-shared/schedule-bindings.utils.js +31 -0
  128. package/dist/vendor/dte-shared/styles/schedule.css +19 -0
  129. package/dist/vendor/dte-shared/types.d.ts +129 -0
  130. package/dist/vendor/dte-shared/types.js +1 -0
  131. package/package.json +7 -1
  132. package/src/__tests__/business-calendar-drawer.test.tsx +183 -0
  133. package/src/__tests__/business-calendar-requests.test.ts +166 -0
  134. package/src/__tests__/business-calendar-state.test.tsx +142 -0
  135. package/src/__tests__/store.business-calendar.test.ts +185 -0
  136. package/src/__tests__/unlayer.e-sign-types.test.ts +30 -0
  137. package/src/business-calendar/BusinessCalendarDrawer.tsx +76 -0
  138. package/src/business-calendar/business-calendar-requests.ts +80 -0
  139. package/src/business-calendar/business-calendar-state.ts +113 -0
  140. package/src/business-calendar/useBusinessCalendarRequests.ts +49 -0
  141. package/src/editor-core-source.ts +2 -2
  142. package/src/editor.tsx +15 -0
  143. package/src/index.ts +10 -0
  144. package/src/shared/const.ts +59 -0
  145. package/src/store.ts +67 -5
  146. package/src/unlayer-interface.tsx +15 -4
  147. package/src/unlayer.tsx +5 -5
@@ -4,6 +4,6 @@
4
4
  * so when we build tools packages, we generate ./editor-core-source.ts file and include all tools bundles as strings
5
5
  * then this code is passed to unlayer initializer
6
6
  * (note that custom tools are imported differently as urls)
7
- */ export { editorCoreScript, editorCoreTools, editorCoreStyles } from './editor-core-source';
8
-
7
+ */
8
+ export { editorCoreScript, editorCoreTools, editorCoreStyles } from './editor-core-source';
9
9
  //# sourceMappingURL=editor-core.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/editor-core.ts"],"sourcesContent":["/**\n * we need to pass code to unlayer and we have to pass it as source code (not as url to static file)\n * because it is loaded from unlayer domain, so it has to pass authorization\n * so when we build tools packages, we generate ./editor-core-source.ts file and include all tools bundles as strings\n * then this code is passed to unlayer initializer\n * (note that custom tools are imported differently as urls)\n */\nexport { editorCoreScript, editorCoreTools, editorCoreStyles } from './editor-core-source';\n"],"names":["editorCoreScript","editorCoreTools","editorCoreStyles"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,uBAAuB"}
1
+ {"version":3,"file":"editor-core.js","sourceRoot":"","sources":["../src/editor-core.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EAOhB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAgB,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,MAAM,WAAW,kBAAkB;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AI,IAAI,CAAC;IAEjB,QAAQ,CAAC,CAAC,IAAI,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAE/C,cAAc,CAAC,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAE/C,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE/C,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpD,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,aAAa,2DAAwC,CAAC;AAEnE,eAAO,MAAM,aAAa,2GAqIxB,CAAC"}
package/dist/editor.js CHANGED
@@ -1,152 +1,90 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
3
+ import { useBusinessCalendarState } from './business-calendar/business-calendar-state';
4
+ import { BusinessCalendarDrawer } from './business-calendar/BusinessCalendarDrawer';
5
+ import { useBusinessCalendarRequests } from './business-calendar/useBusinessCalendarRequests';
3
6
  import { DisplayConditionModal } from './display-conditions/DisplayConditionModal';
4
7
  import { ESignDateSignedOffsetModal } from './e-sign-offset/ESignDateSignedOffsetModal';
5
8
  import { getErrorMessage } from './log';
6
9
  import { UnlayerStore } from './store';
7
- export const useUnlayerRef = ()=>useRef(null);
8
- export const UnlayerEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
9
- var _props_id;
10
- var _props_opts_eSignRecipients;
10
+ export const useUnlayerRef = () => useRef(null);
11
+ export const UnlayerEditor = forwardRef((props, ref) => {
12
+ var _a, _b;
11
13
  const [isReady, setIsReady] = useState(false);
12
14
  const [loadError, setLoadError] = useState();
13
15
  const containerRef = useRef(null);
14
- const store = useMemo(()=>new UnlayerStore(props.opts), // eslint-disable-next-line react-hooks/exhaustive-deps
16
+ const store = useMemo(() => new UnlayerStore(props.opts),
17
+ // eslint-disable-next-line react-hooks/exhaustive-deps
15
18
  []);
16
- useEffect(()=>{
19
+ useEffect(() => {
17
20
  store.setOnError(props.onError);
18
- return ()=>store.setOnError();
19
- }, [
20
- props.onError,
21
- store
22
- ]);
23
- useEffect(()=>{
21
+ return () => store.setOnError();
22
+ }, [props.onError, store]);
23
+ useEffect(() => {
24
24
  if (containerRef.current) {
25
- store.init(containerRef.current).then(()=>{
25
+ store
26
+ .init(containerRef.current)
27
+ .then(() => {
26
28
  setLoadError(undefined);
27
29
  setIsReady(true);
28
- }).catch((error)=>{
29
- var _props_onError;
30
+ })
31
+ .catch((error) => {
32
+ var _a;
30
33
  const description = getErrorMessage(error);
31
34
  setIsReady(false);
32
35
  setLoadError(description);
33
- (_props_onError = props.onError) === null || _props_onError === void 0 ? void 0 : _props_onError.call(props, 'Editor failed to load', description);
36
+ (_a = props.onError) === null || _a === void 0 ? void 0 : _a.call(props, 'Editor failed to load', description);
34
37
  });
35
38
  }
36
- return ()=>store.destroy();
37
- // eslint-disable-next-line react-hooks/exhaustive-deps
38
- }, [
39
- store
40
- ]);
41
- useImperativeHandle(ref, ()=>store.unlayerRef, [
42
- store
43
- ]);
44
- useEffect(()=>{
39
+ return () => store.destroy();
40
+ // eslint-disable-next-line react-hooks/exhaustive-deps
41
+ }, [store]);
42
+ useImperativeHandle(ref, () => store.unlayerRef, [store]);
43
+ useEffect(() => {
45
44
  if (isReady) {
46
45
  store.setDesign(props.design);
47
46
  }
48
- }, [
49
- isReady,
50
- props.design,
51
- store
52
- ]);
53
- useEffect(()=>{
47
+ }, [isReady, props.design, store]);
48
+ useEffect(() => {
54
49
  store.setOnChange(props.onChange);
55
- return ()=>store.setOnChange();
56
- }, [
57
- props.onChange,
58
- store
59
- ]);
60
- useEffect(()=>{
50
+ return () => store.setOnChange();
51
+ }, [props.onChange, store]);
52
+ useEffect(() => {
61
53
  store.setOnSnapshotSave(props.onSnapshotSave);
62
- return ()=>store.setOnSnapshotSave();
63
- }, [
64
- props.onSnapshotSave,
65
- store
66
- ]);
67
- useEffect(()=>{
54
+ return () => store.setOnSnapshotSave();
55
+ }, [props.onSnapshotSave, store]);
56
+ useEffect(() => {
68
57
  if (props.opts.newSnapshot) {
69
58
  store.addTwin(props.opts.newSnapshot);
70
59
  }
71
- }, [
72
- props.opts.newSnapshot,
73
- store
74
- ]);
75
- useEffect(()=>{
60
+ }, [props.opts.newSnapshot, store]);
61
+ useEffect(() => {
76
62
  store.setOnReady(props.onReady);
77
- return ()=>store.setOnReady();
78
- }, [
79
- props.onReady,
80
- store
81
- ]);
82
- useEffect(()=>{
63
+ return () => store.setOnReady();
64
+ }, [props.onReady, store]);
65
+ useEffect(() => {
83
66
  store.setOnImage(props.onImage);
84
- return ()=>store.setOnImage();
85
- }, [
86
- props.onImage,
87
- store
88
- ]);
89
- useEffect(()=>{
67
+ return () => store.setOnImage();
68
+ }, [props.onImage, store]);
69
+ useEffect(() => {
90
70
  store.setOnMessage(props.onMessage);
91
- return ()=>store.setOnMessage();
92
- }, [
93
- props.onMessage,
94
- store
95
- ]);
96
- useEffect(()=>{
71
+ return () => store.setOnMessage();
72
+ }, [props.onMessage, store]);
73
+ useEffect(() => {
97
74
  store.setOnFormSelect(props.opts.onFormSelect);
98
- return ()=>store.setOnFormSelect();
99
- }, [
100
- props.opts.onFormSelect,
101
- store
102
- ]);
103
- useEffect(()=>{
75
+ return () => store.setOnFormSelect();
76
+ }, [props.opts.onFormSelect, store]);
77
+ useEffect(() => {
104
78
  store.setOnCalcFieldOpen(props.opts.onCalcFieldOpen);
105
- return ()=>store.setOnCalcFieldOpen();
106
- }, [
107
- props.opts.onCalcFieldOpen,
108
- store
109
- ]);
110
- useEffect(()=>{
79
+ return () => store.setOnCalcFieldOpen();
80
+ }, [props.opts.onCalcFieldOpen, store]);
81
+ useEffect(() => {
111
82
  store.setOnCalcFieldSelect(props.opts.onCalcFieldSelect);
112
- return ()=>store.setOnCalcFieldSelect();
113
- }, [
114
- props.opts.onCalcFieldSelect,
115
- store
116
- ]);
83
+ return () => store.setOnCalcFieldSelect();
84
+ }, [props.opts.onCalcFieldSelect, store]);
85
+ const businessCalendar = useBusinessCalendarRequests(store, props.opts);
86
+ useBusinessCalendarState(store, props.opts);
117
87
  const { minHeight = 800, style = {} } = props;
118
- return /*#__PURE__*/ _jsxs("div", {
119
- style: {
120
- minHeight,
121
- display: 'flex'
122
- },
123
- children: [
124
- loadError && /*#__PURE__*/ _jsxs("p", {
125
- className: "c-red-500",
126
- children: [
127
- "error loading editor: ",
128
- loadError
129
- ]
130
- }),
131
- /*#__PURE__*/ _jsx("div", {
132
- id: (_props_id = props.id) !== null && _props_id !== void 0 ? _props_id : 'editor',
133
- style: style,
134
- ref: containerRef
135
- }),
136
- props.opts.displayConditions && /*#__PURE__*/ _jsx(DisplayConditionModal, {
137
- portalContainer: props.opts.displayConditionModalPortalContainer,
138
- schema: props.opts.schema,
139
- onConditionalsOpen: props.opts.onConditionalsOpen,
140
- onConditionFormSelect: props.opts.onConditionFormSelect
141
- }),
142
- !!((_props_opts_eSignRecipients = props.opts.eSignRecipients) === null || _props_opts_eSignRecipients === void 0 ? void 0 : _props_opts_eSignRecipients.length) && /*#__PURE__*/ _jsx(ESignDateSignedOffsetModal, {
143
- portalContainer: props.opts.displayConditionModalPortalContainer,
144
- schema: props.opts.schema,
145
- onConditionalsOpen: props.opts.onConditionalsOpen,
146
- onConditionFormSelect: props.opts.onConditionFormSelect
147
- })
148
- ]
149
- });
88
+ return (_jsxs("div", { style: { minHeight, display: 'flex' }, children: [loadError && _jsxs("p", { className: "c-red-500", children: ["error loading editor: ", loadError] }), _jsx("div", { id: (_a = props.id) !== null && _a !== void 0 ? _a : 'editor', style: style, ref: containerRef }), props.opts.displayConditions && (_jsx(DisplayConditionModal, { portalContainer: props.opts.displayConditionModalPortalContainer, schema: props.opts.schema, onConditionalsOpen: props.opts.onConditionalsOpen, onConditionFormSelect: props.opts.onConditionFormSelect })), !!((_b = props.opts.eSignRecipients) === null || _b === void 0 ? void 0 : _b.length) && (_jsx(ESignDateSignedOffsetModal, { portalContainer: props.opts.displayConditionModalPortalContainer, schema: props.opts.schema, onConditionalsOpen: props.opts.onConditionalsOpen, onConditionFormSelect: props.opts.onConditionFormSelect })), businessCalendar.drawer && props.opts.onScheduleBindingsChange && (_jsx(BusinessCalendarDrawer, { request: businessCalendar.drawer, host: props.opts, portalContainer: props.opts.displayConditionModalPortalContainer, onClose: businessCalendar.closeDrawer }, businessCalendar.drawer.id))] }));
150
89
  });
151
-
152
90
  //# sourceMappingURL=editor.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/editor.tsx"],"sourcesContent":["import {\n CSSProperties,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { DisplayConditionModal } from './display-conditions/DisplayConditionModal';\nimport { ESignDateSignedOffsetModal } from './e-sign-offset/ESignDateSignedOffsetModal';\nimport { getErrorMessage } from './log';\nimport { UnlayerEditorTwin } from './shared/const';\nimport { UnlayerStore, UnlayerDesignChangeInfo } from './store';\nimport { UnlayerRef, CreateUnlayerEditorProps } from './unlayer-interface';\n\nexport interface UnlayerEditorProps {\n id?: string;\n design?: any;\n opts: CreateUnlayerEditorProps;\n minHeight?: number;\n style?: CSSProperties;\n\n onReady?(): void;\n\n onChange?(info: UnlayerDesignChangeInfo): void;\n\n onSnapshotSave?(tool: UnlayerEditorTwin): void;\n\n onImage?(file: File): Promise<{ url: string }>;\n\n onError?(title: string, description?: string): void;\n\n onMessage?(type: string, data: any): void;\n}\n\nexport const useUnlayerRef = () => useRef<UnlayerRef | null>(null);\n\nexport const UnlayerEditor = forwardRef<UnlayerRef, UnlayerEditorProps>((props, ref) => {\n const [isReady, setIsReady] = useState(false);\n const [loadError, setLoadError] = useState<string>();\n const containerRef = useRef<HTMLDivElement | null>(null);\n const store = useMemo(\n () => new UnlayerStore(props.opts),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n useEffect(() => {\n store.setOnError(props.onError);\n\n return () => store.setOnError();\n }, [props.onError, store]);\n\n useEffect(() => {\n if (containerRef.current) {\n store\n .init(containerRef.current)\n .then(() => {\n setLoadError(undefined);\n setIsReady(true);\n })\n .catch((error: unknown) => {\n const description = getErrorMessage(error);\n setIsReady(false);\n setLoadError(description);\n props.onError?.('Editor failed to load', description);\n });\n }\n\n return () => store.destroy();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store]);\n useImperativeHandle(ref, () => store.unlayerRef, [store]);\n\n useEffect(() => {\n if (isReady) {\n store.setDesign(props.design);\n }\n }, [isReady, props.design, store]);\n\n useEffect(() => {\n store.setOnChange(props.onChange);\n\n return () => store.setOnChange();\n }, [props.onChange, store]);\n\n useEffect(() => {\n store.setOnSnapshotSave(props.onSnapshotSave);\n\n return () => store.setOnSnapshotSave();\n }, [props.onSnapshotSave, store]);\n\n useEffect(() => {\n if (props.opts.newSnapshot) {\n store.addTwin(props.opts.newSnapshot);\n }\n }, [props.opts.newSnapshot, store]);\n\n useEffect(() => {\n store.setOnReady(props.onReady);\n\n return () => store.setOnReady();\n }, [props.onReady, store]);\n\n useEffect(() => {\n store.setOnImage(props.onImage);\n\n return () => store.setOnImage();\n }, [props.onImage, store]);\n\n useEffect(() => {\n store.setOnMessage(props.onMessage);\n\n return () => store.setOnMessage();\n }, [props.onMessage, store]);\n\n useEffect(() => {\n store.setOnFormSelect(props.opts.onFormSelect);\n\n return () => store.setOnFormSelect();\n }, [props.opts.onFormSelect, store]);\n\n useEffect(() => {\n store.setOnCalcFieldOpen(props.opts.onCalcFieldOpen);\n\n return () => store.setOnCalcFieldOpen();\n }, [props.opts.onCalcFieldOpen, store]);\n\n useEffect(() => {\n store.setOnCalcFieldSelect(props.opts.onCalcFieldSelect);\n\n return () => store.setOnCalcFieldSelect();\n }, [props.opts.onCalcFieldSelect, store]);\n\n const { minHeight = 800, style = {} } = props;\n\n return (\n <div style={{ minHeight, display: 'flex' }}>\n {loadError && <p className=\"c-red-500\">error loading editor: {loadError}</p>}\n <div id={props.id ?? 'editor'} style={style} ref={containerRef} />\n {props.opts.displayConditions && (\n <DisplayConditionModal\n portalContainer={props.opts.displayConditionModalPortalContainer}\n schema={props.opts.schema}\n onConditionalsOpen={props.opts.onConditionalsOpen}\n onConditionFormSelect={props.opts.onConditionFormSelect}\n />\n )}\n {!!props.opts.eSignRecipients?.length && (\n <ESignDateSignedOffsetModal\n portalContainer={props.opts.displayConditionModalPortalContainer}\n schema={props.opts.schema}\n onConditionalsOpen={props.opts.onConditionalsOpen}\n onConditionFormSelect={props.opts.onConditionFormSelect}\n />\n )}\n </div>\n );\n});\n"],"names":["forwardRef","useEffect","useImperativeHandle","useMemo","useRef","useState","DisplayConditionModal","ESignDateSignedOffsetModal","getErrorMessage","UnlayerStore","useUnlayerRef","UnlayerEditor","props","ref","isReady","setIsReady","loadError","setLoadError","containerRef","store","opts","setOnError","onError","current","init","then","undefined","catch","error","description","destroy","unlayerRef","setDesign","design","setOnChange","onChange","setOnSnapshotSave","onSnapshotSave","newSnapshot","addTwin","setOnReady","onReady","setOnImage","onImage","setOnMessage","onMessage","setOnFormSelect","onFormSelect","setOnCalcFieldOpen","onCalcFieldOpen","setOnCalcFieldSelect","onCalcFieldSelect","minHeight","style","div","display","p","className","id","displayConditions","portalContainer","displayConditionModalPortalContainer","schema","onConditionalsOpen","onConditionFormSelect","eSignRecipients","length"],"mappings":";AAAA,SAEIA,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,QAAQ;AACf,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,0BAA0B,QAAQ,6CAA6C;AACxF,SAASC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M,CAAA,IAAI,CACrC,KAAC,0BAA0B,IACvB,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,oCAAoC,EAChE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EACzB,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,EACjD,qBAAqB,EAAE,KAAK,CAAC,IAAI,CAAC,qBAAqB,GACzD,CACL,EACA,gBAAgB,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,wBAAwB,IAAI,CAC/D,KAAC,sBAAsB,IAEnB,OAAO,EAAE,gBAAgB,CAAC,MAAM,EAChC,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,oCAAoC,EAChE,OAAO,EAAE,gBAAgB,CAAC,WAAW,IAJhC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAKjC,CACL,IACC,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -1,8 +1,8 @@
1
- /** Reject `onImage` with this error to show its message to the user instead of the generic upload failure text. */ export class ImageUploadError extends Error {
2
- constructor(message, options){
1
+ /** Reject `onImage` with this error to show its message to the user instead of the generic upload failure text. */
2
+ export class ImageUploadError extends Error {
3
+ constructor(message, options) {
3
4
  super(message, options);
4
5
  this.name = 'ImageUploadError';
5
6
  }
6
7
  }
7
-
8
8
  //# sourceMappingURL=image-upload-error.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/image-upload-error.ts"],"sourcesContent":["/** Reject `onImage` with this error to show its message to the user instead of the generic upload failure text. */\nexport class ImageUploadError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'ImageUploadError';\n }\n}\n"],"names":["ImageUploadError","Error","message","options","name"],"mappings":"AAAA,iHAAiH,GACjH,OAAO,MAAMA,yBAAyBC;IAClC,YAAYC,OAAe,EAAEC,OAAsB,CAAE;QACjD,KAAK,CAACD,SAASC;QACf,IAAI,CAACC,IAAI,GAAG;IAChB;AACJ"}
1
+ {"version":3,"file":"image-upload-error.js","sourceRoot":"","sources":["../src/image-upload-error.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACvC,YAAY,OAAe,EAAE,OAAsB;QAC/C,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACnC,CAAC;CACJ"}
package/dist/index.d.ts CHANGED
@@ -16,4 +16,5 @@ export { versions } from './unlayer';
16
16
  export * from './shared/date-calc';
17
17
  export { emptyArrayIfNull } from './shared/nunjucks-helpers';
18
18
  export * from './display-conditions/lookupOptionsController';
19
+ export type { BusinessCalendarHostProps, BusinessCalendarRules, BusinessDaySchedule, FieldScheduleBinding, HolidayCatalog, KnownHoliday, SaveScheduleRequest, WeekendDay, } from './vendor/dte-shared/index';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC1E,YAAY,EACR,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACzB,MAAM,cAAc,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,cAAc,8CAA8C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC1E,YAAY,EACR,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACzB,MAAM,cAAc,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,YAAY,EACR,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,UAAU,GACb,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -14,5 +14,4 @@ export { versions } from './unlayer';
14
14
  export * from './shared/date-calc';
15
15
  export { emptyArrayIfNull } from './shared/nunjucks-helpers';
16
16
  export * from './display-conditions/lookupOptionsController';
17
-
18
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './editor';\nexport { ImageUploadError } from './image-upload-error';\nexport * from './tools';\nexport * from './api-core';\nexport * from './api-custom-tools';\nexport * from './unlayer-interface';\nexport { isUnlayerMergeTagGroup, toUnlayerMergeTags } from './merge-tags';\nexport type {\n ToUnlayerMergeTagsOptions,\n UnlayerMergeTagGroup,\n UnlayerMergeTagLeaf,\n UnlayerMergeTagsConfig,\n} from './merge-tags';\nexport * from './loadScript';\nexport * from './shared/const';\nexport * from './shared/forms';\nexport * from './shared/schema';\nexport * from './shared/tools';\nexport type { UnlayerDesignChangeInfo } from './store';\nexport { versions } from './unlayer';\nexport * from './shared/date-calc';\nexport { emptyArrayIfNull } from './shared/nunjucks-helpers';\nexport * from './display-conditions/lookupOptionsController';\n"],"names":["ImageUploadError","isUnlayerMergeTagGroup","toUnlayerMergeTags","versions","emptyArrayIfNull"],"mappings":"AAAA,cAAc,WAAW;AACzB,SAASA,gBAAgB,QAAQ,uBAAuB;AACxD,cAAc,UAAU;AACxB,cAAc,aAAa;AAC3B,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ,eAAe;AAO1E,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAE/B,SAASC,QAAQ,QAAQ,YAAY;AACrC,cAAc,qBAAqB;AACnC,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,cAAc,+CAA+C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAO1E,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,cAAc,8CAA8C,CAAC"}
@@ -1,26 +1,26 @@
1
1
  import { logUnlayerError } from './log';
2
- const isScriptInjected = (scriptUrl)=>{
2
+ const isScriptInjected = (scriptUrl) => {
3
3
  const scripts = document.querySelectorAll('script');
4
4
  let injected = false;
5
- scripts.forEach((script)=>{
5
+ scripts.forEach(script => {
6
6
  if (script.src.includes(scriptUrl)) {
7
7
  injected = true;
8
8
  }
9
9
  });
10
10
  return injected;
11
11
  };
12
- export const loadScript = (scriptUrl)=>{
13
- return new Promise((resolve, reject)=>{
12
+ export const loadScript = (scriptUrl) => {
13
+ return new Promise((resolve, reject) => {
14
14
  if (isScriptInjected(scriptUrl)) {
15
15
  resolve();
16
16
  return;
17
17
  }
18
18
  const embedScript = document.createElement('script');
19
19
  embedScript.setAttribute('src', scriptUrl);
20
- embedScript.onload = ()=>{
20
+ embedScript.onload = () => {
21
21
  resolve();
22
22
  };
23
- embedScript.onerror = ()=>{
23
+ embedScript.onerror = () => {
24
24
  const error = new Error(`Failed to load Unlayer script: ${scriptUrl}`);
25
25
  logUnlayerError('Unlayer embed script failed to load', error);
26
26
  reject(error);
@@ -28,10 +28,9 @@ export const loadScript = (scriptUrl)=>{
28
28
  document.head.appendChild(embedScript);
29
29
  });
30
30
  };
31
- export const loadScriptSource = (source)=>{
31
+ export const loadScriptSource = (source) => {
32
32
  const embedScript = document.createElement('script');
33
33
  embedScript.textContent = source;
34
34
  document.head.appendChild(embedScript);
35
35
  };
36
-
37
36
  //# sourceMappingURL=loadScript.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/loadScript.ts"],"sourcesContent":["import { logUnlayerError } from './log';\n\nconst isScriptInjected = (scriptUrl: string) => {\n const scripts = document.querySelectorAll('script');\n let injected = false;\n\n scripts.forEach(script => {\n if (script.src.includes(scriptUrl)) {\n injected = true;\n }\n });\n\n return injected;\n};\n\nexport const loadScript = (scriptUrl: string): Promise<void> => {\n return new Promise<void>((resolve, reject) => {\n if (isScriptInjected(scriptUrl)) {\n resolve();\n return;\n }\n\n const embedScript = document.createElement('script');\n embedScript.setAttribute('src', scriptUrl);\n embedScript.onload = () => {\n resolve();\n };\n embedScript.onerror = () => {\n const error = new Error(`Failed to load Unlayer script: ${scriptUrl}`);\n logUnlayerError('Unlayer embed script failed to load', error);\n reject(error);\n };\n document.head.appendChild(embedScript);\n });\n};\n\nexport const loadScriptSource = (source: string) => {\n const embedScript = document.createElement('script');\n embedScript.textContent = source;\n document.head.appendChild(embedScript);\n};\n"],"names":["logUnlayerError","isScriptInjected","scriptUrl","scripts","document","querySelectorAll","injected","forEach","script","src","includes","loadScript","Promise","resolve","reject","embedScript","createElement","setAttribute","onload","onerror","error","Error","head","appendChild","loadScriptSource","source","textContent"],"mappings":"AAAA,SAASA,eAAe,QAAQ,QAAQ;AAExC,MAAMC,mBAAmB,CAACC;IACtB,MAAMC,UAAUC,SAASC,gBAAgB,CAAC;IAC1C,IAAIC,WAAW;IAEfH,QAAQI,OAAO,CAACC,CAAAA;QACZ,IAAIA,OAAOC,GAAG,CAACC,QAAQ,CAACR,YAAY;YAChCI,WAAW;QACf;IACJ;IAEA,OAAOA;AACX;AAEA,OAAO,MAAMK,aAAa,CAACT;IACvB,OAAO,IAAIU,QAAc,CAACC,SAASC;QAC/B,IAAIb,iBAAiBC,YAAY;YAC7BW;YACA;QACJ;QAEA,MAAME,cAAcX,SAASY,aAAa,CAAC;QAC3CD,YAAYE,YAAY,CAAC,OAAOf;QAChCa,YAAYG,MAAM,GAAG;YACjBL;Q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CAAC,MAAM,GAAG,GAAG,EAAE;YACtB,OAAO,EAAE,CAAC;QACd,CAAC,CAAC;QACF,WAAW,CAAC,OAAO,GAAG,GAAG,EAAE;YACvB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,kCAAkC,SAAS,EAAE,CAAC,CAAC;YACvE,eAAe,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;YAC9D,MAAM,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAE,EAAE;IAC/C,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACrD,WAAW,CAAC,WAAW,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC,CAAC"}
package/dist/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const LOG_PREFIX = '[dte-unlayer]';
2
- export const getErrorMessage = (error)=>{
2
+ export const getErrorMessage = (error) => {
3
3
  if (error instanceof Error && error.message) {
4
4
  return error.message;
5
5
  }
@@ -8,7 +8,7 @@ export const getErrorMessage = (error)=>{
8
8
  }
9
9
  return 'Unknown Unlayer error';
10
10
  };
11
- export const logUnlayerError = (message, error)=>{
11
+ export const logUnlayerError = (message, error) => {
12
12
  if (error === undefined) {
13
13
  // eslint-disable-next-line no-console
14
14
  console.error(LOG_PREFIX, message);
@@ -17,5 +17,4 @@ export const logUnlayerError = (message, error)=>{
17
17
  // eslint-disable-next-line no-console
18
18
  console.error(LOG_PREFIX, message, error);
19
19
  };
20
-
21
20
  //# sourceMappingURL=log.js.map
package/dist/log.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/log.ts"],"sourcesContent":["const LOG_PREFIX = '[dte-unlayer]';\n\nexport const getErrorMessage = (error: unknown) => {\n if (error instanceof Error && error.message) {\n return error.message;\n }\n\n if (typeof error === 'string' && error) {\n return error;\n }\n\n return 'Unknown Unlayer error';\n};\n\nexport const logUnlayerError = (message: string, error?: unknown) => {\n if (error === undefined) {\n // eslint-disable-next-line no-console\n console.error(LOG_PREFIX, message);\n return;\n }\n\n // eslint-disable-next-line no-console\n console.error(LOG_PREFIX, message, error);\n};\n"],"names":["LOG_PREFIX","getErrorMessage","error","Error","message","logUnlayerError","undefined","console"],"mappings":"AAAA,MAAMA,aAAa;AAEnB,OAAO,MAAMC,kBAAkB,CAACC;IAC5B,IAAIA,iBAAiBC,SAASD,MAAME,OAAO,EAAE;QACzC,OAAOF,MAAME,OAAO;IACxB;IAEA,IAAI,OAAOF,UAAU,YAAYA,OAAO;QACpC,OAAOA;IACX;IAEA,OAAO;AACX,EAAE;AAEF,OAAO,MAAMG,kBAAkB,CAACD,SAAiBF;IAC7C,IAAIA,UAAUI,WAAW;QACrB,sCAAsC;QACtCC,QAAQL,KAAK,CAACF,YAAYI;QAC1B;IACJ;IAEA,sCAAsC;IACtCG,QAAQL,KAAK,CAACF,YAAYI,SAASF;AACvC,EAAE"}
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,eAAe,CAAC;AAEnC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAc,EAAE,EAAE;IAC9C,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC,OAAO,CAAC;IACzB,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,uBAAuB,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,KAAe,EAAE,EAAE;IAChE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACnC,OAAO;IACX,CAAC;IAED,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC"}
@@ -1,33 +1,34 @@
1
1
  export function isUnlayerMergeTagGroup(entry) {
2
2
  return 'mergeTags' in entry;
3
3
  }
4
- const toMergeTagKey = (value)=>{
5
- const key = value.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join('_');
4
+ const toMergeTagKey = (value) => {
5
+ const key = value
6
+ .toLowerCase()
7
+ .split(/[^a-z0-9]+/)
8
+ .filter(Boolean)
9
+ .join('_');
6
10
  return key || value;
7
11
  };
8
12
  /**
9
13
  * Normalizes the host `group` into the submenu path the tag belongs to:
10
14
  * `'Custom Fields'` → `['Custom Fields']`, `['Forms', 'Intake']` → `['Forms', 'Intake']`.
11
15
  * Blank segments are dropped; an empty result means the tag stays at the top level.
12
- */ const toGroupPath = (group)=>{
13
- const segments = Array.isArray(group) ? group : group === undefined ? [] : [
14
- group
15
- ];
16
- return segments.map((segment)=>segment.trim()).filter(Boolean);
16
+ */
17
+ const toGroupPath = (group) => {
18
+ const segments = Array.isArray(group) ? group : group === undefined ? [] : [group];
19
+ return segments.map(segment => segment.trim()).filter(Boolean);
17
20
  };
18
- /** Returns the `mergeTags` record of the (possibly nested) group at `path`, creating groups on the way. */ const ensureGroup = (root, path)=>{
21
+ /** Returns the `mergeTags` record of the (possibly nested) group at `path`, creating groups on the way. */
22
+ const ensureGroup = (root, path) => {
19
23
  let current = root;
20
- for (const groupName of path){
24
+ for (const groupName of path) {
21
25
  const groupKey = toMergeTagKey(groupName);
22
26
  const existing = current[groupKey];
23
27
  if (existing && isUnlayerMergeTagGroup(existing)) {
24
28
  current = existing.mergeTags;
25
29
  continue;
26
30
  }
27
- const created = {
28
- name: groupName,
29
- mergeTags: {}
30
- };
31
+ const created = { name: groupName, mergeTags: {} };
31
32
  current[groupKey] = created;
32
33
  current = created.mergeTags;
33
34
  }
@@ -37,15 +38,16 @@ const toMergeTagKey = (value)=>{
37
38
  * Builds Unlayer's `mergeTags` config. With `groups` enabled (default) tags nest under the
38
39
  * submenu path in `group`; `UnlayerStore` applies that shape once the editor is ready, since
39
40
  * nested groups at `createEditor` time prevent DTE custom tools from loading.
40
- */ export const toUnlayerMergeTags = (tags, options)=>{
41
+ */
42
+ export const toUnlayerMergeTags = (tags, options) => {
41
43
  if (!(tags === null || tags === void 0 ? void 0 : tags.length)) {
42
44
  return undefined;
43
45
  }
44
46
  const groupsEnabled = (options === null || options === void 0 ? void 0 : options.groups) !== false;
45
- return tags.reduce((out, tag)=>{
47
+ return tags.reduce((out, tag) => {
46
48
  const mergeTag = {
47
49
  name: tag.name,
48
- value: tag.propertyPath
50
+ value: tag.propertyPath,
49
51
  };
50
52
  const tagKey = toMergeTagKey(tag.id);
51
53
  const groupPath = groupsEnabled ? toGroupPath(tag.group) : [];
@@ -53,5 +55,4 @@ const toMergeTagKey = (value)=>{
53
55
  return out;
54
56
  }, {});
55
57
  };
56
-
57
58
  //# sourceMappingURL=merge-tags.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/merge-tags.ts"],"sourcesContent":["import { UnlayerEditorMergeTagInfo } from './unlayer-interface';\n\nexport interface UnlayerMergeTagLeaf {\n name: string;\n value: string;\n}\n\nexport interface UnlayerMergeTagGroup {\n name: string;\n /** Nested submenu: leaves and/or further groups (Unlayer supports arbitrary depth). */\n mergeTags: UnlayerMergeTagsConfig;\n}\n\nexport type UnlayerMergeTagsConfig = Record<string, UnlayerMergeTagLeaf | UnlayerMergeTagGroup>;\n\nexport interface ToUnlayerMergeTagsOptions {\n /**\n * When false, ignore `group` and emit the flat 0.151 shape. Unlayer custom\n * tools fail to register if nested groups are present during createEditor.\n */\n groups?: boolean;\n}\n\nexport function isUnlayerMergeTagGroup(\n entry: UnlayerMergeTagLeaf | UnlayerMergeTagGroup,\n): entry is UnlayerMergeTagGroup {\n return 'mergeTags' in entry;\n}\n\nconst toMergeTagKey = (value: string) => {\n const key = value\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter(Boolean)\n .join('_');\n\n return key || value;\n};\n\n/**\n * Normalizes the host `group` into the submenu path the tag belongs to:\n * `'Custom Fields'` → `['Custom Fields']`, `['Forms', 'Intake']` → `['Forms', 'Intake']`.\n * Blank segments are dropped; an empty result means the tag stays at the top level.\n */\nconst toGroupPath = (group: UnlayerEditorMergeTagInfo['group']): string[] => {\n const segments = Array.isArray(group) ? group : group === undefined ? [] : [group];\n\n return segments.map(segment => segment.trim()).filter(Boolean);\n};\n\n/** Returns the `mergeTags` record of the (possibly nested) group at `path`, creating groups on the way. */\nconst ensureGroup = (root: UnlayerMergeTagsConfig, path: string[]) => {\n let current = root;\n\n for (const groupName of path) {\n const groupKey = toMergeTagKey(groupName);\n const existing = current[groupKey];\n\n if (existing && isUnlayerMergeTagGroup(existing)) {\n current = existing.mergeTags;\n continue;\n }\n\n const created: UnlayerMergeTagGroup = { name: groupName, mergeTags: {} };\n current[groupKey] = created;\n current = created.mergeTags;\n }\n\n return current;\n};\n\n/**\n * Builds Unlayer's `mergeTags` config. With `groups` enabled (default) tags nest under the\n * submenu path in `group`; `UnlayerStore` applies that shape once the editor is ready, since\n * nested groups at `createEditor` time prevent DTE custom tools from loading.\n */\nexport const toUnlayerMergeTags = (\n tags: UnlayerEditorMergeTagInfo[] | undefined,\n options?: ToUnlayerMergeTagsOptions,\n) => {\n if (!tags?.length) {\n return undefined;\n }\n\n const groupsEnabled = options?.groups !== false;\n\n return tags.reduce<UnlayerMergeTagsConfig>((out, tag) => {\n const mergeTag: UnlayerMergeTagLeaf = {\n name: tag.name,\n value: tag.propertyPath,\n };\n const tagKey = toMergeTagKey(tag.id);\n const groupPath = groupsEnabled ? toGroupPath(tag.group) : [];\n\n ensureGroup(out, groupPath)[tagKey] = mergeTag;\n\n return out;\n }, {});\n};\n"],"names":["isUnlayerMergeTagGroup","entry","toMergeTagKey","value","key","toLowerCase","split","filter","Boolean","join","toGroupPath","group","segments","Array","isArray","undefined","map","segment","trim","ensureGroup","root","path","current","groupName","groupKey","existing","mergeTags","created","name","toUnlayerMergeTags","tags","options","length","groupsEnabled","groups","reduce","out","tag","mergeTag","propertyPath","tagKey","id","groupPath"],"mappings":"AAuBA,OAAO,SAASA,uBACZC,KAAiD;IAEjD,OAAO,eAAeA;AAC1B;AAEA,MAAMC,gBAAgB,CAACC;IACnB,MAAMC,MAAMD,MACPE,WAAW,GACXC,KAAK,CAAC,cACNC,MAAM,CAACC,SACPC,IAAI,CAAC;IAEV,OAAOL,OAAOD;AAClB;AAEA;;;;CAIC,GACD,MAAMO,cAAc,CAACC;IACjB,MAAMC,WAAWC,MAAMC,OAAO,CAACH,SAASA,QAAQA,UAAUI,YAAY,EAAE,GAAG;QAACJ;KAAM;IAElF,OAAOC,SAASI,GAAG,CAACC,CAAAA,UAAWA,QAAQC,IAAI,IAAIX,MAAM,CAACC;AAC1D;AAEA,yGAAyG,GACzG,MAAMW,cAAc,CAACC,MAA8BC;IAC/C,IAAIC,UAAUF;IAEd,KAAK,MAAMG,aAAaF,KAAM;QAC1B,MAAMG,WAAWtB,cAAcqB;QAC/B,MAAME,WAAWH,OAAO,CAACE,SAAS;QAElC,IAAIC,YAAYzB,uBAAuByB,WAAW;YAC9CH,UAAUG,SAASC,SAAS;YAC5B;QACJ;QAEA,MAAMC,UAAgC;YAAEC,MAAML;YAAWG,WAAW,CAAC;QAAE;QACvEJ,OAAO,CAACE,SAAS,GAAGG;QACpBL,UAAUK,QAAQD,SAAS;IAC/B;IAEA,OAAOJ;AACX;AAEA;;;;CAIC,GACD,OAAO,MAAMO,qBAAqB,CAC9BC,MACAC;IAEA,IAAI,EAACD,iBAAAA,2BAAAA,KAAME,MAAM,GAAE;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AAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAE9D,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;QAE/C,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;AACX,CAAC,CAAC"}
@@ -1,7 +1,6 @@
1
1
  export const defaultImageValidation = {
2
2
  maxWidth: 5000,
3
3
  maxHeight: 5000,
4
- maxFileSize: 10 * 1024 * 1024
4
+ maxFileSize: 10 * 1024 * 1024, // 10mb
5
5
  };
6
-
7
6
  //# sourceMappingURL=configs.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/shared/configs.ts"],"sourcesContent":["export const defaultImageValidation = {\n maxWidth: 5000,\n maxHeight: 5000,\n maxFileSize: 10 * 1024 * 1024, // 10mb\n};\n"],"names":["defaultImageValidation","maxWidth","maxHeight","maxFileSize"],"mappings":"AAAA,OAAO,MAAMA,yBAAyB;IAClCC,UAAU;IACVC,WAAW;IACXC,aAAa,KAAK,OAAO;AAC7B,EAAE"}
1
+ {"version":3,"file":"configs.js","sourceRoot":"","sources":["../../src/shared/configs.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,OAAO;CACzC,CAAC"}