feat: implement in-memory log buffer, add ICP-Brasil seal assets, and improve SDK parameter handling

This commit is contained in:
Claudecio Martins
2026-10-11 20:58:49 -03:00
parent 2a50704a7f
commit 5f4a212786
14 changed files with 399 additions and 213 deletions
+28 -4
View File
@@ -20,7 +20,31 @@ export class PdfSealDesigner {
throw new Error('Container DOM obrigatório para instanciar PdfSealDesigner.');
}
this.onChange = options.onChange || null;
this.onChange = options.onChange || options.onConfigChange || null;
const rawInitial = options.initialTheme || options.initialConfig || {};
const normalizedInitial = {
name: rawInitial.name,
description: rawInitial.description,
width: rawInitial.width,
height: rawInitial.height,
primaryColor: rawInitial.primaryColor || rawInitial.primary_color,
secondaryColor: rawInitial.secondaryColor || rawInitial.secondary_color,
backgroundColor: rawInitial.backgroundColor || rawInitial.background_color,
borderColor: rawInitial.borderColor || rawInitial.border_color,
textColor: rawInitial.textColor || rawInitial.text_color,
iconStyle: rawInitial.iconStyle || rawInitial.icon_style,
customLogoBase64: rawInitial.customLogoBase64 || rawInitial.custom_logo_base64,
customHeader: rawInitial.customHeader || rawInitial.custom_header || rawInitial.title,
customFooter: rawInitial.customFooter || rawInitial.custom_footer,
customFieldLabel: rawInitial.customFieldLabel || rawInitial.custom_field_label,
customFieldValue: rawInitial.customFieldValue || rawInitial.custom_field_value,
defaultCpfMode: rawInitial.defaultCpfMode || rawInitial.default_cpf_mode,
defaultIncludeDateTime: rawInitial.defaultIncludeDateTime !== undefined ? rawInitial.defaultIncludeDateTime : rawInitial.default_include_date_time
};
// Remove chaves indefinidas para não sobrescrever os defaults
Object.keys(normalizedInitial).forEach(k => normalizedInitial[k] === undefined && delete normalizedInitial[k]);
// Estado do tema
this.theme = {
@@ -37,11 +61,11 @@ export class PdfSealDesigner {
customLogoBase64: null,
customHeader: 'DOCUMENTO ASSINADO DIGITALMENTE',
customFooter: 'Verifique a autenticidade da assinatura eletrônica em https://validar.iti.gov.br',
customFieldLabel: 'Cargo',
customFieldValue: 'Diretor Responsável',
customFieldLabel: '',
customFieldValue: '',
defaultCpfMode: 'MASKED',
defaultIncludeDateTime: true,
...(options.initialTheme || {})
...normalizedInitial
};
this._initDom();