@betterinternship/core 2.35.0 → 3.0.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 (71) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/auth/db.d.ts +1 -1
  5. package/dist/lib/auth/db.js +1 -1
  6. package/dist/lib/auth/db.js.map +1 -1
  7. package/dist/lib/auth/events.d.ts +2 -2
  8. package/dist/lib/auth/limits.d.ts +3 -3
  9. package/dist/lib/auth/limits.js.map +1 -1
  10. package/dist/lib/email/archive.js +2 -2
  11. package/dist/lib/email/archive.js.map +1 -1
  12. package/dist/lib/email/email.js +4 -4
  13. package/dist/lib/email/email.js.map +1 -1
  14. package/dist/lib/pdf-viewer/BasePdfViewer.d.ts +4 -2
  15. package/dist/lib/pdf-viewer/BasePdfViewer.js +203 -5
  16. package/dist/lib/pdf-viewer/BasePdfViewer.js.map +1 -1
  17. package/dist/lib/pdf-viewer/index.d.ts +0 -5
  18. package/dist/lib/pdf-viewer/index.js +0 -5
  19. package/dist/lib/pdf-viewer/index.js.map +1 -1
  20. package/dist/lib/pdf-viewer/use-pdf-page-renderer.js +38 -11
  21. package/dist/lib/pdf-viewer/use-pdf-page-renderer.js.map +1 -1
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +88 -92
  24. package/dist/lib/forms/constants/fonts.d.ts +0 -131
  25. package/dist/lib/forms/constants/fonts.js +0 -55
  26. package/dist/lib/forms/constants/fonts.js.map +0 -1
  27. package/dist/lib/forms/constants/form.d.ts +0 -2
  28. package/dist/lib/forms/constants/form.js +0 -18
  29. package/dist/lib/forms/constants/form.js.map +0 -1
  30. package/dist/lib/forms/constants/index.d.ts +0 -2
  31. package/dist/lib/forms/constants/index.js +0 -3
  32. package/dist/lib/forms/constants/index.js.map +0 -1
  33. package/dist/lib/forms/field-preset-templates.d.ts +0 -23
  34. package/dist/lib/forms/field-preset-templates.js +0 -266
  35. package/dist/lib/forms/field-preset-templates.js.map +0 -1
  36. package/dist/lib/forms/fields.client.d.ts +0 -31
  37. package/dist/lib/forms/fields.client.js +0 -24
  38. package/dist/lib/forms/fields.client.js.map +0 -1
  39. package/dist/lib/forms/fields.server.d.ts +0 -16
  40. package/dist/lib/forms/fields.server.js +0 -2
  41. package/dist/lib/forms/fields.server.js.map +0 -1
  42. package/dist/lib/forms/form-metadata.d.ts +0 -142
  43. package/dist/lib/forms/form-metadata.js +0 -346
  44. package/dist/lib/forms/form-metadata.js.map +0 -1
  45. package/dist/lib/forms/index.d.ts +0 -9
  46. package/dist/lib/forms/index.js +0 -10
  47. package/dist/lib/forms/index.js.map +0 -1
  48. package/dist/lib/forms/recipient-email.d.ts +0 -7
  49. package/dist/lib/forms/recipient-email.js +0 -37
  50. package/dist/lib/forms/recipient-email.js.map +0 -1
  51. package/dist/lib/forms/signature-image.d.ts +0 -37
  52. package/dist/lib/forms/signature-image.js +0 -114
  53. package/dist/lib/forms/signature-image.js.map +0 -1
  54. package/dist/lib/forms/validator-ir.d.ts +0 -203
  55. package/dist/lib/forms/validator-ir.js +0 -2
  56. package/dist/lib/forms/validator-ir.js.map +0 -1
  57. package/dist/lib/pdf-viewer/FormFillPdfViewer.d.ts +0 -31
  58. package/dist/lib/pdf-viewer/FormFillPdfViewer.js +0 -107
  59. package/dist/lib/pdf-viewer/FormFillPdfViewer.js.map +0 -1
  60. package/dist/lib/pdf-viewer/PdfPageOverlay.d.ts +0 -18
  61. package/dist/lib/pdf-viewer/PdfPageOverlay.js +0 -236
  62. package/dist/lib/pdf-viewer/PdfPageOverlay.js.map +0 -1
  63. package/dist/lib/pdf-viewer/form-previewer-model.d.ts +0 -52
  64. package/dist/lib/pdf-viewer/form-previewer-model.js +0 -329
  65. package/dist/lib/pdf-viewer/form-previewer-model.js.map +0 -1
  66. package/dist/lib/pdf-viewer/form-previewer-rendering.d.ts +0 -55
  67. package/dist/lib/pdf-viewer/form-previewer-rendering.js +0 -317
  68. package/dist/lib/pdf-viewer/form-previewer-rendering.js.map +0 -1
  69. package/dist/lib/pdf-viewer/party-colors.d.ts +0 -22
  70. package/dist/lib/pdf-viewer/party-colors.js +0 -20
  71. package/dist/lib/pdf-viewer/party-colors.js.map +0 -1
@@ -1,203 +0,0 @@
1
- export type ValidatorBaseType = 'text' | 'number' | 'date' | 'enum' | 'array' | 'checkbox' | 'textarea' | 'time' | 'email' | 'phone' | 'url' | 'signature' | 'image' | 'radio';
2
- type ValidatorRuleRequired = {
3
- kind: 'required';
4
- message?: string;
5
- };
6
- type ValidatorRuleMinLength = {
7
- kind: 'minLength';
8
- value: number;
9
- message?: string;
10
- };
11
- type ValidatorRuleMaxLength = {
12
- kind: 'maxLength';
13
- value: number;
14
- message?: string;
15
- };
16
- type ValidatorRuleEmail = {
17
- kind: 'email';
18
- message?: string;
19
- };
20
- type ValidatorRuleUrl = {
21
- kind: 'url';
22
- message?: string;
23
- };
24
- type ValidatorRuleRegex = {
25
- kind: 'regex';
26
- pattern: string;
27
- flags?: string;
28
- message?: string;
29
- };
30
- type ValidatorRulePlainText = {
31
- kind: 'plainText';
32
- message?: string;
33
- };
34
- type ValidatorRuleTitleCase = {
35
- kind: 'titleCase';
36
- message?: string;
37
- };
38
- type ValidatorRuleTrim = {
39
- kind: 'trim';
40
- };
41
- type ValidatorRuleMin = {
42
- kind: 'min';
43
- value: number;
44
- message?: string;
45
- };
46
- type ValidatorRuleMax = {
47
- kind: 'max';
48
- value: number;
49
- message?: string;
50
- };
51
- type ValidatorRuleEnum = {
52
- kind: 'enum';
53
- options: string[];
54
- message?: string;
55
- };
56
- type ValidatorRuleArray = {
57
- kind: 'array';
58
- options: string[];
59
- minItems?: number;
60
- maxItems?: number;
61
- minMessage?: string;
62
- maxMessage?: string;
63
- };
64
- type ValidatorRuleMinDate = {
65
- kind: 'minDate';
66
- isoDate: string;
67
- message?: string;
68
- };
69
- type ValidatorRuleMaxDate = {
70
- kind: 'maxDate';
71
- isoDate: string;
72
- message?: string;
73
- };
74
- type ValidatorRuleDateOnOrAfterToday = {
75
- kind: 'dateOnOrAfterToday';
76
- message?: string;
77
- };
78
- type ValidatorRuleDateOnOrBeforeToday = {
79
- kind: 'dateOnOrBeforeToday';
80
- message?: string;
81
- };
82
- type ValidatorRuleDateOnOrAfterBusinessDays = {
83
- kind: 'dateOnOrAfterBusinessDays';
84
- businessDays: number;
85
- message?: string;
86
- };
87
- type ValidatorRuleDateOnOrAfterField = {
88
- kind: 'dateOnOrAfterField';
89
- field: string;
90
- offsetValue?: number;
91
- offsetUnit?: 'day' | 'week' | 'month';
92
- offsetDirection?: 'before' | 'after';
93
- message?: string;
94
- };
95
- type ValidatorRuleDateOnOrBeforeField = {
96
- kind: 'dateOnOrBeforeField';
97
- field: string;
98
- offsetValue?: number;
99
- offsetUnit?: 'day' | 'week' | 'month';
100
- offsetDirection?: 'before' | 'after';
101
- message?: string;
102
- };
103
- type ValidatorRuleMinTime = {
104
- kind: 'minTime';
105
- value: string;
106
- message?: string;
107
- };
108
- type ValidatorRuleMaxTime = {
109
- kind: 'maxTime';
110
- value: string;
111
- message?: string;
112
- };
113
- type TextRule = ValidatorRuleRequired | ValidatorRuleMinLength | ValidatorRuleMaxLength | ValidatorRuleEmail | ValidatorRuleUrl | ValidatorRuleRegex | ValidatorRulePlainText | ValidatorRuleTitleCase | ValidatorRuleTrim;
114
- type NumberRule = ValidatorRuleRequired | ValidatorRuleMin | ValidatorRuleMax;
115
- type DateRule = ValidatorRuleRequired | ValidatorRuleMinDate | ValidatorRuleMaxDate | ValidatorRuleDateOnOrAfterToday | ValidatorRuleDateOnOrBeforeToday | ValidatorRuleDateOnOrAfterBusinessDays | ValidatorRuleDateOnOrAfterField | ValidatorRuleDateOnOrBeforeField;
116
- type EnumRule = ValidatorRuleRequired | ValidatorRuleEnum;
117
- type ArrayRule = ValidatorRuleRequired | ValidatorRuleArray;
118
- type CheckboxRule = ValidatorRuleRequired;
119
- type TextareaRule = Exclude<TextRule, ValidatorRuleTrim>;
120
- type TimeRule = ValidatorRuleRequired | ValidatorRuleMinTime | ValidatorRuleMaxTime;
121
- type EmailRule = ValidatorRuleRequired;
122
- type PhoneRule = ValidatorRuleRequired;
123
- type UrlRule = ValidatorRuleRequired;
124
- type SignatureRule = ValidatorRuleRequired;
125
- type ImageRule = ValidatorRuleRequired;
126
- type RadioRule = ValidatorRuleRequired;
127
- type ValidatorIRMeta = {
128
- mode?: 'builder' | 'imported';
129
- importStatus?: 'exact' | 'partial' | 'custom';
130
- unmapped?: string[];
131
- };
132
- type ValidatorIRText = {
133
- version: 0;
134
- baseType: 'text';
135
- rules: TextRule[];
136
- } & ValidatorIRMeta;
137
- type ValidatorIRNumber = {
138
- version: 0;
139
- baseType: 'number';
140
- rules: NumberRule[];
141
- } & ValidatorIRMeta;
142
- type ValidatorIRDate = {
143
- version: 0;
144
- baseType: 'date';
145
- rules: DateRule[];
146
- } & ValidatorIRMeta;
147
- type ValidatorIREnum = {
148
- version: 0;
149
- baseType: 'enum';
150
- rules: EnumRule[];
151
- } & ValidatorIRMeta;
152
- type ValidatorIRArray = {
153
- version: 0;
154
- baseType: 'array';
155
- rules: ArrayRule[];
156
- } & ValidatorIRMeta;
157
- type ValidatorIRCheckbox = {
158
- version: 0;
159
- baseType: 'checkbox';
160
- rules: CheckboxRule[];
161
- } & ValidatorIRMeta;
162
- type ValidatorIRTextarea = {
163
- version: 0;
164
- baseType: 'textarea';
165
- rules: TextareaRule[];
166
- } & ValidatorIRMeta;
167
- type ValidatorIRTime = {
168
- version: 0;
169
- baseType: 'time';
170
- rules: TimeRule[];
171
- } & ValidatorIRMeta;
172
- type ValidatorIREmail = {
173
- version: 0;
174
- baseType: 'email';
175
- rules: EmailRule[];
176
- } & ValidatorIRMeta;
177
- type ValidatorIRPhone = {
178
- version: 0;
179
- baseType: 'phone';
180
- rules: PhoneRule[];
181
- } & ValidatorIRMeta;
182
- type ValidatorIRUrl = {
183
- version: 0;
184
- baseType: 'url';
185
- rules: UrlRule[];
186
- } & ValidatorIRMeta;
187
- type ValidatorIRSignature = {
188
- version: 0;
189
- baseType: 'signature';
190
- rules: SignatureRule[];
191
- } & ValidatorIRMeta;
192
- type ValidatorIRImage = {
193
- version: 0;
194
- baseType: 'image';
195
- rules: ImageRule[];
196
- } & ValidatorIRMeta;
197
- type ValidatorIRRadio = {
198
- version: 0;
199
- baseType: 'radio';
200
- rules: RadioRule[];
201
- } & ValidatorIRMeta;
202
- export type ValidatorIRv0 = ValidatorIRText | ValidatorIRNumber | ValidatorIRDate | ValidatorIREnum | ValidatorIRArray | ValidatorIRCheckbox | ValidatorIRTextarea | ValidatorIRTime | ValidatorIREmail | ValidatorIRPhone | ValidatorIRUrl | ValidatorIRSignature | ValidatorIRImage | ValidatorIRRadio;
203
- export {};
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=validator-ir.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator-ir.js","sourceRoot":"","sources":["../../../lib/forms/validator-ir.ts"],"names":[],"mappings":""}
@@ -1,31 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import { type IFormSigningParty } from "@betterinternship/core/forms";
3
- import { type PreviewFieldLike } from "./form-previewer-model.js";
4
- type PreviewPrefillMode = "live" | "dummy" | "none";
5
- type DefaultFieldVisibility = "all" | "mine";
6
- interface FormFillPdfViewerProps {
7
- documentUrl: string;
8
- values: Record<string, string>;
9
- fields?: PreviewFieldLike[];
10
- blocks?: PreviewFieldLike[];
11
- headerLeft?: ReactNode;
12
- scale?: number;
13
- showToolbar?: boolean;
14
- onFieldClick?: (fieldName: string) => void;
15
- selectedFieldId?: string;
16
- selectionTick?: number;
17
- autoScrollToSelectedField?: boolean;
18
- signingParties?: IFormSigningParty[];
19
- currentSigningPartyId?: string;
20
- showOwnership?: boolean;
21
- fieldVisibility?: DefaultFieldVisibility;
22
- defaultFieldVisibility?: DefaultFieldVisibility;
23
- fieldErrors?: Record<string, string>;
24
- prefillMode?: PreviewPrefillMode;
25
- prefillUser?: Record<string, unknown> | null;
26
- squareFrame?: boolean;
27
- registerScrollContainer?: (el: HTMLElement | null) => void;
28
- onScaleChange?: (scale: number) => void;
29
- }
30
- export declare const FormFillPdfViewer: ({ documentUrl, values, fields, blocks, headerLeft, scale: initialScale, showToolbar, onFieldClick, selectedFieldId, selectionTick, autoScrollToSelectedField, signingParties, currentSigningPartyId, showOwnership, fieldVisibility, defaultFieldVisibility, fieldErrors, prefillMode, prefillUser, squareFrame, registerScrollContainer, onScaleChange, }: FormFillPdfViewerProps) => import("react").JSX.Element;
31
- export {};
@@ -1,107 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useMemo, useRef, useState } from "react";
4
- import { Loader } from "./loader.js";
5
- import { createPreviewDisplayValueResolver, groupFieldsByPage, isFieldRequired, normalizePreviewFieldKey, normalizePreviewFields, resolveOwnerMeta, } from "./form-previewer-model.js";
6
- import { ensurePreviewFontsLoaded, } from "./form-previewer-rendering.js";
7
- import { usePdfDocumentFromUrl } from "./use-pdf-document.js";
8
- import { BasePdfViewer } from "./BasePdfViewer.js";
9
- import { PdfPageOverlay } from "./PdfPageOverlay.js";
10
- const getPreviewRawValue = (values, fieldKey) => {
11
- const normalizedFieldName = normalizePreviewFieldKey(fieldKey);
12
- return (values[fieldKey] ?? values[`${normalizedFieldName}:default`] ?? values[normalizedFieldName]);
13
- };
14
- const getFieldStatus = (fieldType, value) => {
15
- if (!value.trim())
16
- return "empty";
17
- if (fieldType === "signature")
18
- return "signed";
19
- return "filled";
20
- };
21
- export const FormFillPdfViewer = ({ documentUrl, values, fields, blocks, headerLeft, scale: initialScale = 1.0, showToolbar = true, onFieldClick, selectedFieldId, selectionTick = 0, autoScrollToSelectedField = true, signingParties = [], currentSigningPartyId, showOwnership = false, fieldVisibility, defaultFieldVisibility = "mine", fieldErrors = {}, prefillMode = "live", prefillUser = null, squareFrame = false, registerScrollContainer, onScaleChange, }) => {
22
- const { pdfDoc, pageCount, isLoading: isLoadingDoc, error } = usePdfDocumentFromUrl(documentUrl);
23
- const [scale, setScale] = useState(initialScale);
24
- const [visiblePage, setVisiblePage] = useState(1);
25
- const [animatingFieldId, setAnimatingFieldId] = useState(null);
26
- const pageRefs = useRef(new Map());
27
- const didAutoFocusOwnedTaskRef = useRef(false);
28
- const normalizedFields = useMemo(() => normalizePreviewFields(fields?.length ? fields : (blocks ?? [])), [fields, blocks]);
29
- const resolveDisplayValue = useMemo(() => createPreviewDisplayValueResolver({
30
- user: prefillUser,
31
- prefillMode,
32
- }), [prefillMode, prefillUser]);
33
- const effectiveFieldVisibility = fieldVisibility ?? defaultFieldVisibility;
34
- const ownerMetaByFieldId = useMemo(() => {
35
- const ownerMetaMap = new Map();
36
- normalizedFields.forEach((field) => {
37
- ownerMetaMap.set(field.id, resolveOwnerMeta(field, signingParties, currentSigningPartyId));
38
- });
39
- return ownerMetaMap;
40
- }, [normalizedFields, signingParties, currentSigningPartyId]);
41
- const ownedFields = useMemo(() => normalizedFields.filter((field) => ownerMetaByFieldId.get(field.id)?.isMine), [normalizedFields, ownerMetaByFieldId]);
42
- const visibleFields = useMemo(() => {
43
- if (effectiveFieldVisibility !== "mine")
44
- return normalizedFields;
45
- if (!currentSigningPartyId)
46
- return normalizedFields;
47
- return normalizedFields.filter((field) => ownerMetaByFieldId.get(field.id)?.isMine);
48
- }, [normalizedFields, effectiveFieldVisibility, currentSigningPartyId, ownerMetaByFieldId]);
49
- const fieldsByPage = useMemo(() => groupFieldsByPage(visibleFields), [visibleFields]);
50
- useEffect(() => {
51
- setScale(initialScale);
52
- }, [initialScale]);
53
- useEffect(() => {
54
- onScaleChange?.(scale);
55
- }, [scale, onScaleChange]);
56
- useEffect(() => {
57
- didAutoFocusOwnedTaskRef.current = false;
58
- }, [documentUrl]);
59
- useEffect(() => {
60
- if (!showOwnership)
61
- return;
62
- if (ownedFields.length === 0)
63
- return;
64
- if (didAutoFocusOwnedTaskRef.current)
65
- return;
66
- const firstEmptyRequiredOwnedField = ownedFields.find((field) => {
67
- if (!isFieldRequired(field))
68
- return false;
69
- const rawValue = getPreviewRawValue(values, field.field);
70
- const value = resolveDisplayValue(field, rawValue);
71
- return getFieldStatus(field.type, value) === "empty";
72
- });
73
- if (firstEmptyRequiredOwnedField) {
74
- const pageNode = pageRefs.current.get(firstEmptyRequiredOwnedField.page);
75
- pageNode?.scrollIntoView({ behavior: "smooth", block: "center" });
76
- setAnimatingFieldId(firstEmptyRequiredOwnedField.field);
77
- setTimeout(() => setAnimatingFieldId(null), 700);
78
- }
79
- didAutoFocusOwnedTaskRef.current = true;
80
- }, [showOwnership, ownedFields, resolveDisplayValue, values]);
81
- useEffect(() => {
82
- if (!selectedFieldId)
83
- return;
84
- if (autoScrollToSelectedField) {
85
- const selectedField = normalizedFields.find((field) => field.field === selectedFieldId);
86
- if (selectedField && selectedField.page) {
87
- const fieldPage = selectedField.page;
88
- const pageNode = pageRefs.current.get(fieldPage);
89
- pageNode?.scrollIntoView({ behavior: "smooth", block: "center" });
90
- }
91
- }
92
- setAnimatingFieldId(selectedFieldId);
93
- const timeout = setTimeout(() => setAnimatingFieldId(null), 600);
94
- return () => clearTimeout(timeout);
95
- }, [selectedFieldId, selectionTick, normalizedFields, autoScrollToSelectedField]);
96
- useEffect(() => {
97
- ensurePreviewFontsLoaded();
98
- }, []);
99
- if (error) {
100
- return (_jsx("div", { className: "flex h-full w-full items-center justify-center bg-slate-100", children: _jsxs("div", { className: "text-center", children: [_jsx("p", { className: "text-sm text-red-500", children: "Failed to load PDF" }), _jsx("p", { className: "mt-1 text-xs text-slate-400", children: error })] }) }));
101
- }
102
- if (isLoadingDoc || !pdfDoc) {
103
- return (_jsx("div", { className: "flex h-full w-full items-center justify-center bg-slate-100", children: _jsx(Loader, {}) }));
104
- }
105
- return (_jsx(BasePdfViewer, { pdfDoc: pdfDoc, pageCount: pageCount, scale: scale, visiblePage: visiblePage, onVisiblePageChange: setVisiblePage, onScaleChange: (s) => { setScale(s); onScaleChange?.(s); }, showToolbar: showToolbar, squareFrame: squareFrame, registerScrollContainer: registerScrollContainer, pageRefs: pageRefs, renderPage: (pageNumber) => (_jsx(PdfPageOverlay, { pdf: pdfDoc, pageNumber: pageNumber, scale: scale, fields: fieldsByPage.get(pageNumber) || [], values: values, onFieldClick: onFieldClick, animatingFieldId: animatingFieldId, selectedFieldId: selectedFieldId, ownerMetaByFieldId: ownerMetaByFieldId, showOwnership: showOwnership, fieldErrors: fieldErrors, resolveDisplayValue: resolveDisplayValue }, pageNumber)), children: headerLeft }));
106
- };
107
- //# sourceMappingURL=FormFillPdfViewer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormFillPdfViewer.js","sourceRoot":"","sources":["../../../lib/pdf-viewer/FormFillPdfViewer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,iCAAiC,EACjC,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,gBAAgB,GAIjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,MAAM,kBAAkB,GAAG,CAAC,MAA8B,EAAE,QAAgB,EAAW,EAAE;IACvF,MAAM,mBAAmB,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAC/D,OAAO,CACL,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,GAAG,mBAAmB,UAAU,CAAC,IAAI,MAAM,C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,EAC1C,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,mBAAmB,IAZnC,UAAU,CAaf,CACH,YAEA,UAAU,GACG,CACjB,CAAC;AACJ,CAAC,CAAC"}
@@ -1,18 +0,0 @@
1
- import type { PDFDocumentProxy } from 'pdfjs-dist';
2
- import type { PreviewField, OwnerMeta } from './form-previewer-model.js';
3
- interface PdfPageOverlayProps {
4
- pdf: PDFDocumentProxy;
5
- pageNumber: number;
6
- scale: number;
7
- fields: PreviewField[];
8
- values: Record<string, string>;
9
- onFieldClick?: (fieldName: string) => void;
10
- animatingFieldId?: string | null;
11
- selectedFieldId?: string;
12
- ownerMetaByFieldId: Map<string, OwnerMeta>;
13
- showOwnership: boolean;
14
- fieldErrors: Record<string, string>;
15
- resolveDisplayValue: (field: PreviewField, rawValue: unknown) => string;
16
- }
17
- export declare const PdfPageOverlay: ({ pdf, pageNumber, scale, fields, values, onFieldClick, animatingFieldId, selectedFieldId, ownerMetaByFieldId, showOwnership, fieldErrors, resolveDisplayValue, }: PdfPageOverlayProps) => import("react").JSX.Element;
18
- export {};
@@ -1,236 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from 'react';
4
- import { getSignatureImageFieldKey, isInlineSignatureImagePayload, parseSignatureImageValue, } from '@betterinternship/core/forms';
5
- import { usePdfPageRenderer } from './use-pdf-page-renderer.js';
6
- import { resolvePreviewFont, fitNoWrapText, fitWrappedText, } from './form-previewer-rendering.js';
7
- import { normalizePreviewFieldKey } from './form-previewer-model.js';
8
- const SIGNATURE_IMAGE_OVERFLOW_SCALE = 1.8;
9
- const getSignatureImageSrc = (signatureImage) => {
10
- if (!signatureImage)
11
- return '';
12
- if (isInlineSignatureImagePayload(signatureImage.image)) {
13
- return signatureImage.image.dataUrl;
14
- }
15
- return signatureImage.image.signedUrl ?? '';
16
- };
17
- const getPreviewRawValue = (values, fieldKey) => {
18
- const normalizedFieldName = normalizePreviewFieldKey(fieldKey);
19
- return (values[fieldKey] ??
20
- values[`${normalizedFieldName}:default`] ??
21
- values[normalizedFieldName]);
22
- };
23
- export const PdfPageOverlay = ({ pdf, pageNumber, scale, fields, values, onFieldClick, animatingFieldId, selectedFieldId, ownerMetaByFieldId, showOwnership, fieldErrors, resolveDisplayValue, }) => {
24
- const containerRef = useRef(null);
25
- const { canvasRef, pageReady } = usePdfPageRenderer(pdf, pageNumber, scale);
26
- const [forceRender, setForceRender] = useState(0);
27
- const [activeTouchFieldId, setActiveTouchFieldId] = useState(null);
28
- const [hoveredFieldId, setHoveredFieldId] = useState(null);
29
- const [isTouchInteraction, setIsTouchInteraction] = useState(false);
30
- const [clickedHighlightFieldId, setClickedHighlightFieldId] = useState(null);
31
- useEffect(() => {
32
- setForceRender((prev) => prev + 1);
33
- }, [scale]);
34
- useEffect(() => {
35
- if (typeof window === 'undefined' || !window.matchMedia)
36
- return;
37
- const media = window.matchMedia('(hover: none), (pointer: coarse)');
38
- const update = () => setIsTouchInteraction(media.matches);
39
- update();
40
- media.addEventListener('change', update);
41
- return () => media.removeEventListener('change', update);
42
- }, []);
43
- const pdfToDisplay = (pdfX, pdfY) => {
44
- const canvas = canvasRef.current;
45
- if (!canvas)
46
- return null;
47
- const displayX = pdfX * scale;
48
- const displayY = pdfY * scale;
49
- return {
50
- displayX,
51
- displayY,
52
- };
53
- };
54
- return (_jsxs("div", { ref: containerRef, className: "relative mx-auto rounded bg-white shadow", style: {
55
- width: 'fit-content',
56
- visibility: pageReady ? 'visible' : 'hidden',
57
- }, children: [_jsx("canvas", { ref: canvasRef, className: "block" }), pageReady && (_jsx("div", { className: "absolute inset-0", onClick: () => {
58
- if (isTouchInteraction)
59
- setActiveTouchFieldId(null);
60
- }, children: fields.map((field) => {
61
- const x = field.x;
62
- const y = field.y;
63
- const w = field.w;
64
- const h = field.h;
65
- const fieldName = field.field;
66
- if (w <= 0 || h <= 0) {
67
- return null;
68
- }
69
- const displayPos = pdfToDisplay(x, y);
70
- if (!displayPos) {
71
- return null;
72
- }
73
- const widthPixels = w * scale;
74
- const heightPixels = h * scale;
75
- const ownerMeta = ownerMetaByFieldId.get(field.id) ??
76
- {
77
- ownerRoleId: 'unknown',
78
- ownerGroupId: 'other',
79
- ownerLabel: 'Unassigned',
80
- ownerColorHex: '#94a3b8',
81
- isMine: false,
82
- isKnownOwner: false,
83
- };
84
- const canRevealValue = !showOwnership || ownerMeta?.isMine;
85
- const rawValue = canRevealValue
86
- ? getPreviewRawValue(values, fieldName)
87
- : '';
88
- const signatureImage = field.type === 'signature'
89
- ? parseSignatureImageValue(values[getSignatureImageFieldKey(fieldName)])
90
- : null;
91
- const signatureImageSrc = getSignatureImageSrc(signatureImage);
92
- const valueStr = canRevealValue
93
- ? resolveDisplayValue(field, rawValue)
94
- : '';
95
- const isFilled = !!signatureImage || valueStr.trim().length > 0;
96
- const align_h = field.align_h ?? 'left';
97
- const align_v = field.align_v ?? 'top';
98
- const shouldWrap = field.wrap ?? true;
99
- const fieldType = field.type ?? 'text';
100
- const resolvedFont = resolvePreviewFont(fieldType, field.font);
101
- let fontSizeDoc;
102
- let lineHeightDoc;
103
- let displayLines = [];
104
- const fitSafetyUnits = 2;
105
- const fitMaxWidthDoc = Math.max(0, w - fitSafetyUnits);
106
- const fitMaxHeightDoc = Math.max(0, h - fitSafetyUnits);
107
- if (isFilled) {
108
- if (shouldWrap) {
109
- const fitted = fitWrappedText({
110
- text: valueStr,
111
- fontFamily: resolvedFont.canvasFamily,
112
- maxWidth: fitMaxWidthDoc,
113
- maxHeight: fitMaxHeightDoc,
114
- startSize: field.size ?? 11,
115
- lineHeightMult: 1.0,
116
- });
117
- fontSizeDoc = fitted.fontSize;
118
- lineHeightDoc = fitted.lineHeight;
119
- displayLines = fitted.lines || [];
120
- }
121
- else {
122
- const defaultSize = fieldType === 'signature' ? 25 : 11;
123
- const fitted = fitNoWrapText({
124
- text: valueStr,
125
- fontFamily: resolvedFont.canvasFamily,
126
- maxWidth: fitMaxWidthDoc,
127
- maxHeight: fitMaxHeightDoc,
128
- startSize: field.size ?? defaultSize,
129
- });
130
- fontSizeDoc = fitted.fontSize;
131
- lineHeightDoc = fontSizeDoc * 1.0;
132
- displayLines = [fitted.line];
133
- }
134
- }
135
- else {
136
- fontSizeDoc = field.size ?? (fieldType === 'signature' ? 25 : 11);
137
- lineHeightDoc = fontSizeDoc * 1.0;
138
- }
139
- const fontSize = fontSizeDoc * scale;
140
- const lineHeight = lineHeightDoc * scale;
141
- const isSelected = animatingFieldId === fieldName ||
142
- selectedFieldId === fieldName ||
143
- clickedHighlightFieldId === field.id;
144
- const isClickable = !showOwnership || ownerMeta.isMine;
145
- const hasFieldError = !!fieldErrors[fieldName];
146
- const isOwnedField = showOwnership && ownerMeta.isMine;
147
- const isOwnedFieldValid = isOwnedField && isFilled && !hasFieldError;
148
- const ownedBorderColor = isOwnedFieldValid ? '#16a34a' : '#dc2626';
149
- const borderColor = showOwnership
150
- ? ownerMeta.isMine
151
- ? ownedBorderColor
152
- : '#d1d5db'
153
- : '#d1d5db';
154
- const ownedFillColor = isOwnedField
155
- ? isOwnedFieldValid
156
- ? 'rgba(34, 197, 94, 0.2)'
157
- : 'rgba(239, 68, 68, 0.2)'
158
- : 'transparent';
159
- const showNonOwnedTooltip = showOwnership &&
160
- !ownerMeta.isMine &&
161
- (hoveredFieldId === field.id ||
162
- (isTouchInteraction && activeTouchFieldId === field.id));
163
- return (_jsxs("div", { onMouseEnter: () => {
164
- if (showOwnership && !ownerMeta.isMine)
165
- setHoveredFieldId(field.id);
166
- }, onMouseLeave: () => {
167
- if (hoveredFieldId === field.id)
168
- setHoveredFieldId(null);
169
- }, onClick: (event) => {
170
- event.stopPropagation();
171
- if (showOwnership && isTouchInteraction) {
172
- if (activeTouchFieldId !== field.id) {
173
- setActiveTouchFieldId(field.id);
174
- return;
175
- }
176
- setActiveTouchFieldId(null);
177
- }
178
- if (showOwnership) {
179
- setClickedHighlightFieldId(field.id);
180
- setTimeout(() => setClickedHighlightFieldId((prev) => prev === field.id ? null : prev), 550);
181
- }
182
- if (!isClickable)
183
- return;
184
- onFieldClick?.(fieldName);
185
- }, className: `absolute text-black transition-all ${isClickable ? 'cursor-pointer' : 'cursor-default'}`, style: {
186
- left: `${displayPos.displayX}px`,
187
- top: `${displayPos.displayY}px`,
188
- width: `${Math.max(widthPixels, 4)}px`,
189
- height: `${Math.max(heightPixels, 4)}px`,
190
- overflow: 'visible',
191
- display: 'flex',
192
- backgroundColor: ownedFillColor,
193
- border: 'none',
194
- outline: showOwnership && !ownerMeta.isMine
195
- ? '1px dashed #94a3b8'
196
- : undefined,
197
- boxShadow: isSelected ? '0 0 0 2px #3b82f6' : undefined,
198
- zIndex: showNonOwnedTooltip ? 30 : isSelected ? 20 : 10,
199
- alignItems: align_v === 'middle'
200
- ? 'center'
201
- : align_v === 'bottom'
202
- ? 'flex-end'
203
- : 'flex-start',
204
- justifyContent: align_h === 'center'
205
- ? 'center'
206
- : align_h === 'right'
207
- ? 'flex-end'
208
- : 'flex-start',
209
- }, children: [signatureImageSrc ? (_jsx("div", { className: "pointer-events-none absolute top-1/2 left-1/2 flex items-center justify-center", style: {
210
- width: `${Math.max(widthPixels * SIGNATURE_IMAGE_OVERFLOW_SCALE, 4)}px`,
211
- height: `${Math.max(heightPixels * SIGNATURE_IMAGE_OVERFLOW_SCALE, 4)}px`,
212
- transform: 'translate(-50%, -50%)',
213
- }, children: _jsx("img", { src: signatureImageSrc, alt: "Signature", className: "h-full w-full object-contain", draggable: false }) })) : isFilled ? (_jsx("div", { className: "text-black", style: {
214
- fontSize: `${fontSize}px`,
215
- lineHeight: `${lineHeight}px`,
216
- overflow: 'hidden',
217
- whiteSpace: shouldWrap ? 'pre' : 'nowrap',
218
- wordWrap: 'normal',
219
- overflowWrap: 'normal',
220
- width: '100%',
221
- maxWidth: '100%',
222
- maxHeight: '100%',
223
- padding: '0px',
224
- margin: '0px',
225
- boxSizing: 'border-box',
226
- textAlign: align_h === 'center' ? 'center' : align_h,
227
- fontFamily: resolvedFont.cssFamily,
228
- fontWeight: resolvedFont.fontWeight,
229
- color: '#000000',
230
- }, children: displayLines.length > 0
231
- ? displayLines.join('\n')
232
- : valueStr })) : null, showNonOwnedTooltip ? (_jsx(AssignedOwnerTooltip, { ownerLabel: ownerMeta.ownerLabel })) : null] }, field.id));
233
- }) }, forceRender))] }));
234
- };
235
- const AssignedOwnerTooltip = ({ ownerLabel }) => (_jsx("div", { className: "pointer-events-none absolute -top-12 left-0 z-20 max-w-56 rounded border border-slate-200 bg-white px-2 py-1 text-xs text-slate-700 shadow-lg", children: _jsxs("span", { className: "break-words", children: ["Filled by ", _jsx("strong", { className: "text-slate-900", children: ownerLabel })] }) }));
236
- //# sourceMappingURL=PdfPageOverlay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PdfPageOverlay.js","sourceRoot":"","sources":["../../../lib/pdf-viewer/PdfPageOverlay.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAC3C,MAAM,oBAAoB,GAAG,CAC3B,cAA2D,EACnD,EAAE;IACV,IAAI,CAAC,cAAc;QAAE,OAAO,EAA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