@servicetitan/dte-pdf-editor 1.96.0 → 1.96.2

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 (36) hide show
  1. package/README.md +19 -7
  2. package/dist/components/field-config-panel/advanced-settings.d.ts +1 -1
  3. package/dist/components/field-config-panel/advanced-settings.js +1 -1
  4. package/dist/components/field-config-panel/e-sign-options-modal.d.ts +1 -1
  5. package/dist/components/field-config-panel/e-sign-options-modal.js +1 -1
  6. package/dist/components/field-config-panel/field-config-panel-overlay.d.ts.map +1 -1
  7. package/dist/components/field-config-panel/field-config-panel-overlay.js +23 -15
  8. package/dist/components/field-config-panel/field-config-panel-overlay.js.map +1 -1
  9. package/dist/components/field-config-panel/field-config-panel.d.ts +1 -1
  10. package/dist/components/field-config-panel/formula-generator.d.ts +1 -1
  11. package/dist/components/field-config-panel/formula-modal.d.ts +1 -1
  12. package/dist/components/field-config-panel/formula-workspace.d.ts +1 -1
  13. package/dist/components/pdf-editor/pdf-editor.d.ts +6 -1
  14. package/dist/components/pdf-editor/pdf-editor.d.ts.map +1 -1
  15. package/dist/components/pdf-editor/pdf-editor.js.map +1 -1
  16. package/dist/interface/types.d.ts +1 -1
  17. package/dist/vendor/dte-shared/business-calendar-validation.utils.d.ts +22 -0
  18. package/dist/vendor/dte-shared/business-calendar-validation.utils.js +76 -0
  19. package/dist/vendor/dte-shared/components/business-calendar-section.d.ts +15 -0
  20. package/dist/vendor/dte-shared/components/business-calendar-section.js +13 -0
  21. package/dist/vendor/dte-shared/components/schedule-drawer.d.ts +16 -0
  22. package/dist/vendor/dte-shared/components/schedule-drawer.js +112 -0
  23. package/dist/vendor/dte-shared/components/schedule-picker.d.ts +8 -0
  24. package/dist/vendor/dte-shared/components/schedule-picker.js +88 -0
  25. package/dist/vendor/dte-shared/constants.d.ts +10 -0
  26. package/dist/vendor/dte-shared/constants.js +10 -0
  27. package/dist/vendor/dte-shared/index.d.ts +6 -0
  28. package/dist/vendor/dte-shared/index.js +5 -0
  29. package/dist/vendor/dte-shared/styles/schedule.css +19 -0
  30. package/dist/vendor/dte-shared/types.d.ts +67 -0
  31. package/dist/vendor/dte-shared/types.js +1 -0
  32. package/package.json +5 -3
  33. package/src/components/field-config-panel/__tests__/field-config-panel-overlay.test.tsx +184 -0
  34. package/src/components/field-config-panel/__tests__/schedule-switch-visibility.test.tsx +206 -0
  35. package/src/components/field-config-panel/field-config-panel-overlay.tsx +25 -16
  36. package/src/components/pdf-editor/pdf-editor.tsx +6 -1
@@ -106,23 +106,32 @@ export const FieldConfigPanelOverlay: FC<FieldConfigPanelOverlayProps> = ({
106
106
  [scheduleBindings, selectedFieldId, onScheduleBindingsChange],
107
107
  );
108
108
 
109
- const businessCalendar: ScheduleEditorContext = useMemo(
110
- () => ({
111
- enabled: !!selectedBinding,
112
- selectedScheduleId: selectedBinding?.scheduleId,
113
- onToggle: handleToggle,
114
- onSelectSchedule: handleSelectSchedule,
115
- holidayCatalog,
116
- holidayCatalogLoading,
117
- holidayCatalogError,
118
- schedules,
119
- schedulesLoading,
120
- schedulesError,
121
- onCreateSchedule,
122
- onUpdateSchedule,
123
- onDeleteSchedule,
124
- }),
109
+ /*
110
+ * The schedule UI (the Formula Builder's switch and the e-sign day offset's schedule) is offered
111
+ * only to a host that passes `onScheduleBindingsChange`. Without it there is no context, and
112
+ * everything that renders the schedule UI checks for one.
113
+ */
114
+ const businessCalendar: ScheduleEditorContext | undefined = useMemo(
115
+ () =>
116
+ onScheduleBindingsChange
117
+ ? {
118
+ enabled: !!selectedBinding,
119
+ selectedScheduleId: selectedBinding?.scheduleId,
120
+ onToggle: handleToggle,
121
+ onSelectSchedule: handleSelectSchedule,
122
+ holidayCatalog,
123
+ holidayCatalogLoading,
124
+ holidayCatalogError,
125
+ schedules,
126
+ schedulesLoading,
127
+ schedulesError,
128
+ onCreateSchedule,
129
+ onUpdateSchedule,
130
+ onDeleteSchedule,
131
+ }
132
+ : undefined,
125
133
  [
134
+ onScheduleBindingsChange,
126
135
  selectedBinding,
127
136
  handleToggle,
128
137
  handleSelectSchedule,
@@ -46,7 +46,7 @@ export interface PdfEditorProps {
46
46
  /**
47
47
  * Date calculated fields whose custom business-day exclusion toggle is on, and the schedule
48
48
  * each uses (`PdfField.id` as `fieldKey`), as `PdfView`'s. Also drives the Formula Builder's
49
- * toggle/picker for the selected field.
49
+ * toggle/picker for the selected field, which are shown only with `onScheduleBindingsChange`.
50
50
  */
51
51
  scheduleBindings?: FieldScheduleBinding[];
52
52
  /** The tenant's known holidays, for the schedule editor's checklist. */
@@ -67,6 +67,11 @@ export interface PdfEditorProps {
67
67
  * `PUT api/holidays/templates/{id}/bindings`). `PdfEditor` does not persist this itself —
68
68
  * the host is expected to save it (and the bindings are typically saved separately from the
69
69
  * template's own fields).
70
+ *
71
+ * Passing it also turns the schedule UI on: without it the Formula Builder has no "Exclude
72
+ * weekends & holidays" switch and the e-sign day offset has no schedule. A host that cannot save
73
+ * bindings (for example one without a tenant) leaves it out. It is not called for the e-sign
74
+ * schedule, which is stored in the field's `data`.
70
75
  */
71
76
  onScheduleBindingsChange?(bindings: FieldScheduleBinding[]): void;
72
77
  /**