@credithub/harlan-components 1.131.0 → 1.131.1
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.
- package/dist/consultaSimples.js +4 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/domResilience.d.ts +17 -0
- package/dist/utils/domResilience.js +47 -0
- package/lib/cjs/index.js +218 -167
- package/lib/esm/index.js +218 -167
- package/package.json +1 -1
package/dist/consultaSimples.js
CHANGED
|
@@ -40,7 +40,10 @@ import GlobalStyle from './styles/globalStyle';
|
|
|
40
40
|
import theme from './styles/theme';
|
|
41
41
|
import { hasOneOfTags } from './utils/tags';
|
|
42
42
|
Chart.register.apply(Chart, registerables);
|
|
43
|
-
|
|
43
|
+
// `data-credithub-skip` opta a subárvore inteira fora do `replaceElement` da
|
|
44
|
+
// extensão `credithub-components`, que de outra forma muta os Text nodes
|
|
45
|
+
// renderizados pelo React e provoca `NotFoundError` em removeChild/insertBefore.
|
|
46
|
+
var Wrapper = styled.div.attrs({ 'data-credithub-skip': '' })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n margin-bottom: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"], ["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n margin-bottom: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"])));
|
|
44
47
|
// Componente de dependência de Protestos estabilizado em escopo de módulo
|
|
45
48
|
var ProtestosWithCCFDependency = React.memo(function (_a) {
|
|
46
49
|
var children = _a.children, documento = _a.documento;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Torna o React resiliente a mutações de DOM feitas por código externo
|
|
3
|
+
* (extensões do navegador, Google Translate, content scripts como o
|
|
4
|
+
* `replaceElement` do `credithub-components` que envolve CPF/CNPJ em
|
|
5
|
+
* `<x-credithub-extension>` por baixo dos panos).
|
|
6
|
+
*
|
|
7
|
+
* Sem este patch, quando o reconciler do React 18 tenta remover ou inserir
|
|
8
|
+
* um nó que já foi movido por terceiros, o navegador lança
|
|
9
|
+
* `NotFoundError: Failed to execute 'removeChild' on 'Node'` e o React
|
|
10
|
+
* derruba a árvore inteira via error boundary.
|
|
11
|
+
*
|
|
12
|
+
* O patch é idempotente: se outra cópia da lib já o aplicou na mesma
|
|
13
|
+
* página, esta chamada vira no-op.
|
|
14
|
+
*
|
|
15
|
+
* Referência: https://github.com/facebook/react/issues/11538
|
|
16
|
+
*/
|
|
17
|
+
export declare function installDomResilience(): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Torna o React resiliente a mutações de DOM feitas por código externo
|
|
3
|
+
* (extensões do navegador, Google Translate, content scripts como o
|
|
4
|
+
* `replaceElement` do `credithub-components` que envolve CPF/CNPJ em
|
|
5
|
+
* `<x-credithub-extension>` por baixo dos panos).
|
|
6
|
+
*
|
|
7
|
+
* Sem este patch, quando o reconciler do React 18 tenta remover ou inserir
|
|
8
|
+
* um nó que já foi movido por terceiros, o navegador lança
|
|
9
|
+
* `NotFoundError: Failed to execute 'removeChild' on 'Node'` e o React
|
|
10
|
+
* derruba a árvore inteira via error boundary.
|
|
11
|
+
*
|
|
12
|
+
* O patch é idempotente: se outra cópia da lib já o aplicou na mesma
|
|
13
|
+
* página, esta chamada vira no-op.
|
|
14
|
+
*
|
|
15
|
+
* Referência: https://github.com/facebook/react/issues/11538
|
|
16
|
+
*/
|
|
17
|
+
var FLAG = '__credithubDomResilienceInstalled__';
|
|
18
|
+
export function installDomResilience() {
|
|
19
|
+
if (typeof window === 'undefined' || typeof Node === 'undefined') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
var flagged = window;
|
|
23
|
+
if (flagged[FLAG])
|
|
24
|
+
return;
|
|
25
|
+
flagged[FLAG] = true;
|
|
26
|
+
var originalRemoveChild = Node.prototype.removeChild;
|
|
27
|
+
Node.prototype.removeChild = function patchedRemoveChild(child) {
|
|
28
|
+
if (child.parentNode !== this) {
|
|
29
|
+
if (typeof console !== 'undefined' && typeof console.warn === 'function') {
|
|
30
|
+
console.warn('[harlan-components] removeChild ignorado: nó não é mais filho do esperado. Provável interferência de extensão de navegador.', { child: child, expectedParent: this });
|
|
31
|
+
}
|
|
32
|
+
return child;
|
|
33
|
+
}
|
|
34
|
+
return originalRemoveChild.call(this, child);
|
|
35
|
+
};
|
|
36
|
+
var originalInsertBefore = Node.prototype.insertBefore;
|
|
37
|
+
Node.prototype.insertBefore = function patchedInsertBefore(newNode, referenceNode) {
|
|
38
|
+
if (referenceNode != null && referenceNode.parentNode !== this) {
|
|
39
|
+
if (typeof console !== 'undefined' && typeof console.warn === 'function') {
|
|
40
|
+
console.warn('[harlan-components] insertBefore ajustado: nó de referência não é mais filho do esperado. Anexando ao final.', { newNode: newNode, referenceNode: referenceNode, expectedParent: this });
|
|
41
|
+
}
|
|
42
|
+
return originalInsertBefore.call(this, newNode, null);
|
|
43
|
+
}
|
|
44
|
+
return originalInsertBefore.call(this, newNode, referenceNode);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
installDomResilience();
|