From f9b8afa982b0b5087416362e51f6553e18e49096 Mon Sep 17 00:00:00 2001 From: Jim Moffet Date: Fri, 5 Apr 2024 14:25:35 -0700 Subject: [PATCH] Use live API on cloud.gov for parsing (#90) * editable stub * editable stub * editable stub * editable stub * editable stub * set up api * set up api * set up api * set up api * Merge jim/api-setup-2 into this branch * Tweak parsing API constant and removed cruft --------- Co-authored-by: Daniel Naab --- .../src/FormManager/FormEdit/Preview.tsx | 42 +- packages/forms/src/documents/document.ts | 4 +- packages/forms/src/documents/pdf/index.ts | 1 - packages/forms/src/documents/pdf/mock-api.ts | 294 ---- .../forms/src/documents/pdf/parsing-api.ts | 190 +++ packages/forms/src/documents/suggestions.ts | 1185 +---------------- packages/forms/src/documents/util.ts | 14 + 7 files changed, 232 insertions(+), 1498 deletions(-) delete mode 100644 packages/forms/src/documents/pdf/mock-api.ts create mode 100644 packages/forms/src/documents/pdf/parsing-api.ts diff --git a/packages/design/src/FormManager/FormEdit/Preview.tsx b/packages/design/src/FormManager/FormEdit/Preview.tsx index 1cec63c4..2482d52e 100644 --- a/packages/design/src/FormManager/FormEdit/Preview.tsx +++ b/packages/design/src/FormManager/FormEdit/Preview.tsx @@ -92,6 +92,7 @@ const createPatternPreviewComponent = ( uswdsRoot: string ) => { const PatternPreviewComponent: PatternComponent = props => { + const context = useFormEditStore(state => state.context); const selectedPattern = useFormEditStore(state => state.selectedPattern); const handleEditClick = useFormEditStore(state => state.handleEditClick); @@ -99,31 +100,34 @@ const createPatternPreviewComponent = ( const divClassNames = isSelected ? 'form-group-row field-selected' : 'form-group-row'; + const EditComponent = context.editComponents[props.type]; return (
- + + + ) : null}
); diff --git a/packages/forms/src/documents/document.ts b/packages/forms/src/documents/document.ts index bc15cf0a..f619725d 100644 --- a/packages/forms/src/documents/document.ts +++ b/packages/forms/src/documents/document.ts @@ -9,7 +9,7 @@ import { import { InputPattern } from '../patterns/input'; import { SequencePattern } from '../patterns/sequence'; import { PDFDocument, getDocumentFieldData } from './pdf'; -import { getSuggestedPatternsFromCache } from './suggestions'; +import { getSuggestedPatterns } from './suggestions'; import { DocumentFieldMap } from './types'; export type DocumentTemplate = PDFDocument; @@ -22,7 +22,7 @@ export const addDocument = async ( } ) => { const fields = await getDocumentFieldData(fileDetails.data); - const cachedPdf = await getSuggestedPatternsFromCache(fileDetails.data); + const cachedPdf = await getSuggestedPatterns(fileDetails.data); if (cachedPdf) { form = updateFormSummary(form, { diff --git a/packages/forms/src/documents/pdf/index.ts b/packages/forms/src/documents/pdf/index.ts index 1982c9d1..b2b6f5c8 100644 --- a/packages/forms/src/documents/pdf/index.ts +++ b/packages/forms/src/documents/pdf/index.ts @@ -1,7 +1,6 @@ export { getDocumentFieldData } from './extract'; export * from './generate'; export { generateDummyPDF } from './generate-dummy'; -export { parseAlabamaNameChangeForm } from './mock-api'; export type PDFDocument = { type: 'pdf'; diff --git a/packages/forms/src/documents/pdf/mock-api.ts b/packages/forms/src/documents/pdf/mock-api.ts deleted file mode 100644 index 5dedc714..00000000 --- a/packages/forms/src/documents/pdf/mock-api.ts +++ /dev/null @@ -1,294 +0,0 @@ -import * as z from 'zod'; - -import { type Pattern, type PatternId, type PatternMap } from '../..'; - -import { type FieldsetPattern } from '../../patterns/fieldset'; -import { type InputPattern } from '../../patterns/input'; -import { type ParagraphPattern } from '../../patterns/paragraph'; -import { SequencePattern } from '../../patterns/sequence'; - -import { stringToBase64 } from '../util'; -import { type DocumentFieldMap } from '../types'; - -import json from './al_name_change'; - -const TxInput = z.object({ - input_type: z.literal('Tx'), - input_params: z.object({ - text: z.string(), - text_style: z.string(), - output_id: z.string(), - placeholder: z.string(), - instructions: z.string(), - required: z.boolean(), - options: z.array(z.string()), - }), -}); - -const BtnInput = z.object({ - input_type: z.literal('Btn'), - input_params: z.object({ - text: z.string(), - text_style: z.string(), - output_id: z.string(), - placeholder: z.string(), - instructions: z.string(), - required: z.boolean(), - options: z.array(z.string()), - }), -}); - -const ExtractedInput = z.discriminatedUnion('input_type', [TxInput, BtnInput]); -type ExtractedInput = z.infer; - -const ExtractedElement = z.object({ - id: z.string(), - group_id: z.number(), - element_type: z.string(), - element_params: z.object({ - text: z.string(), - text_style: z.string(), - options: z.null(), - }), - inputs: ExtractedInput.array(), - parent: z.string().nullable(), -}); -type ExtractedElement = z.infer; - -const RawTxField = z.object({ - type: z.literal('/Tx'), - var_name: z.string(), - field_dict: z.object({ - font_info: z.string(), - field_type: z.string(), - coordinates: z.number().array().optional(), - field_label: z.string(), - field_instructions: z.string(), - }), -}); - -const RawBtnField = z.object({ - type: z.literal('/Btn'), - var_name: z.string(), - field_dict: z.object({ - font_info: z.string(), - flags: z.number(), - field_type: z.string(), - field_label: z.string(), - child_fields: z.array(z.object({ coordinates: z.number().array() })), - num_children: z.number(), - }), -}); - -const ExtractedObject = z.object({ - raw_text: z.string(), - title: z.string(), - description: z.string(), - elements: ExtractedElement.array(), - raw_fields: z.discriminatedUnion('type', [RawTxField, RawBtnField]).array(), -}); - -type ExtractedObject = z.infer; - -export type ParsedPdf = { - patterns: PatternMap; - outputs: DocumentFieldMap; // to populate FormOutput - root: PatternId; - title: string; -}; - -export const parseAlabamaNameChangeForm = (): ParsedPdf => { - const extracted: ExtractedObject = ExtractedObject.parse(json); - const parsedPdf: ParsedPdf = { - patterns: {}, - outputs: {}, - root: 'root', - title: extracted.title, - }; - const rootSequence: PatternId[] = []; - for (const element of extracted.elements) { - const fieldsetPatterns: PatternId[] = []; - if (element.inputs.length === 0) { - parsedPdf.patterns[element.id] = { - type: 'paragraph', - id: element.id, - data: { - text: element.element_params.text, - maxLength: 2048, - }, - } satisfies ParagraphPattern; - rootSequence.push(element.id); - continue; - } - for (const input of element.inputs) { - if (input.input_type === 'Tx') { - const id = stringToBase64(PdfFieldMap[input.input_params.output_id]); - parsedPdf.patterns[id] = { - type: 'input', - id, - data: { - label: input.input_params.instructions, - required: false, - initial: '', - maxLength: 128, - }, - } satisfies InputPattern; - fieldsetPatterns.push(id); - parsedPdf.outputs[id] = { - type: 'TextField', - name: PdfFieldMap[input.input_params.output_id], - label: input.input_params.instructions, - value: '', - maxLength: 1024, - required: input.input_params.required, - }; - } - } - if (fieldsetPatterns.length > 0) { - parsedPdf.patterns[element.id] = { - id: element.id, - type: 'fieldset', - data: { - legend: element.element_params.text, - patterns: fieldsetPatterns, - }, - } satisfies FieldsetPattern; - rootSequence.push(element.id); - } - } - parsedPdf.patterns['root'] = { - id: 'root', - type: 'sequence', - data: { - patterns: rootSequence, - }, - } satisfies SequencePattern; - return parsedPdf; -}; - -const getElementInputs = (element: ExtractedElement): Pattern[] => { - return element.inputs - .map((input: ExtractedInput) => { - if (input.input_type === 'Tx') { - return { - type: 'input', - id: input.input_params.output_id, - data: { - label: input.input_params.instructions, - required: false, - maxLength: 256, - initial: '', - }, - } satisfies InputPattern; - } - return null as unknown as Pattern; - }) - .filter((item): item is NonNullable => item !== null); -}; - -const PdfFieldMap: Record = { - County_Name1: 'users1_address_county', - Current_First_Name1: 'users1_name_first', - Current_Middle_Name1: 'users1_name_middle', - Current_Last_Name1: 'users1_name_last', - Current_First_Name2: 'users1_name_first__2', - Current_Middle_Name2: 'users1_name_middle__2', - Current_Last_Name2: 'users1_name_last__2', - Street_Address: 'users1_address_line_one', - City: 'users1_address_city', - State: 'users1_address_state', - Zip: 'users1_address_zip', - Home_Phone: 'users1_phone', - Work_Phone: 'work_phone', - DOB: 'users1_birthdate', - Birth_First_Name: 'user1_preferred_name_first', - Birth_Middle_Name: 'user1_preferred_name_middle', - Birth_Last_Name: 'user1_preferred_name_last', - County_Name2: 'user1_address_county__2', - PhotoID: 'photo_id', - 'DL#': 'driver_license_number', - 'ID#': 'non_driver_id_number', - Why_change_name1: 'reasons_for_change', // pdf-lib combines the three input lines into a single input - Why_change_name2: 'reasons_for_change', - Why_change_name3: 'reasons_for_change', - New_First_Name: 'users1_previous_names1_first', - New_Middle_Name: 'users1_previous_names1_middle', - New_Last_Name: 'users1_previous_names1_last', -}; - -/* -function parseJson(obj: ExtractedJsonType): Array { - return parseElements(obj.elements); -} - -function parseInputs( - inputs: ExtractedJsonType['elements'][0]['inputs'] -): Array> { - const output = inputs.reduce((acc: any[], input) => { - const params = input['input_params']; - - // const formElementType should be 'Textfield' if inputType is 'Tx' - // const formElementType should be 'RadioGroup' if inputType is 'Btn' - // const formElementType should be 'Checkbox' if inputType is 'Ch' - // const formElementType should be 'Dropdown' if inputType is 'Dr' - - if (input['input_type'] === 'Tx') { - const value: DocumentFieldValue = { - type: 'TextField', // modify api so we can use inputType directly here - //elementType: 'input', - //inputType: input['input_type'], - //inputText: params.text, - //inputTextStyle: params.text_style, - name: params.output_id, - label: params.output_id, - value: 'Short answer', // modify api to provide this - //inputPlaceholder: params.placeholder, - instructions: params.instructions, - required: true, // api should check if there's a mix, default to true? Can't all be false... - ///inputOptions: params.options, - }; - acc.push(value); - } - - return acc; - }, []); - - return output; -} - -function parseElements( - pdfElements: ExtractedJsonType['elements'] -): Pattern[] { - const output = pdfElements.reduce((acc, element) => { - const elementOutput = { - type: 'Paragraph', - name: element.id, - groupId: element.group_id, - value: element.element_params['text'], - elementTextStyle: element.element_params.text_style, - elementOptions: element.element_params.options, - elementType: element.element_params.elementType, - }; - - const parsedInputs = parseInputs(element['inputs']); - parsedInputs.forEach(input => { - input['groupId'] = element.group_id; - }); - - if (!element.element_params.text) { - acc.push(...parsedInputs); - return acc; - } - - acc.push(elementOutput, ...parsedInputs); - - return acc; - }, []); - - pdfElements.map(pdfElement => { - const inputs = getElementInputs(pdfElement); - }); - - return output; -} -*/ diff --git a/packages/forms/src/documents/pdf/parsing-api.ts b/packages/forms/src/documents/pdf/parsing-api.ts new file mode 100644 index 00000000..3f8de9e1 --- /dev/null +++ b/packages/forms/src/documents/pdf/parsing-api.ts @@ -0,0 +1,190 @@ +import * as z from 'zod'; + +import { type PatternId, type PatternMap } from '../..'; + +import { type FieldsetPattern } from '../../patterns/fieldset'; +import { type InputPattern } from '../../patterns/input'; +import { type ParagraphPattern } from '../../patterns/paragraph'; +import { type SequencePattern } from '../../patterns/sequence'; + +import { stringToBase64, uint8ArrayToBase64 } from '../util'; +import { type DocumentFieldMap } from '../types'; + +const TxInput = z.object({ + input_type: z.literal('Tx'), + input_params: z.object({ + text: z.string(), + text_style: z.string(), + output_id: z.string(), + placeholder: z.string(), + instructions: z.string(), + required: z.boolean(), + options: z.array(z.string()), + }), +}); + +const BtnInput = z.object({ + input_type: z.literal('Btn'), + input_params: z.object({ + text: z.string(), + text_style: z.string(), + output_id: z.string(), + placeholder: z.string(), + instructions: z.string(), + required: z.boolean(), + options: z.array(z.string()), + }), +}); + +const ExtractedInput = z.discriminatedUnion('input_type', [TxInput, BtnInput]); +type ExtractedInput = z.infer; + +const ExtractedElement = z.object({ + id: z.string(), + group_id: z.number(), + element_type: z.string(), + element_params: z.object({ + text: z.string(), + text_style: z.string(), + options: z.string().array().nullable(), + }), + inputs: ExtractedInput.array(), + parent: z.string().nullable(), +}); +type ExtractedElement = z.infer; + +const RawTxField = z.object({ + type: z.literal('/Tx'), + var_name: z.string(), + field_dict: z.object({ + font_info: z.string(), + field_type: z.string(), + coordinates: z.number().array().optional(), + field_label: z.string(), + field_instructions: z.string(), + }), +}); + +const RawBtnField = z.object({ + type: z.literal('/Btn'), + var_name: z.string(), + field_dict: z.object({ + font_info: z.string(), + flags: z.number(), + field_type: z.string(), + field_label: z.string(), + child_fields: z.array(z.object({ coordinates: z.number().array() })), + num_children: z.number(), + }), +}); + +const ExtractedObject = z.object({ + raw_text: z.string(), + title: z.string(), + description: z.string(), + elements: ExtractedElement.array(), + raw_fields: z.discriminatedUnion('type', [RawTxField, RawBtnField]).array(), +}); + +type ExtractedObject = z.infer; + +export type ParsedPdf = { + patterns: PatternMap; + outputs: DocumentFieldMap; // to populate FormOutput + root: PatternId; + title: string; +}; + +export const callExternalParser = async ( + rawData: Uint8Array, + endpointUrl: string = 'https://10x-atj-doc-automation-staging.app.cloud.gov/api/parse' +): Promise => { + const base64 = await uint8ArrayToBase64(rawData); + + const response = await fetch(endpointUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + pdf: base64, + }), + }); + + if (!response.ok) { + throw new Error('Network response was not ok'); + } + + const json = await response.json(); + + console.log('json.parsed_pdf.elements is:\n', json.parsed_pdf.elements); + + const extracted: ExtractedObject = ExtractedObject.parse(json.parsed_pdf); + + const parsedPdf: ParsedPdf = { + patterns: {}, + outputs: {}, + root: 'root', + title: extracted.title, + }; + + const rootSequence: PatternId[] = []; + for (const element of extracted.elements) { + const fieldsetPatterns: PatternId[] = []; + if (element.inputs.length === 0) { + parsedPdf.patterns[element.id] = { + type: 'paragraph', + id: element.id, + data: { + text: element.element_params.text, + maxLength: 2048, + }, + } satisfies ParagraphPattern; + rootSequence.push(element.id); + continue; + } + for (const input of element.inputs) { + if (input.input_type === 'Tx') { + const id = stringToBase64(input.input_params.output_id); + parsedPdf.patterns[id] = { + type: 'input', + id, + data: { + label: input.input_params.instructions, + required: false, + initial: '', + maxLength: 128, + }, + } satisfies InputPattern; + fieldsetPatterns.push(id); + parsedPdf.outputs[id] = { + type: 'TextField', + name: input.input_params.output_id, + label: input.input_params.instructions, + value: '', + maxLength: 1024, + required: input.input_params.required, + }; + } + } + if (fieldsetPatterns.length > 0) { + parsedPdf.patterns[element.id] = { + id: element.id, + type: 'fieldset', + data: { + legend: element.element_params.text, + patterns: fieldsetPatterns, + }, + } satisfies FieldsetPattern; + rootSequence.push(element.id); + } + } + parsedPdf.patterns['root'] = { + id: 'root', + type: 'sequence', + data: { + patterns: rootSequence, + }, + } satisfies SequencePattern; + return parsedPdf; +}; diff --git a/packages/forms/src/documents/suggestions.ts b/packages/forms/src/documents/suggestions.ts index 3103f297..8a80d6f0 100644 --- a/packages/forms/src/documents/suggestions.ts +++ b/packages/forms/src/documents/suggestions.ts @@ -1,4 +1,4 @@ -import { type ParsedPdf, parseAlabamaNameChangeForm } from './pdf/mock-api'; +import { callExternalParser, type ParsedPdf } from './pdf/parsing-api'; export type SuggestedForm = { id: string; @@ -9,1187 +9,8 @@ export type SuggestedForm = { type?: 'text'; }[]; -export const getSuggestedPatternsFromCache = async ( +export const getSuggestedPatterns = async ( rawData: Uint8Array ): Promise => { - const cache = getFakeCache(); - const hash = await getObjectHash(rawData); - return cache.get(hash); + return await callExternalParser(rawData); }; - -const getFakeCache = () => { - const cache: Record = { - 'hardcoded-hash': UD105_TEST_DATA, - '179be8c1c78b01ed7c45569912c2bb862ec3764617f908ebc29178e36fd6316d': - parseAlabamaNameChangeForm(), - }; - return { - get(hashKey: string) { - return cache[hashKey]; - }, - }; -}; - -const getObjectHash = async (buffer: Uint8Array) => { - const hashBuffer = await crypto.subtle.digest('SHA-256', buffer); - const hashArray = new Uint8Array(hashBuffer); - const hashHex = hashArray.reduce( - (str, byte) => str + byte.toString(16).padStart(2, '0'), - '' - ); - return hashHex; -}; - -export const AL_NAME_TEST_DATA = { - Radio_group_test: { - type: 'RadioGroup', - name: 'Radio_group_test', - label: 'Radio_group_test', - value: '', - groupId: 3, - instructions: 'Select something.', - required: true, - }, - Some_random_key_name: { - type: 'Paragraph', - name: 'Some_random_key_name', - value: 'Your current name: ', - groupId: 3, - }, - Current_First_Name1: { - type: 'TextField', - name: 'Current_First_Name1', - label: 'Current_First_Name1', - value: 'Short answer', - groupId: 3, - instructions: 'Type your current first name.', - required: true, - }, - Current_Middle_Name1: { - type: 'TextField', - name: 'Current_Middle_Name1', - label: 'Current_Middle_Name1', - value: 'Short answer', - groupId: 3, - instructions: 'Type your current middle name.', - required: true, - }, - Current_Last_Name1: { - type: 'TextField', - name: 'Current_Last_Name1', - label: 'Current_Last_Name1', - value: 'Short answer', - groupId: 3, - instructions: 'Type your current last name.', - required: true, - }, -}; - -export const UD105_TEST_DATA = [ - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].CaseNumber[0].CaseNumber[0]', - id: 'pdf-obj-0-4', - value: '', - label: 'CASE NUMBER', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].AttyBarNo[0]', - id: 'pdf-obj-0-5', - value: '', - label: 'STATE BAR NUMBER', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].Name[0]', - id: 'pdf-obj-0-6', - value: '', - label: 'NAME', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].AttyFirm[0]', - id: 'pdf-obj-0-7', - value: '', - label: 'FIRM NAME', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].Street[0]', - id: 'pdf-obj-0-8', - value: '', - label: 'STREET ADDRESS', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].City[0]', - id: 'pdf-obj-0-9', - value: '', - label: 'CITY', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].State[0]', - id: 'pdf-obj-0-10', - value: '', - label: 'STATE', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].Zip[0]', - id: 'pdf-obj-0-11', - value: '', - label: 'ZIP CODE', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].Phone[0]', - id: 'pdf-obj-0-12', - value: '', - label: 'Telephone number:', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].Fax[0]', - id: 'pdf-obj-0-13', - value: '', - label: 'Fax number', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].Email[0]', - id: 'pdf-obj-0-14', - value: '', - label: 'E-MAIL ADDRESS:', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].AttyPartyInfo[0].AttyFor[0]', - id: 'pdf-obj-0-15', - value: '', - label: 'ATTORNEY FOR name', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].CourtInfo[0].CrtCounty[0]', - id: 'pdf-obj-0-16', - value: '', - label: 'SUPERIOR COURT OF CALIFORNIA, COUNTY OF', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].CourtInfo[0].CrtStreet[0]', - id: 'pdf-obj-0-17', - value: '', - label: 'STREET ADDRESS', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].CourtInfo[0].CrtMailingAdd[0]', - id: 'pdf-obj-0-18', - value: '', - label: 'MAILING ADDRESS', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].CourtInfo[0].CrtCityZip[0]', - id: 'pdf-obj-0-19', - value: '', - label: 'CITY AND ZIP CODE', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].CourtInfo[0].CrtBranch[0]', - id: 'pdf-obj-0-20', - value: '', - label: 'BRANCH NAME', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].TitlePartyName[0].Party1[0]', - id: 'pdf-obj-0-21', - value: '', - label: 'PLAINTIFF', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page1[0].P1Caption[0].TitlePartyName[0].Party2[0]', - id: 'pdf-obj-0-22', - value: '', - label: 'DEFENDANT', - }, - { - tag: 'textarea', - name: 'UD-105[0].Page1[0].List1[0].item1[0].FillField1[0]', - id: 'pdf-obj-0-23', - label: - 'Defendant all defendants for whom this answer is filed must be named and must sign this answer unless their attorney signs', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page1[0].List2[0].Lia[0].Check1[0]', - id: 'pdf-obj-0-24', - value: '1', - label: - 'General Denial (Do not check this box if the complaint demands more than $1,000.)\n Defendant generally denies each statement of the complaint and of the Mandatory Cover Sheet and Supplemental AllegationsUnlawful Detainer (form UD-101).', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page1[0].List2[0].Lib[0].Check2[0]', - id: 'pdf-obj-0-25', - value: '2', - label: - 'Specific Denials (Check this box and complete (1) and (2) below if complaint demands more than $1,000.)\n Defendant admits that all of the statements of the complaint and of the Mandatory Cover Sheet and Supplemental AllegationsUnlawful Detainer (form UD-101) are true EXCEPT:', - }, - { - tag: 'textarea', - name: 'UD-105[0].Page1[0].List2[0].Lib[0].SubListb[0].Li1[0].Subitem1[0].Lia[0].FillField2[0]', - id: 'pdf-obj-0-26', - label: - 'Defendant claims the following statements of the complaint are false state paragraph numbers from the complaint or explain here or, if more room needed, on form MC-025', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page1[0].List2[0].Lib[0].SubListb[0].Li1[0].Subitem1[0].Lia[0].Check3[0]', - id: 'pdf-obj-0-27', - value: '1', - label: 'Explanation is on form MC-025, titled as Attachment 2b(1)(a).', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page1[0].List2[0].Lib[0].SubListb[0].Li1[0].Subitem1[0].Lib[0].Check4[0]', - id: 'pdf-obj-0-28', - value: '1', - label: 'Explanation is on form MC-025, titled as Attachment 2b(1)(b).', - }, - { - tag: 'textarea', - name: 'UD-105[0].Page1[0].List2[0].Lib[0].SubListb[0].Li1[0].Subitem1[0].Lib[0].FillField3[0]', - id: 'pdf-obj-0-29', - label: 'state paragraph numbers from the complaint or explain here', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page1[0].List2[0].Lib[0].SubListb[0].Li2[0].Subitem2[0].Lia[0].Check5[0]', - id: 'pdf-obj-0-30', - value: '1', - label: - "Defendant did not receive plaintiff's Mandatory Cover Sheet and Supplemental Allegations (form UD-101). (If not checked, complete (b) and (c), as appropriate.)", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page1[0].List2[0].Lib[0].SubListb[0].Li2[0].Subitem2[0].Lib[0].Check5[0]', - id: 'pdf-obj-0-31', - value: '1', - label: - "Defendant claims the statements in the Verification required for issuance of summonsresidential, item 3 of plaintiff's Mandatory Cover Sheet and Supplemental Allegations (form UD-101), are false.", - }, - { - tag: 'textarea', - name: 'UD-105[0].Page1[0].List2[0].Lib[0].SubListb[0].Li2[0].Subitem2[0].Lic[0].FillField4[0]', - id: 'pdf-obj-0-32', - label: - 'Defendant claims the following statements on the Mandatory Cover Sheet and Supplemental AllegationsUnlawful Detainer form UD-101 are false state paragraph numbers from form UD-101 or explain here or, if more room needed, on form MC-025', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page1[0].List2[0].Lib[0].SubListb[0].Li2[0].Subitem2[0].Lic[0].Check6[0]', - id: 'pdf-obj-0-33', - value: '1', - label: 'Explanation is on form MC-025, titled as Attachment 2b(2)(c).', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page2[0].PxCaption[0].CaseNumber[0].CaseNumber[0]', - id: 'pdf-obj-1-4', - value: '', - label: 'CASE NUMBER:', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page2[0].PxCaption[0].TitlePartyName[0].Party1[0]', - id: 'pdf-obj-1-5', - value: '', - label: 'PLAINTIFF', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page2[0].PxCaption[0].TitlePartyName[0].Party2[0]', - id: 'pdf-obj-1-6', - value: '', - label: 'DEFENDANT', - }, - { - tag: 'textarea', - name: 'UD-105[0].Page2[0].List2[0].Lib[0].Sublib[0].Li2[0].Subitem2[0].Lid[0].FillField5[0]', - id: 'pdf-obj-1-7', - label: - 'Defendant has no information or belief that the following statements on the Mandatory Cover Sheet and Supplemental AllegationsUnlawful Detainer form UD-101 are true, so defendant denies them state paragraph numbers from form UD-101 or explain here or, if more room needed, on form MC-025', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List2[0].Lib[0].Sublib[0].Li2[0].Subitem2[0].Lid[0].Check7[0]', - id: 'pdf-obj-1-8', - value: '1', - label: 'Explanation is on form MC-025, titled as Attachment 2b(2)(d).', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lia[0].Check8[0]', - id: 'pdf-obj-1-10', - value: '1', - label: - '(Nonpayment of rent only) Plaintiff has breached the warranty to provide habitable premises.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lib[0].Check9[0]', - id: 'pdf-obj-1-11', - value: '1', - label: - '(Nonpayment of rent only) Defendant made needed repairs and properly deducted the cost from the rent, and plaintiff did not give proper credit.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lic[0].Check10[0]', - id: 'pdf-obj-1-12', - value: '1', - label: '(Nonpayment of rent only)', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page2[0].List3[0].Lic[0].Date1[0]', - id: 'pdf-obj-1-13', - value: '', - label: 'on date', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lid[0].Check11[0]', - id: 'pdf-obj-1-14', - value: '1', - label: 'Plaintiff waived, changed, or canceled the notice to quit.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lie[0].Check12[0]', - id: 'pdf-obj-1-15', - value: '1', - label: - 'Plaintiff served defendant with the notice to quit or filed the complaint to retaliate against defendant.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lif[0].Check13[0]', - id: 'pdf-obj-1-16', - value: '1', - label: - 'By serving defendant with the notice to quit or filing the complaint, plaintiff is arbitrarily discriminating against the defendant in violation of the Constitution or the laws of the United States or California.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lig[0].Check14[0]', - id: 'pdf-obj-1-17', - value: '1', - label: - "Plaintiff's demand for possession violates the local rent control or eviction control ordinance of", - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page2[0].List3[0].Lig[0].FillField6[0]', - id: 'pdf-obj-1-18', - value: '', - label: 'city or county, title of ordinance, and date of passage', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lih[0].Check15[0]', - id: 'pdf-obj-1-19', - value: '1', - label: - "Plaintiff's demand for possession is subject to the Tenant Protection Act of 2019, Civil Code section 1946.2 or 1947.12, and is not in compliance with the act. (Check all that apply and briefly state in item 3w the facts that support each.)", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lih[0].SubListh[0].Li1[0].Check16[0]', - id: 'pdf-obj-1-20', - value: '1', - label: - 'Plaintiff failed to state a just cause for termination of tenancy in the written notice to terminate.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lih[0].SubListh[0].Li2[0].Check17[0]', - id: 'pdf-obj-1-21', - value: '1', - label: - 'Plaintiff failed to provide an opportunity to cure any alleged violations of terms and conditions of the lease (other than payment of rent) as required under Civil Code section 1946.2(c).', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lih[0].SubListh[0].Li3[0].Check18[0]', - id: 'pdf-obj-1-22', - value: '1', - label: - 'Plaintiff failed to comply with the relocation assistance requirements of Civil Code section 1946.2(d).', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lih[0].SubListh[0].Li4[0].Check19[0]', - id: 'pdf-obj-1-23', - value: '1', - label: - 'Plaintiff has raised the rent more than the amount allowed under Civil Code section 1947.12, and the only unpaid rent is the unauthorized amount.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lih[0].SubListh[0].Li5[0].Check20[0]', - id: 'pdf-obj-1-24', - value: '1', - label: - 'Plaintiff violated the Tenant Protection Act in another manner that defeats the complaint.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lii[0].Check21[0]', - id: 'pdf-obj-1-25', - value: '1', - label: - 'Plaintiff accepted rent from defendant to cover a period of time after the date the notice to quit expired.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lij[0].Check22[0]', - id: 'pdf-obj-1-26', - value: '1', - label: - "Plaintiff seeks to evict defendant based on an act against defendant or a member of defendant's household that constitutes domestic violence, sexual assault, stalking, human trafficking, or abuse of an elder or a dependent adult. (This defense requires one of the following: (1) a temporary restraining order, protective order, or police report that is not more than 180 days old; OR (2) a signed statement from a qualified third party (e.g., a doctor, domestic violence or sexual assault counselor, human trafficking caseworker, or psychologist) concerning the injuries or abuse resulting from these acts).)", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lik[0].Check23[0]', - id: 'pdf-obj-1-27', - value: '1', - label: - 'Plaintiff seeks to evict defendant based on defendant or another person calling the police or emergency assistance (e.g., ambulance) by or on behalf of a victim of abuse, a victim of crime, or an individual in an emergency when defendant or the other person believed that assistance was necessary.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lil[0].Check24[0]', - id: 'pdf-obj-1-28', - value: '1', - label: - "Plaintiff's demand for possession of a residential property is in retaliation for nonpayment of rent or other financial obligations due between March 1, 2020, and September 30, 2021, even though alleged to be based on other reasons. (Civil Code, section 1942.5(d); Governmental Code, section 12955.)", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lim[0].Check25[0]', - id: 'pdf-obj-1-29', - value: '1', - label: - "Plaintiff's demand for possession of a residential property is based on nonpayment of rent or other financial obligations due between March 1, 2020, and September 30, 2021, and (check all that apply):", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lim[0].SublIm[0].Li1[0].Check26[0]', - id: 'pdf-obj-1-30', - value: '1', - label: - 'Plaintiff did not serve the general notice or notices of rights under the COVID-19 Tenant Relief Act as required by Code of Civil Procedure section 1179.04.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page2[0].List3[0].Lim[0].SublIm[0].Li2[0].Check27[0]', - id: 'pdf-obj-1-31', - value: '1', - label: - 'Plaintiff did not serve the required 15-day notice. (Code Civil Procedure, section 1179.03(b) or (c).)', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page3[0].PxCaption[0].CaseNumber[0].CaseNumber[0]', - id: 'pdf-obj-2-4', - value: '', - label: 'CASE NUMBER:', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page3[0].PxCaption[0].TitlePartyName[0].Party1[0]', - id: 'pdf-obj-2-5', - value: '', - label: 'PLAINTIFF', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page3[0].PxCaption[0].TitlePartyName[0].Party2[0]', - id: 'pdf-obj-2-6', - value: '', - label: 'DEFENDANT', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lim[0].SubLim[0].Li3[0].Check28[0]', - id: 'pdf-obj-2-7', - value: '1', - label: - 'Plaintiff did not provide an unsigned declaration of COVID-19 related financial distress with the 15-day notice. (Code Civil Procedure, section 1179.03(d).)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lim[0].SubLim[0].Li4[0].Check29[0]', - id: 'pdf-obj-2-8', - value: '1', - label: - 'Plaintiff did not provide an unsigned declaration of COVID-19related financial distress in the language in which the landlord was required to provide a translation of the rental agreement. (Code Civil Procedure, section 1179.03(d).)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lim[0].SubLim[0].Li5[0].Check30[0]', - id: 'pdf-obj-2-9', - value: '1', - label: - 'Plaintiff identified defendant as a high-income tenant in the 15-day notice, but plaintiff did not possess proof at the time the notice was served establishing that defendant met the definition of high-income tenant. (Code Civil Procedure, section 1179.02.5(b).)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lim[0].SubLim[0].Li6[0].SubItem6[0].Lia[0].Check31[0]', - id: 'pdf-obj-2-10', - value: '1', - label: - 'Defendant delivered to plaintiff one or more declarations of COVID-19related financial distress and, if required as a "high-income tenant," documentation in support. (Code Civil Procedure, sections 1179.03(f) and 1179.02.5.)', - }, - { - tag: 'textarea', - name: 'UD-105[0].Page3[0].List3[0].Lim[0].SubLim[0].Li6[0].SubItem6[0].Lia[0].FillField7[0]', - id: 'pdf-obj-2-11', - label: - '(Describe when and how delivered and check all other items below that apply):', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lim[0].SubLim[0].Li6[0].SubItem6[0].Lib[0].Check32[0]', - id: 'pdf-obj-2-12', - value: '1', - label: - "Plaintiff's demand for payment includes late fees on rent or other financial obligations due between March 1, 2020, and September 30, 2021.", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lim[0].SubLim[0].Li6[0].SubItem6[0].Lic[0].Check33[0]', - id: 'pdf-obj-2-13', - value: '1', - label: - "Plaintiff's demand for payment includes fees for services that were increased or not previously charged.", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lim[0].SubLim[0].Li6[0].SubItem6[0].Lid[0].Check34[0]', - id: 'pdf-obj-2-14', - value: '1', - label: - 'Defendant, on or before September 30, 2021, paid or offered plaintiff payment of at least 25% of the total rental payments that were due between September 1, 2020, and September 30, 2021, and that were demanded in the termination notices for which defendant delivered the declarations described in (a). (Code Civil Procedure, section 1179.03(g)(2).)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lim[0].SubLim[0].Li7[0].Check35[0]', - id: 'pdf-obj-2-15', - value: '1', - label: - 'Defendant is currently filing or has already filed a declaration of COVID-19related financial distress with the court. (Code Civil Procedure, section 1179.03(h).)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lin[0].Check36[0]', - id: 'pdf-obj-2-16', - value: '1', - label: - "Plaintiff's demand for possession of a residential property is based on nonpayment of rent or other financial obligations due between October 1, 2021, and March 31, 2022, and (check all that apply):", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lin[0].SubLin[0].Li1[0].Check35[0]', - id: 'pdf-obj-2-17', - value: '1', - label: "Plaintiff's notice to quit was served before April 1, 2022, and", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lin[0].SubLin[0].Li1[0].SubLi1[0].Lia[0].CheckBox190[0]', - id: 'pdf-obj-2-18', - value: '1', - label: - 'Did not contain the required contact information for the pertinent governmental rental assistance program, or the other content required by Code of Civil Procedure section 1179.10(a).', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lin[0].SubLin[0].Li1[0].SubLi1[0].Lib[0].CheckBox192[0]', - id: 'pdf-obj-2-19', - value: '1', - label: - 'Did not did not include a translation of the statutorily required notice. (Code Civil Procedure, section 1179.10(a)(2) and Civil Code, section 1632.)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lin[0].SubLin[0].Li2[0].Check35[0]', - id: 'pdf-obj-2-20', - value: '1', - label: - "Plaintiff's notice to quit was served between April 1, 2022, and June 30, 2022, and did not contain the required information about the government rental assistance program and possible protections, as required by Code of Civil Procedure section 1179.10(b).", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lio[0].Check37[0]', - id: 'pdf-obj-2-21', - value: '1', - label: - "For a tenancy initially established before October 1, 2021, plaintiff's demand for possession of a residential property is based on nonpayment of rent or other financial obligations due between March 1, 2020, and March 31, 2022, and (check all that apply):", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lio[0].SubLio[0].Li1[0].Check35[0]', - id: 'pdf-obj-2-22', - value: '1', - label: - 'Plaintiff did not complete an application for rental assistance to cover the rental debt demanded in the complaint before filing the complaint in this action.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lio[0].SubLio[0].Li2[0].Check35[0]', - id: 'pdf-obj-2-23', - value: '1', - label: "Plaintiff's application for rental assistance was not denied.", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lio[0].SubLio[0].Li3[0].Check35[0]', - id: 'pdf-obj-2-24', - value: '1', - label: - "Plaintiff's application for rental assistance was denied for a reason that does not support issuance of a summons or judgment in an unlawful detainer action (check all that apply):", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lio[0].SubLio[0].Li3[0].SubLi3[0].Lia[0].Check32[0]', - id: 'pdf-obj-2-25', - value: '1', - label: - "Plaintiff did not fully or properly complete plaintiff's portion of the application. (Code Civil Procedure, section 1179.09(d)(2)(A).)", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lio[0].SubLio[0].Li3[0].SubLi3[0].Lib[0].Check33[0]', - id: 'pdf-obj-2-26', - value: '1', - label: - 'Plaintiff did not apply to the correct rental assistance program. (Code Civil Procedure, section 1179.09(d)(2)(C).)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lio[0].SubLio[0].Li4[0].Check35[0]', - id: 'pdf-obj-2-27', - value: '1', - label: - 'An application for rental assistance was filed before April 1, 2022, and the determination is still pending.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lio[0].SubLio[0].Li5[0].Check35[0]', - id: 'pdf-obj-2-28', - value: '1', - label: - 'Rental assistance has been approved and tenant is separately filing an application to prevent forfeiture (form UD-125).', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lip[0].Check38[0]', - id: 'pdf-obj-2-29', - value: '1', - label: - "Defendant provided plaintiff with a declaration under penalty of perjury for the Centers for Disease Control and Prevention's temporary halt in evictions to prevent further spread of COVID-19 (85 Federal Register 55292 at 55297), and plaintiff's reason for termination of the tenancy is one that the temporary halt in evictions applies to.", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lip[0].SubLip[0].Li1[0].Check35[0]', - id: 'pdf-obj-2-30', - value: '1', - label: - 'Plaintiff received or has a pending application for rental assistance from a governmental rental assistance program or some other source relating to the amount claimed in the notice to pay rent or quit. (Health & Safety Code, sections 50897.1(d)(2)(B) and 50897.3(e)(2).)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page3[0].List3[0].Lip[0].SubLip[0].Li2[0].Check35[0]', - id: 'pdf-obj-2-31', - value: '1', - label: - 'Plaintiff received or has a pending application for rental assistance from a governmental rental assistance program or some other source for rent accruing since the notice to pay rent or quit. (Health & Safety Code, sections 50897.1(d)(2)(B) and 50897.3(e)(2).)', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page4[0].PxCaption[0].CaseNumber[0].CaseNumber[0]', - id: 'pdf-obj-3-4', - value: '', - label: 'CASE NUMBER:', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page4[0].PxCaption[0].TitlePartyName[0].Party1[0]', - id: 'pdf-obj-3-5', - value: '', - label: 'PLAINTIFF', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page4[0].PxCaption[0].TitlePartyName[0].Party2[0]', - id: 'pdf-obj-3-6', - value: '', - label: 'DEFENDANT', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Liq[0].Check39[0]', - id: 'pdf-obj-3-7', - value: '1', - label: - 'Plaintiff violated the COVID-19 Tenant Relief Act (Code Civil Procedure, section 1179.01 et seq.) or a local COVID-19 related ordinance regarding evictions in some other way (briefly state facts describing this in item 3w).', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Lir[0].Check39[0]', - id: 'pdf-obj-3-8', - value: '1', - label: - "The property is covered by the federal CARES Act and the plaintiff did not provide 30 days' notice to vacate.", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Lis[0].Check42[0]', - id: 'pdf-obj-3-9', - value: '1', - label: - 'Plaintiff improperly applied payments made by defendant in a tenancy that was in existence between March 1, 2020, and September 30, 2021 (Code Civil Procedure, section 1179.04.5), as follows (check all that apply):', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Lis[0].SubLis[0].Li1[0].Check43[0]', - id: 'pdf-obj-3-10', - value: '1', - label: - 'Plaintiff applied a security deposit to rent, or other financial obligations due, without tenants written agreement.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Lis[0].SubLis[0].Li2[0].Check44[0]', - id: 'pdf-obj-3-11', - value: '1', - label: - 'Plaintiff applied a monthly rental payment to rent or other financial obligations that were due between March 1, 2020, and September 30, 2021, other than to the prospective months rent, without tenants written agreement.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Lit[0].Check45[0]', - id: 'pdf-obj-3-12', - value: '1', - label: - 'Plaintiff refused to accept payment from a third party for rent due. (Civil Code, section 1947.3; Governmental Code, section 12955.)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Liu[0].CheckBox19[0]', - id: 'pdf-obj-3-13', - value: '1', - label: - 'Defendant has a disability and plaintiff refused to provide a reasonable accommodation that was requested. )(Cal. Code Regs., tit. 2, 12176(c).)', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Liv[0].Check45[0]', - id: 'pdf-obj-3-14', - value: '1', - label: 'Other defenses and objections are stated in item 3w.', - }, - { - tag: 'textarea', - name: 'UD-105[0].Page4[0].List3[0].Liw[0].FillField9[0]', - id: 'pdf-obj-3-15', - label: - 'Provide facts for each item checked above, either here, or, if more room needed, on form MC-025', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Liw[0].Check46[0]', - id: 'pdf-obj-3-16', - value: '1', - label: - 'Description of facts or defenses are on form MC-025, titled as Attachment 3w.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List3[0].Li3[0].Check35[0]', - id: 'pdf-obj-3-17', - value: '1', - label: - "Plaintiff's demand for possession is based only on late fees for defendant's failure to provide landlord payment within 15 days of receiving governmental rental assistance. (Health & Safety Code, section 50897.1(e)(2)(B).)", - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List4[0].Lia[0].Check47[0]', - id: 'pdf-obj-3-18', - value: '1', - label: 'Defendant vacated the premises on', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page4[0].List4[0].Lia[0].Date2[0]', - id: 'pdf-obj-3-19', - value: '', - label: 'date', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List4[0].Lib[0].Check48[0]', - id: 'pdf-obj-3-20', - value: '1', - label: - 'The fair rental value of the premises alleged in the complaint is excessive (explain below or, if more room needed, on form MC-025):', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List4[0].Lib[0].Check49[0]', - id: 'pdf-obj-3-21', - value: '1', - label: 'Explanation is on form MC-025, titled as Attachment 4b.', - }, - { - tag: 'textarea', - name: 'UD-105[0].Page4[0].List4[0].Lib[0].FillField10[0]', - id: 'pdf-obj-3-22', - label: 'explain', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List4[0].Lic[0].Check50[0]', - id: 'pdf-obj-3-23', - value: '1', - label: 'Other (specify below or, if more room needed, on form MC-025):', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List4[0].Lic[0].Check51[0]', - id: 'pdf-obj-3-24', - value: '1', - label: 'Other statements are on form MC-025, titled as Attachment 4c.', - }, - { - tag: 'textarea', - name: 'UD-105[0].Page4[0].List4[0].Lic[0].FillField11[0]', - id: 'pdf-obj-3-25', - label: 'other specify', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List5[0].Lic[0].Check52[0]', - id: 'pdf-obj-3-26', - value: '1', - label: 'reasonable attorney fees.', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page4[0].List5[0].Lid[0].Check53[0]', - id: 'pdf-obj-3-27', - value: '1', - label: - 'that plaintiff be ordered to (1) make repairs and correct the conditions that constitute a breach of the warranty to provide habitable premises and (2) reduce the monthly rent to a reasonable rental value until the conditions are corrected.', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].PxCaption[0].CaseNumber[0].CaseNumber[0]', - id: 'pdf-obj-4-6', - value: '', - label: 'CASE NUMBER:', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].PxCaption[0].TitlePartyName[0].Party1[0]', - id: 'pdf-obj-4-7', - value: '', - label: 'PLAINTIFF', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].PxCaption[0].TitlePartyName[0].Party2[0]', - id: 'pdf-obj-4-8', - value: '', - label: 'DEFENDANT', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page5[0].List5[0].Lie[0].Check54[0]', - id: 'pdf-obj-4-9', - value: '1', - label: 'Other (specify below or on form MC-025):', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page5[0].List5[0].Lie[0].Check55[0]', - id: 'pdf-obj-4-10', - value: '1', - label: - 'All other requests are stated on form MC-025, titled as Attachment 5e.', - }, - { - tag: 'textarea', - name: 'UD-105[0].Page5[0].List5[0].Lie[0].FillField12[0]', - id: 'pdf-obj-4-11', - label: 'other specify', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].List6[0].item6[0].FillPages1[0]', - id: 'pdf-obj-4-12', - value: '', - label: 'Number of pages attached', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page5[0].UDAssistant[0].List7[0].Check561[0]', - id: 'pdf-obj-4-13', - value: '1', - label: 'did not', - }, - { - tag: 'input', - type: 'checkbox', - name: 'UD-105[0].Page5[0].UDAssistant[0].List7[0].Check561[1]', - id: 'pdf-obj-4-14', - value: '2', - label: 'did', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].UDAssistant[0].List7[0].Lia[0].AsstName[0]', - id: 'pdf-obj-4-15', - value: '', - label: "Assistant's name", - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].UDAssistant[0].List7[0].Lib[0].PhoneNum[0]', - id: 'pdf-obj-4-16', - value: '', - label: 'Telephone number', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].UDAssistant[0].List7[0].Lic[0].Address[0]', - id: 'pdf-obj-4-17', - value: '', - label: 'Street address city and zip code', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].UDAssistant[0].List7[0].Lid[0].RegCounty[0]', - id: 'pdf-obj-4-18', - value: '', - label: 'County of registration', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].UDAssistant[0].List7[0].Lie[0].RegNo[0]', - id: 'pdf-obj-4-19', - value: '', - label: 'Registration number', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].UDAssistant[0].List7[0].Lif[0].RegExp[0]', - id: 'pdf-obj-4-20', - value: '', - label: 'Expiration date', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].UDAssistant[0].Sign[0].PrintName1[0]', - id: 'pdf-obj-4-21', - value: '', - label: 'Type or print name', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].UDAssistant[0].Sign[0].PrintName2[0]', - id: 'pdf-obj-4-22', - value: '', - label: 'Type or print name', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].UDAssistant[0].Sign[0].PrintName11[0]', - id: 'pdf-obj-4-23', - value: '', - label: 'Type or print name', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].Verification[0].Date3[0]', - id: 'pdf-obj-4-24', - value: '', - label: 'Date', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].Verification[0].PrintName3[0]', - id: 'pdf-obj-4-25', - value: '', - label: 'Type or print name', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].Verification[0].Date4[0]', - id: 'pdf-obj-4-26', - value: '', - label: 'Date', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].Verification[0].PrintName4[0]', - id: 'pdf-obj-4-27', - value: '', - label: 'Type or print name', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].Verification[0].Date5[0]', - id: 'pdf-obj-4-28', - value: '', - label: 'Date', - }, - { - tag: 'input', - type: 'text', - name: 'UD-105[0].Page5[0].Verification[0].PrintName5[0]', - id: 'pdf-obj-4-29', - value: '', - label: 'Type or print name', - }, -]; diff --git a/packages/forms/src/documents/util.ts b/packages/forms/src/documents/util.ts index 6f881685..90f6a49a 100644 --- a/packages/forms/src/documents/util.ts +++ b/packages/forms/src/documents/util.ts @@ -11,3 +11,17 @@ export const stringToBase64 = (input: string): string => { return window.btoa(binaryString); } }; + +export const uint8ArrayToBase64 = (uint8Array: Uint8Array) => { + return new Promise((resolve, reject) => { + const blob = new Blob([uint8Array], { type: 'application/octet-stream' }); + const reader = new FileReader(); + reader.onloadend = function () { + // Convert the data URL to a base64 string + const base64 = (this.result as string).split(',')[1]; + resolve(base64); + }; + reader.onerror = reject; + reader.readAsDataURL(blob); + }); +};