XFDF string with FreeText import failing

PDF.js Express Plus (@pdftron/pdfjs-express)
v8.7.0

Detailed description of issue
I am building a prototype in which I am importing individual annotations on state update.
I am using mock data with exported xfdf strings set as a string-type property

The way I’m achieving this is by deleting annotations, then importing the next selected annotations.

Annotations with all enabled tools are importing as expected with the exception of annotations with FreeText.
I am not exactly sure what the failure is - just that the importAnnotations method is not successful in loading the annotations to the viewer.

I followed this topic, however, the suggested string.replace() did not resolve my issue.
Upgrading to 8.7.0 also did not resolve my issue.

Expected behaviour
WebViewer instance should import xfdf with FreeText annotations successfully

Does your issue happen with every document, or just one?
Issue is specific to annotations.

Code snippet
Exported xfdf:

<?xml version="1.0" encoding="UTF-8" ?><xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><pdf-info xmlns="http://www.pdftron.com/pdfinfo" version="2" import-version="4" /><fields /><annots><freetext page="0" rect="486.170,775.870,848.130,822.990" flags="print" name="c631b34e-479a-5082-d592-73491cf8e540" title="Guest" subject="FreeText" date="D:20220819111822-04'00'" width="0" creationdate="D:20220819111817-04'00'" TextColor="#000000" FontSize="20"><trn-custom-data bytes="{&quot;trn-wrapped-text-lines&quot;:&quot;[\&quot;Test Text Here \&quot;]&quot;}"/><contents>Test Text Here</contents><contents-richtext><body><p><span>Test Text Here</span></p></body></contents-richtext><defaultappearance>0 0 0 rg /Helvetica 20 Tf</defaultappearance><defaultstyle>font: Helvetica 20pt; text-align: left; text-vertical-align: top; color: #000000</defaultstyle></freetext></annots><pages><defmtx matrix="1,0,0,-1,0,1080" /></pages></xfdf>

Import snippet:

if (webViewerInstance) {
    const annotations = await webViewerInstance.Core.annotationManager.getAnnotationsList();
    await webViewerInstance.Core.annotationManager.deleteAnnotations(
        annotations
    );
    if (submission.annotation) {
        await webViewerInstance.Core.annotationManager.importAnnotations(submission.annotation);
    }
}

UPDATE

After some poking around, I found that if I remove the <trn-custom-data /> tag entirely, the annotation loads as expected.

Not sure where that custom data is coming from. I am directly pushing annotation-header-tools into the header.

UPDATE
It appears that the issue has something to do with the way the value for trn-wrapped-text-lines is being encoded.
I was able to import the annotation xfdf after removing &quot; from inside the parentheses

Before (not importing):

<trn-custom-data bytes="{&quot;trn-auto-size-type&quot;:&quot;auto&quot;,&quot;trn-wrapped-text-lines&quot;:&quot;[&quot;Test Test]&quot;}"/

After (importing):

<trn-custom-data bytes="{&quot;trn-auto-size-type&quot;:&quot;auto&quot;,&quot;trn-wrapped-text-lines&quot;:&quot;[Test Test]&quot;}"/>

Parsed XML:

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here