@servicetitan/dte-pdf-editor 1.72.0 → 1.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.
Files changed (221) hide show
  1. package/dist/components/display-conditions/condition-row.d.ts +1 -1
  2. package/dist/components/display-conditions/condition-row.d.ts.map +1 -1
  3. package/dist/components/display-conditions/display-condition.d.ts +1 -1
  4. package/dist/components/display-conditions/display-condition.d.ts.map +1 -1
  5. package/dist/components/display-conditions/display-condition.js.map +1 -1
  6. package/dist/components/field-config-panel/advanced-settings.d.ts +1 -1
  7. package/dist/components/field-config-panel/advanced-settings.d.ts.map +1 -1
  8. package/dist/components/field-config-panel/field-config-panel-overlay.d.ts +1 -1
  9. package/dist/components/field-config-panel/field-config-panel-overlay.d.ts.map +1 -1
  10. package/dist/components/field-config-panel/field-config-panel.d.ts +1 -1
  11. package/dist/components/field-config-panel/field-config-panel.d.ts.map +1 -1
  12. package/dist/components/field-config-panel/field-sidebar.d.ts +1 -1
  13. package/dist/components/field-config-panel/field-sidebar.d.ts.map +1 -1
  14. package/dist/components/field-config-panel/field-sidebar.js.map +1 -1
  15. package/dist/components/field-config-panel/formula-generator.d.ts +1 -1
  16. package/dist/components/field-config-panel/formula-generator.d.ts.map +1 -1
  17. package/dist/components/field-config-panel/formula-modal.d.ts +1 -1
  18. package/dist/components/field-config-panel/formula-modal.d.ts.map +1 -1
  19. package/dist/components/field-config-panel/formula-workspace.d.ts +1 -1
  20. package/dist/components/field-config-panel/formula-workspace.d.ts.map +1 -1
  21. package/dist/components/field-config-panel/result-type-selector.d.ts +1 -1
  22. package/dist/components/field-config-panel/result-type-selector.d.ts.map +1 -1
  23. package/dist/components/field-config-panel/table-configs.d.ts +1 -1
  24. package/dist/components/field-config-panel/table-configs.d.ts.map +1 -1
  25. package/dist/components/field-sidebar/calculated-field-type-list.d.ts +1 -1
  26. package/dist/components/field-sidebar/calculated-field-type-list.d.ts.map +1 -1
  27. package/dist/components/field-sidebar/data-model-field-type-list.d.ts +1 -1
  28. package/dist/components/field-sidebar/data-model-field-type-list.d.ts.map +1 -1
  29. package/dist/components/field-sidebar/e-sign-field-type-list.d.ts +1 -1
  30. package/dist/components/field-sidebar/e-sign-field-type-list.d.ts.map +1 -1
  31. package/dist/components/field-sidebar/field-sidebar.d.ts +1 -1
  32. package/dist/components/field-sidebar/field-sidebar.d.ts.map +1 -1
  33. package/dist/components/field-sidebar/fillable-field-type-list.d.ts +1 -1
  34. package/dist/components/field-sidebar/fillable-field-type-list.d.ts.map +1 -1
  35. package/dist/components/field-sidebar/form-fields-type-list.d.ts +1 -1
  36. package/dist/components/field-sidebar/form-fields-type-list.d.ts.map +1 -1
  37. package/dist/components/field-sidebar/generic-field-type-list.d.ts +1 -1
  38. package/dist/components/field-sidebar/generic-field-type-list.d.ts.map +1 -1
  39. package/dist/components/pdf-canvas/pdf-canvas.d.ts +1 -1
  40. package/dist/components/pdf-canvas/pdf-canvas.d.ts.map +1 -1
  41. package/dist/components/pdf-editor/pdf-editor.d.ts +1 -1
  42. package/dist/components/pdf-editor/pdf-editor.d.ts.map +1 -1
  43. package/dist/components/pdf-fields-overlay/pdf-fields-overlay.d.ts +1 -1
  44. package/dist/components/pdf-fields-overlay/pdf-fields-overlay.d.ts.map +1 -1
  45. package/dist/components/pdf-fields-overlay/pdf-overlay-field-calculated.d.ts +1 -1
  46. package/dist/components/pdf-fields-overlay/pdf-overlay-field-calculated.d.ts.map +1 -1
  47. package/dist/components/pdf-fields-overlay/pdf-overlay-field-data-model.d.ts +1 -1
  48. package/dist/components/pdf-fields-overlay/pdf-overlay-field-data-model.d.ts.map +1 -1
  49. package/dist/components/pdf-fields-overlay/pdf-overlay-field-e-sign.d.ts +1 -1
  50. package/dist/components/pdf-fields-overlay/pdf-overlay-field-e-sign.d.ts.map +1 -1
  51. package/dist/components/pdf-fields-overlay/pdf-overlay-field-fillable.d.ts +1 -1
  52. package/dist/components/pdf-fields-overlay/pdf-overlay-field-fillable.d.ts.map +1 -1
  53. package/dist/components/pdf-fields-overlay/pdf-overlay-field-generic.d.ts +1 -1
  54. package/dist/components/pdf-fields-overlay/pdf-overlay-field-generic.d.ts.map +1 -1
  55. package/dist/components/pdf-fields-overlay/pdf-overlay-field.d.ts +1 -1
  56. package/dist/components/pdf-fields-overlay/pdf-overlay-field.d.ts.map +1 -1
  57. package/dist/components/pdf-fields-overlay/pdf-overlay-field.js.map +1 -1
  58. package/dist/components/pdf-view/pdf-view-calculated.d.ts +1 -1
  59. package/dist/components/pdf-view/pdf-view-calculated.d.ts.map +1 -1
  60. package/dist/components/pdf-view/pdf-view-data-model.d.ts +1 -1
  61. package/dist/components/pdf-view/pdf-view-data-model.d.ts.map +1 -1
  62. package/dist/components/pdf-view/pdf-view-e-sign.d.ts +1 -1
  63. package/dist/components/pdf-view/pdf-view-e-sign.d.ts.map +1 -1
  64. package/dist/components/pdf-view/pdf-view-field-container.d.ts +1 -1
  65. package/dist/components/pdf-view/pdf-view-field-container.d.ts.map +1 -1
  66. package/dist/components/pdf-view/pdf-view-fillable.d.ts +1 -1
  67. package/dist/components/pdf-view/pdf-view-fillable.d.ts.map +1 -1
  68. package/dist/components/pdf-view/pdf-view-fillable.js.map +1 -1
  69. package/dist/components/pdf-view/pdf-view-generic.d.ts +1 -1
  70. package/dist/components/pdf-view/pdf-view-generic.d.ts.map +1 -1
  71. package/dist/components/pdf-view/pdf-view.d.ts +1 -1
  72. package/dist/components/pdf-view/pdf-view.d.ts.map +1 -1
  73. package/dist/constants/field.constants.d.ts +1 -1
  74. package/dist/constants/field.constants.d.ts.map +1 -1
  75. package/dist/hooks/useFieldDrag.d.ts +1 -1
  76. package/dist/hooks/useFieldDrag.d.ts.map +1 -1
  77. package/dist/hooks/useFieldResize.d.ts +1 -1
  78. package/dist/hooks/useFieldResize.d.ts.map +1 -1
  79. package/dist/hooks/useFormFields.d.ts +1 -1
  80. package/dist/hooks/useFormFields.d.ts.map +1 -1
  81. package/dist/hooks/usePdfFieldDnD.d.ts +1 -1
  82. package/dist/hooks/usePdfFieldDnD.d.ts.map +1 -1
  83. package/dist/hooks/usePdfFieldSelection.d.ts +1 -1
  84. package/dist/hooks/usePdfFieldSelection.d.ts.map +1 -1
  85. package/dist/styles/field-config-panel-overlay.css +35 -0
  86. package/dist/styles/field-sidebar.css +63 -0
  87. package/dist/styles/field-type-list.css +9 -0
  88. package/dist/styles/field-type.css +17 -0
  89. package/dist/styles/formula-modal.css +221 -0
  90. package/dist/styles/generic.css +16 -0
  91. package/dist/styles/index.css +12 -0
  92. package/dist/styles/inline-editable.css +22 -0
  93. package/dist/styles/pdf-canvas.css +11 -0
  94. package/dist/styles/pdf-document-renderer.css +4 -0
  95. package/dist/styles/pdf-editor.css +15 -0
  96. package/dist/styles/pdf-field-overlay.css +201 -0
  97. package/dist/styles/variables.css +47 -0
  98. package/dist/utils/conditions/evaluate.utils.d.ts +1 -1
  99. package/dist/utils/conditions/evaluate.utils.d.ts.map +1 -1
  100. package/dist/utils/conditions/schema-data-points.utils.d.ts +1 -1
  101. package/dist/utils/conditions/schema-data-points.utils.d.ts.map +1 -1
  102. package/dist/utils/data-model/extract-fields.utils.d.ts +1 -1
  103. package/dist/utils/data-model/extract-fields.utils.d.ts.map +1 -1
  104. package/dist/utils/data-model/resolve-values.utils.d.ts +1 -1
  105. package/dist/utils/data-model/resolve-values.utils.d.ts.map +1 -1
  106. package/dist/utils/field/field-drag.utils.d.ts +1 -1
  107. package/dist/utils/field/field-drag.utils.d.ts.map +1 -1
  108. package/dist/utils/field/field-placeholder-text.utils.d.ts +1 -1
  109. package/dist/utils/field/field-placeholder-text.utils.d.ts.map +1 -1
  110. package/dist/utils/field/field-resize.utils.d.ts +1 -1
  111. package/dist/utils/field/field-resize.utils.d.ts.map +1 -1
  112. package/dist/utils/field/get-field-bounds-style.utils.d.ts +1 -1
  113. package/dist/utils/field/get-field-bounds-style.utils.d.ts.map +1 -1
  114. package/dist/utils/field/get-field-bounds-style.utils.js.map +1 -1
  115. package/dist/utils/field/get-field-font-size.utils.d.ts +1 -1
  116. package/dist/utils/field/get-field-font-size.utils.d.ts.map +1 -1
  117. package/dist/utils/field/get-field-font-size.utils.js.map +1 -1
  118. package/dist/utils/field/get-field-text-clip.utils.d.ts +1 -1
  119. package/dist/utils/field/get-field-text-clip.utils.d.ts.map +1 -1
  120. package/dist/utils/field/get-field-text-clip.utils.js.map +1 -1
  121. package/dist/utils/field/get-field-typography.utils.d.ts +1 -1
  122. package/dist/utils/field/get-field-typography.utils.d.ts.map +1 -1
  123. package/dist/utils/formula/evaluate-formula.utils.d.ts +1 -1
  124. package/dist/utils/formula/evaluate-formula.utils.d.ts.map +1 -1
  125. package/dist/utils/formula/expression.utils.d.ts +1 -1
  126. package/dist/utils/formula/expression.utils.d.ts.map +1 -1
  127. package/dist/utils/formula/form-fields.utils.d.ts +1 -1
  128. package/dist/utils/formula/form-fields.utils.d.ts.map +1 -1
  129. package/dist/utils/formula/format-calculated-result.utils.d.ts +1 -1
  130. package/dist/utils/formula/format-calculated-result.utils.d.ts.map +1 -1
  131. package/dist/utils/formula/validate-formula.utils.d.ts +1 -1
  132. package/dist/utils/formula/validate-formula.utils.d.ts.map +1 -1
  133. package/dist/utils/pdf/pdfjs-init.js +9 -1
  134. package/dist/utils/pdf/pdfjs-init.js.map +1 -1
  135. package/dist/utils/recipients/map-colors.d.ts +1 -1
  136. package/dist/utils/recipients/map-colors.d.ts.map +1 -1
  137. package/dist/utils/shared/sample-data.utils.d.ts +1 -1
  138. package/dist/utils/shared/sample-data.utils.d.ts.map +1 -1
  139. package/package.json +5 -1
  140. package/src/__tests__/field-types/date-fields.test.ts +3 -3
  141. package/src/__tests__/field-types/display-condition-fields.test.ts +5 -5
  142. package/src/__tests__/field-types/e-sign-fields.test.ts +2 -2
  143. package/src/__tests__/field-types/fillable-fields.test.ts +2 -4
  144. package/src/__tests__/field-types/form-fields.test.ts +10 -18
  145. package/src/__tests__/field-types/formula-fields.test.ts +6 -11
  146. package/src/__tests__/field-types/merge-tag-fields.test.ts +1 -5
  147. package/src/components/display-conditions/condition-row.tsx +6 -6
  148. package/src/components/display-conditions/display-condition.tsx +11 -12
  149. package/src/components/field-config-panel/advanced-settings.tsx +1 -1
  150. package/src/components/field-config-panel/field-config-panel-overlay.tsx +5 -5
  151. package/src/components/field-config-panel/field-config-panel.tsx +5 -5
  152. package/src/components/field-config-panel/field-sidebar.tsx +5 -1
  153. package/src/components/field-config-panel/formula-generator.tsx +8 -8
  154. package/src/components/field-config-panel/formula-modal.tsx +7 -7
  155. package/src/components/field-config-panel/formula-workspace.tsx +1 -1
  156. package/src/components/field-config-panel/result-type-selector.tsx +1 -1
  157. package/src/components/field-config-panel/table-configs.tsx +1 -1
  158. package/src/components/field-sidebar/calculated-field-type-list.tsx +1 -1
  159. package/src/components/field-sidebar/data-model-field-type-list.tsx +1 -1
  160. package/src/components/field-sidebar/e-sign-field-type-list.tsx +1 -1
  161. package/src/components/field-sidebar/field-sidebar.tsx +3 -3
  162. package/src/components/field-sidebar/fillable-field-type-list.tsx +1 -1
  163. package/src/components/field-sidebar/form-fields-type-list.tsx +1 -1
  164. package/src/components/field-sidebar/generic-field-type-list.tsx +1 -1
  165. package/src/components/pdf-canvas/pdf-canvas.tsx +1 -1
  166. package/src/components/pdf-editor/pdf-editor.tsx +5 -5
  167. package/src/components/pdf-fields-overlay/pdf-fields-overlay.tsx +1 -1
  168. package/src/components/pdf-fields-overlay/pdf-overlay-field-calculated.tsx +1 -1
  169. package/src/components/pdf-fields-overlay/pdf-overlay-field-data-model.tsx +1 -1
  170. package/src/components/pdf-fields-overlay/pdf-overlay-field-e-sign.tsx +1 -1
  171. package/src/components/pdf-fields-overlay/pdf-overlay-field-fillable.tsx +1 -1
  172. package/src/components/pdf-fields-overlay/pdf-overlay-field-generic.tsx +3 -3
  173. package/src/components/pdf-fields-overlay/pdf-overlay-field.tsx +1 -1
  174. package/src/components/pdf-view/pdf-view-calculated.tsx +1 -1
  175. package/src/components/pdf-view/pdf-view-data-model.tsx +1 -1
  176. package/src/components/pdf-view/pdf-view-e-sign.tsx +1 -1
  177. package/src/components/pdf-view/pdf-view-field-container.tsx +1 -1
  178. package/src/components/pdf-view/pdf-view-fillable.tsx +6 -1
  179. package/src/components/pdf-view/pdf-view-generic.tsx +3 -3
  180. package/src/components/pdf-view/pdf-view.tsx +5 -5
  181. package/src/constants/field.constants.ts +4 -4
  182. package/src/hooks/useFieldDrag.ts +1 -1
  183. package/src/hooks/useFieldResize.ts +1 -1
  184. package/src/hooks/useFormFields.ts +4 -4
  185. package/src/hooks/usePdfFieldDnD.ts +3 -3
  186. package/src/hooks/usePdfFieldSelection.ts +1 -1
  187. package/src/styles/field-sidebar.css +2 -3
  188. package/src/utils/conditions/__tests__/evaluate.utils.test.ts +16 -24
  189. package/src/utils/conditions/__tests__/schema-data-points.utils.test.ts +7 -2
  190. package/src/utils/conditions/evaluate.utils.ts +4 -4
  191. package/src/utils/conditions/schema-data-points.utils.ts +1 -1
  192. package/src/utils/data-model/__tests__/extract-fields.utils.test.ts +1 -1
  193. package/src/utils/data-model/__tests__/resolve-values.utils.test.ts +1 -1
  194. package/src/utils/data-model/extract-fields.utils.ts +7 -7
  195. package/src/utils/data-model/resolve-values.utils.ts +1 -1
  196. package/src/utils/field/__tests__/field-placeholder-text.utils.test.ts +1 -1
  197. package/src/utils/field/__tests__/get-field-bounds-style.utils.test.ts +1 -1
  198. package/src/utils/field/__tests__/get-field-text-clip.utils.test.ts +4 -4
  199. package/src/utils/field/__tests__/get-field-typography.utils.test.ts +1 -1
  200. package/src/utils/field/field-drag.utils.ts +1 -1
  201. package/src/utils/field/field-placeholder-text.utils.ts +1 -1
  202. package/src/utils/field/field-resize.utils.ts +1 -1
  203. package/src/utils/field/get-field-bounds-style.utils.ts +1 -1
  204. package/src/utils/field/get-field-font-size.utils.ts +1 -1
  205. package/src/utils/field/get-field-text-clip.utils.ts +1 -1
  206. package/src/utils/field/get-field-typography.utils.ts +1 -1
  207. package/src/utils/formula/__tests__/evaluate-formula.utils.test.ts +2 -6
  208. package/src/utils/formula/__tests__/expression.utils.test.ts +4 -11
  209. package/src/utils/formula/__tests__/form-fields.utils.test.ts +4 -4
  210. package/src/utils/formula/__tests__/format-calculated-result.utils.test.ts +6 -6
  211. package/src/utils/formula/__tests__/validate-formula.utils.test.ts +6 -10
  212. package/src/utils/formula/evaluate-formula.utils.ts +4 -4
  213. package/src/utils/formula/expression.utils.ts +4 -4
  214. package/src/utils/formula/form-fields.utils.ts +8 -8
  215. package/src/utils/formula/format-calculated-result.utils.ts +1 -1
  216. package/src/utils/formula/validate-formula.utils.ts +1 -1
  217. package/src/utils/pdf/pdfjs-init.ts +11 -1
  218. package/src/utils/recipients/__tests__/map-colors.test.ts +1 -1
  219. package/src/utils/recipients/map-colors.ts +1 -1
  220. package/src/utils/shared/sample-data.utils.ts +1 -1
  221. package/src/vite-env.d.ts +1 -1
@@ -1,10 +1,9 @@
1
- import {
2
- DisplayConditionSingle,
3
- DisplayConditionState,
4
- } from '../../../interface/types';
1
+ import { type DisplayConditionSingle, type DisplayConditionState } from '../../../interface/types';
5
2
  import { evaluateDisplayCondition } from '../evaluate.utils';
6
3
 
7
- const buildCondition = (overrides: Partial<DisplayConditionSingle> = {}): DisplayConditionSingle => ({
4
+ const buildCondition = (
5
+ overrides: Partial<DisplayConditionSingle> = {},
6
+ ): DisplayConditionSingle => ({
8
7
  id: 'c1',
9
8
  dataPointKey: 'name',
10
9
  operator: 'is_equal_to',
@@ -50,9 +49,7 @@ describe('evaluateDisplayCondition', () => {
50
49
  ['ends_with', 'John', 'hn', true],
51
50
  ['ends_with', 'John', 'Do', false],
52
51
  ])('%s "%s" vs "%s" returns %s', (operator, actual, expected, result) => {
53
- const state = buildState([
54
- buildCondition({ operator, value: expected }),
55
- ]);
52
+ const state = buildState([buildCondition({ operator, value: expected })]);
56
53
  expect(subject(state, { name: actual })).toBe(result);
57
54
  });
58
55
  });
@@ -82,9 +79,7 @@ describe('evaluateDisplayCondition', () => {
82
79
  ['num_lte', 5, '5', true],
83
80
  ['num_lte', 6, '5', false],
84
81
  ])('%s with %p vs "%s" returns %s', (operator, actual, value, expected) => {
85
- const state = buildState([
86
- buildCondition({ dataPointKey: 'amount', operator, value }),
87
- ]);
82
+ const state = buildState([buildCondition({ dataPointKey: 'amount', operator, value })]);
88
83
  expect(subject(state, { amount: actual })).toBe(expected);
89
84
  });
90
85
  });
@@ -167,18 +162,15 @@ describe('evaluateDisplayCondition', () => {
167
162
  ['is_equal_to', false, false],
168
163
  ['is_not_equal_to', true, false],
169
164
  ['is_not_equal_to', false, true],
170
- ])(
171
- '%s against "true" with session %p returns %s',
172
- (operator, actual, expected) => {
173
- const state = buildState([
174
- buildCondition({
175
- dataPointKey: 'agree',
176
- operator,
177
- value: 'true',
178
- }),
179
- ]);
180
- expect(subject(state, { agree: actual })).toBe(expected);
181
- },
182
- );
165
+ ])('%s against "true" with session %p returns %s', (operator, actual, expected) => {
166
+ const state = buildState([
167
+ buildCondition({
168
+ dataPointKey: 'agree',
169
+ operator,
170
+ value: 'true',
171
+ }),
172
+ ]);
173
+ expect(subject(state, { agree: actual })).toBe(expected);
174
+ });
183
175
  });
184
176
  });
@@ -1,4 +1,4 @@
1
- import { FieldTypeEnum, PdfField, SchemaObject } from '../../../interface/types';
1
+ import { FieldTypeEnum, type PdfField, type SchemaObject } from '../../../interface/types';
2
2
  import {
3
3
  getDataPointOptions,
4
4
  getDocumentFieldsDataPointOptions,
@@ -167,7 +167,12 @@ describe('getDocumentFieldsDataPointOptions', () => {
167
167
  label: 'No',
168
168
  groupName: 'Payment Method',
169
169
  }),
170
- buildField({ id: 'text-1', path: 'fillable_signer1_name', label: 'Name', subType: 'text' }),
170
+ buildField({
171
+ id: 'text-1',
172
+ path: 'fillable_signer1_name',
173
+ label: 'Name',
174
+ subType: 'text',
175
+ }),
171
176
  ];
172
177
 
173
178
  expect(subject(fields)).toEqual([
@@ -1,8 +1,8 @@
1
1
  import {
2
- ConditionOperator,
3
- DataModelValues,
4
- DisplayConditionGroup,
5
- DisplayConditionState,
2
+ type ConditionOperator,
3
+ type DataModelValues,
4
+ type DisplayConditionGroup,
5
+ type DisplayConditionState,
6
6
  VALUE_LESS_OPERATORS,
7
7
  } from '../../interface/types';
8
8
 
@@ -1,5 +1,5 @@
1
1
  import {
2
- DataPointOption,
2
+ type DataPointOption,
3
3
  FieldTypeEnum,
4
4
  type PdfField,
5
5
  type SchemaNode,
@@ -1,4 +1,4 @@
1
- import { FieldTypeEnum, SchemaObject } from '../../../interface/types';
1
+ import { FieldTypeEnum, type SchemaObject } from '../../../interface/types';
2
2
  import { extractGroupedFieldsFromDataModel } from '../extract-fields.utils';
3
3
 
4
4
  const emptySchema: SchemaObject = { type: 'object', properties: {} };
@@ -1,4 +1,4 @@
1
- import { DataModelValues } from '../../../interface/types';
1
+ import { type DataModelValues } from '../../../interface/types';
2
2
  import { resolvePdfDataValues } from '../resolve-values.utils';
3
3
 
4
4
  describe('resolvePdfDataValues', () => {
@@ -1,12 +1,12 @@
1
1
  import {
2
- DataModelFieldGroup,
2
+ type DataModelFieldGroup,
3
3
  FieldTypeEnum,
4
- FieldTypeOption,
5
- SchemaFieldType,
6
- SchemaNode,
7
- SchemaObject,
8
- SchemaSimpleDate,
9
- SchemaSimpleNumber,
4
+ type FieldTypeOption,
5
+ type SchemaFieldType,
6
+ type SchemaNode,
7
+ type SchemaObject,
8
+ type SchemaSimpleDate,
9
+ type SchemaSimpleNumber,
10
10
  } from '../../interface/types';
11
11
 
12
12
  function isSchemaSimpleNumber(node: SchemaNode): node is SchemaSimpleNumber {
@@ -1,4 +1,4 @@
1
- import { DataModelValues } from '../../interface/types';
1
+ import { type DataModelValues } from '../../interface/types';
2
2
 
3
3
  export const resolvePdfDataValues = (
4
4
  data: DataModelValues | undefined,
@@ -1,4 +1,4 @@
1
- import { FieldTypeEnum, PdfField } from '../../../interface/types';
1
+ import { FieldTypeEnum, type PdfField } from '../../../interface/types';
2
2
  import { getFieldPlaceholderText } from '../field-placeholder-text.utils';
3
3
 
4
4
  const buildField = (overrides: Partial<PdfField> = {}): PdfField => ({
@@ -1,4 +1,4 @@
1
- import { ESignFieldType, FieldTypeEnum, PdfField } from '../../../interface/types';
1
+ import { ESignFieldType, FieldTypeEnum, type PdfField } from '../../../interface/types';
2
2
  import { pointsToPixels } from '../../pdf';
3
3
  import { getFieldBoundsStyle } from '../get-field-bounds-style.utils';
4
4
 
@@ -1,4 +1,4 @@
1
- import { FieldTypeEnum, PdfField } from '../../../interface/types';
1
+ import { FieldTypeEnum, type PdfField } from '../../../interface/types';
2
2
  import { getFieldTextClipClassName, getFieldTextClipMode } from '../get-field-text-clip.utils';
3
3
 
4
4
  const buildField = (overrides: Partial<PdfField> = {}): PdfField => ({
@@ -27,9 +27,9 @@ describe('getFieldTextClipMode', () => {
27
27
 
28
28
  test('uses wrapped for data model and generic text fields', () => {
29
29
  expect(subject(buildField({ type: FieldTypeEnum.dataModel }))).toBe('wrapped');
30
- expect(
31
- subject(buildField({ type: FieldTypeEnum.generic, subType: 'text' })),
32
- ).toBe('wrapped');
30
+ expect(subject(buildField({ type: FieldTypeEnum.generic, subType: 'text' }))).toBe(
31
+ 'wrapped',
32
+ );
33
33
  });
34
34
  });
35
35
 
@@ -1,4 +1,4 @@
1
- import { ESignFieldType, FieldTypeEnum, PdfField } from '../../../interface/types';
1
+ import { ESignFieldType, FieldTypeEnum, type PdfField } from '../../../interface/types';
2
2
  import { DEFAULT_FIELD_FONT_FAMILY, DEFAULT_FIELD_FONT_WEIGHT } from '../../../constants';
3
3
  import { pointsToPixels } from '../../pdf';
4
4
  import { getFieldTypographyStyle } from '../get-field-typography.utils';
@@ -1,5 +1,5 @@
1
1
  import { DragEvent, RefObject } from 'react';
2
- import { PdfField } from '../../interface/types';
2
+ import { type PdfField } from '../../interface/types';
3
3
  import { getPageDimensions, getPageNumberFromClientY, getPagePosition } from '../pdf';
4
4
 
5
5
  interface DragOffset {
@@ -1,4 +1,4 @@
1
- import { PdfField } from '../../interface/types';
1
+ import { type PdfField } from '../../interface/types';
2
2
 
3
3
  export const getFieldPlaceholderText = (field: PdfField, prefix?: string): string => {
4
4
  const requiredIndicator = field.required ? '*' : '';
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from 'react';
2
2
  import { DISABLE_FIELD_RESIZE, FIELD_CONSTANTS } from '../../constants';
3
- import { PdfField } from '../../interface/types';
3
+ import { type PdfField } from '../../interface/types';
4
4
  import { getPageDimensions, getPagePosition } from '../pdf';
5
5
 
6
6
  interface ResizeStartData {
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties } from 'react';
2
- import { FieldTypeEnum, PdfField, PdfFieldSubType } from '../../interface/types';
2
+ import { FieldTypeEnum, type PdfField, type PdfFieldSubType } from '../../interface/types';
3
3
  import { getFieldTypographyStyle } from './get-field-typography.utils';
4
4
 
5
5
  interface FieldBoundsStyleOptions {
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_FIELD_FONT_SIZE } from '../../constants';
2
- import { FieldTypeEnum, PdfField } from '../../interface/types';
2
+ import { FieldTypeEnum, type PdfField } from '../../interface/types';
3
3
  import { pointsToPixels } from '../pdf';
4
4
 
5
5
  export const supportsFieldFontSize = (field: Pick<PdfField, 'type' | 'subType'>) => {
@@ -1,4 +1,4 @@
1
- import { FieldTypeEnum, PdfField } from '../../interface/types';
1
+ import { FieldTypeEnum, type PdfField } from '../../interface/types';
2
2
 
3
3
  export type FieldTextClipMode = 'single-line' | 'multiline' | 'wrapped';
4
4
 
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { DEFAULT_FIELD_FONT_FAMILY, DEFAULT_FIELD_FONT_WEIGHT } from '../../constants';
3
- import { PdfField } from '../../interface/types';
3
+ import { type PdfField } from '../../interface/types';
4
4
  import { getFieldFontSizeInPixels, supportsFieldFontSize } from './get-field-font-size.utils';
5
5
 
6
6
  /**
@@ -1,9 +1,5 @@
1
- import { DataModelValues, StructuredFormula } from '../../../interface/types';
2
- import {
3
- evaluateFormula,
4
- hasDivisionByZero,
5
- valueToNumber,
6
- } from '../evaluate-formula.utils';
1
+ import { type DataModelValues, type StructuredFormula } from '../../../interface/types';
2
+ import { evaluateFormula, hasDivisionByZero, valueToNumber } from '../evaluate-formula.utils';
7
3
 
8
4
  const f = (tokens: StructuredFormula['tokens']): StructuredFormula => ({ tokens });
9
5
 
@@ -1,4 +1,4 @@
1
- import { StructuredFormula } from '../../../interface/types';
1
+ import { type StructuredFormula } from '../../../interface/types';
2
2
  import {
3
3
  normalizeMergeTags,
4
4
  parseExpression,
@@ -60,11 +60,8 @@ describe('tokenizeExpression', () => {
60
60
  });
61
61
 
62
62
  describe('parseExpression', () => {
63
- const subject = (
64
- expression: string,
65
- validPaths: Set<string>,
66
- knownDateFields?: Set<string>,
67
- ) => parseExpression(expression, validPaths, knownDateFields);
63
+ const subject = (expression: string, validPaths: Set<string>, knownDateFields?: Set<string>) =>
64
+ parseExpression(expression, validPaths, knownDateFields);
68
65
 
69
66
  test('drops unknown field identifiers', () => {
70
67
  const validPaths = new Set(['known.path']);
@@ -78,11 +75,7 @@ describe('parseExpression', () => {
78
75
  });
79
76
 
80
77
  test('marks known date fields with fieldType date', () => {
81
- const tokens = subject(
82
- 'a.date + 1',
83
- new Set(['a.date']),
84
- new Set(['a.date']),
85
- );
78
+ const tokens = subject('a.date + 1', new Set(['a.date']), new Set(['a.date']));
86
79
  expect(tokens[0]).toEqual({ type: 'field', path: 'a.date', fieldType: 'date' });
87
80
  });
88
81
 
@@ -1,9 +1,9 @@
1
1
  import {
2
- DataPointOption,
2
+ type DataPointOption,
3
3
  FieldTypeEnum,
4
- FormFieldInfo,
5
- FormFieldsByFormIdI,
6
- FormInfo,
4
+ type FormFieldInfo,
5
+ type FormFieldsByFormIdI,
6
+ type FormInfo,
7
7
  } from '../../../interface/types';
8
8
  import {
9
9
  buildFormFieldKey,
@@ -1,7 +1,7 @@
1
1
  import {
2
- CalculatedFieldFormat,
3
- CalculatedFormatForDate,
4
- CalculatedFormatForNumber,
2
+ type CalculatedFieldFormat,
3
+ type CalculatedFormatForDate,
4
+ type CalculatedFormatForNumber,
5
5
  } from '../../../interface/types';
6
6
  import { formatCalculatedResult } from '../format-calculated-result.utils';
7
7
 
@@ -38,9 +38,9 @@ describe('formatCalculatedResult', () => {
38
38
  });
39
39
 
40
40
  test('floors when roundingMode is floor', () => {
41
- expect(subject(1.999, { ...baseNumberFormat, decimals: 0, roundingMode: 'floor' })).toBe(
42
- '1',
43
- );
41
+ expect(
42
+ subject(1.999, { ...baseNumberFormat, decimals: 0, roundingMode: 'floor' }),
43
+ ).toBe('1');
44
44
  });
45
45
 
46
46
  test('ceils when roundingMode is ceil', () => {
@@ -1,4 +1,4 @@
1
- import { StructuredFormula } from '../../../interface/types';
1
+ import { type StructuredFormula } from '../../../interface/types';
2
2
  import { validateFormula } from '../validate-formula.utils';
3
3
 
4
4
  const f = (tokens: StructuredFormula['tokens']): StructuredFormula => ({ tokens });
@@ -111,9 +111,7 @@ describe('validateFormula', () => {
111
111
  ]),
112
112
  new Set(),
113
113
  );
114
- expect(
115
- result.errors.some(e => e.includes('start with an operand')),
116
- ).toBe(true);
114
+ expect(result.errors.some(e => e.includes('start with an operand'))).toBe(true);
117
115
  });
118
116
 
119
117
  test('reports formula ending with operator', () => {
@@ -124,9 +122,7 @@ describe('validateFormula', () => {
124
122
  ]),
125
123
  new Set(),
126
124
  );
127
- expect(
128
- result.errors.some(e => e.includes('end with an operand')),
129
- ).toBe(true);
125
+ expect(result.errors.some(e => e.includes('end with an operand'))).toBe(true);
130
126
  });
131
127
 
132
128
  test('reports invalid number value', () => {
@@ -145,9 +141,9 @@ describe('validateFormula', () => {
145
141
 
146
142
  test.each(['*', '/'] as const)('rejects %s operator with date fields', operator => {
147
143
  const result = subject(dateFieldFormula(operator), new Set(['d']), new Set(['d']));
148
- expect(
149
- result.errors.some(e => e.includes('Multiply') && e.includes('divide')),
150
- ).toBe(true);
144
+ expect(result.errors.some(e => e.includes('Multiply') && e.includes('divide'))).toBe(
145
+ true,
146
+ );
151
147
  });
152
148
 
153
149
  test('allows + and - with date fields', () => {
@@ -1,8 +1,8 @@
1
1
  import {
2
- DataModelValues,
3
- FormulaOperator,
4
- FormulaToken,
5
- StructuredFormula,
2
+ type DataModelValues,
3
+ type FormulaOperator,
4
+ type FormulaToken,
5
+ type StructuredFormula,
6
6
  } from '../../interface/types';
7
7
  import { resolvePdfDataValues } from '../data-model';
8
8
 
@@ -1,8 +1,8 @@
1
1
  import {
2
- FormFieldsByFormIdI,
3
- FormInfo,
4
- FormulaToken,
5
- StructuredFormula,
2
+ type FormFieldsByFormIdI,
3
+ type FormInfo,
4
+ type FormulaToken,
5
+ type StructuredFormula,
6
6
  } from '../../interface/types';
7
7
  import { tryBuildFormFieldFormulaSnapshot } from './form-fields.utils';
8
8
 
@@ -1,13 +1,13 @@
1
1
  import {
2
- DataPointOption,
2
+ type DataPointOption,
3
3
  FieldTypeEnum,
4
- FieldTypeOption,
5
- FormFieldInfo,
6
- FormFieldsByFormIdI,
7
- FormFieldType,
8
- FormInfo,
9
- FormulaFieldFormSnapshot,
10
- SchemaFieldType,
4
+ type FieldTypeOption,
5
+ type FormFieldInfo,
6
+ type FormFieldsByFormIdI,
7
+ type FormFieldType,
8
+ type FormInfo,
9
+ type FormulaFieldFormSnapshot,
10
+ type SchemaFieldType,
11
11
  } from '../../interface/types';
12
12
 
13
13
  export const FORM_FIELD_TYPES_FOR_CALC = ['date', 'number'] as FormFieldType[];
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_DATE_FORMAT, MAX_DATE_DISPLAY_RANGE_YEARS } from '../../constants';
2
- import { CalculatedFieldFormat, CalculatedFormatForNumber } from '../../interface/types';
2
+ import { type CalculatedFieldFormat, type CalculatedFormatForNumber } from '../../interface/types';
3
3
 
4
4
  const roundValue = (
5
5
  value: number,
@@ -1,5 +1,5 @@
1
1
  import { MAX_DATE_CALC_DAYS } from '../../constants';
2
- import { FormulaToken, StructuredFormula } from '../../interface/types';
2
+ import { type FormulaToken, type StructuredFormula } from '../../interface/types';
3
3
 
4
4
  export interface FormulaValidationResult {
5
5
  valid: boolean;
@@ -14,7 +14,17 @@ import { pdfjs } from 'react-pdf';
14
14
  *
15
15
  * Using unpkg CDN - reliable and works with webpack dev server
16
16
  * unpkg serves npm packages directly, matching the exact version from package.json
17
+ *
18
+ * react-pdf@10's own index.js unconditionally sets workerSrc to the bare, unresolvable
19
+ * specifier 'pdf.worker.mjs' as soon as it's imported (before this module's side effect runs,
20
+ * since callers always `import { ... } from 'react-pdf'` first) - a truthy but broken value, so
21
+ * a plain `!workerSrc` guard never fires and this override never applies. Override react-pdf's
22
+ * own known-bad default explicitly rather than just checking for "unset".
17
23
  */
18
- if (typeof window !== 'undefined' && !pdfjs.GlobalWorkerOptions.workerSrc) {
24
+ if (
25
+ typeof window !== 'undefined' &&
26
+ (!pdfjs.GlobalWorkerOptions.workerSrc ||
27
+ pdfjs.GlobalWorkerOptions.workerSrc === 'pdf.worker.mjs')
28
+ ) {
19
29
  pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
20
30
  }
@@ -1,4 +1,4 @@
1
- import { RecipientInfo } from '../../../interface/types';
1
+ import { type RecipientInfo } from '../../../interface/types';
2
2
  import { mapColorsToRecipients } from '../map-colors';
3
3
 
4
4
  const buildRecipient = (id: number, name: string): RecipientInfo => ({
@@ -1,4 +1,4 @@
1
- import { RecipientInfo } from '../../interface/types';
1
+ import { type RecipientInfo } from '../../interface/types';
2
2
 
3
3
  const colors = [
4
4
  '#1F77B41f',
@@ -1,4 +1,4 @@
1
- import { PdfFieldSubType } from '../../interface/types';
1
+ import { type PdfFieldSubType } from '../../interface/types';
2
2
 
3
3
  const DEFAULT_NUMBER_SAMPLE = 350;
4
4
 
package/src/vite-env.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Declare module for Vite's ?url import syntax
3
- * This tells TypeScript that imports ending with ?url return a string URL
3
+ * This tells TypeScript that imports ending with ?url to return a string URL
4
4
  */
5
5
  declare module '*?url' {
6
6
  const src: string;