cometchat-visual-builder-no-code 1.0.20-authtest52 → 1.0.20-authtest53
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/156.main.js +1 -1
- package/dist/194.main.js +1 -1
- package/dist/37.main.js +1 -1
- package/dist/380.main.js +1 -1
- package/dist/750.main.js +1 -1
- package/dist/main.js +1 -1
- package/dist/src/sdkStyleMarker.d.ts +59 -22
- package/package.json +4 -4
|
@@ -1,27 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Marks every <style> element created/inserted after the CometChat bundle loads
|
|
3
|
+
* with a `data-cometchat-sdk` attribute.
|
|
4
4
|
*
|
|
5
5
|
* This MUST be imported as the very first import in the bundle entry point (index.tsx).
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* - Before the bundle loads, the host page may
|
|
9
|
-
* Those
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
7
|
+
* Why the marker exists:
|
|
8
|
+
* - Before the bundle loads, the host page may already have <style> elements.
|
|
9
|
+
* Those must NOT be marked — they are host styles and cause CSS conflicts.
|
|
10
|
+
* - Everything marked after that point is treated as ours: webpack style-loader
|
|
11
|
+
* injections, MUI/JSS runtime styles, CometChat Calls SDK styles (goober, .ccccn,
|
|
12
|
+
* .awssld), and any other runtime styles.
|
|
13
|
+
*
|
|
14
|
+
* IframePortal uses this marker to decide what to copy into the iframe:
|
|
15
|
+
* - Has `data-cometchat-sdk` or `data-cometchat` -> copy (SDK/widget style)
|
|
16
|
+
* - Has neither -> block (host page style)
|
|
17
|
+
*
|
|
18
|
+
* Two strategies, in order of preference:
|
|
19
|
+
*
|
|
20
|
+
* 1. Monkeypatch `document.createElement`, marking at creation time. This is the
|
|
21
|
+
* primary path and leaves behaviour byte-identical on hosts that permit it.
|
|
22
|
+
*
|
|
23
|
+
* 2. MutationObserver fallback, marking at insertion time. Required because some
|
|
24
|
+
* hosts harden the document and make `createElement` non-writable and
|
|
25
|
+
* non-configurable:
|
|
26
|
+
*
|
|
27
|
+
* Object.getOwnPropertyDescriptor(document, "createElement")
|
|
28
|
+
* -> { writable: false, configurable: false }
|
|
29
|
+
*
|
|
30
|
+
* The assignment then throws in strict mode and, before this fallback existed,
|
|
31
|
+
* took the whole bundle down with it, so the widget never initialised at all.
|
|
32
|
+
*
|
|
33
|
+
* KNOWN TRADE-OFF (fallback path only)
|
|
34
|
+
* The fallback is NOT equivalent to the monkeypatch — it is strictly more
|
|
35
|
+
* permissive. The patch only observed `document.createElement`, whereas the
|
|
36
|
+
* observer also catches innerHTML/insertAdjacentHTML, cloned and adopted nodes,
|
|
37
|
+
* and <style> nested inside inserted subtrees. Host styles injected at runtime
|
|
38
|
+
* therefore get marked and copied into the iframe, weakening the isolation
|
|
39
|
+
* guarantee in `design.md` Property 3 / Req 1.4 on these hosts.
|
|
40
|
+
*
|
|
41
|
+
* This is an accepted trade-off, not an oversight: the marking is purely
|
|
42
|
+
* time-based, so there is no reliable way to tell a host's runtime <style> from
|
|
43
|
+
* ours. The original monkeypatch already had a narrower version of this hole
|
|
44
|
+
* (host styles created via createElement after load were marked too — see the
|
|
45
|
+
* note in the original implementation). Losing isolation on some runtime styles
|
|
46
|
+
* is preferable to the widget not rendering at all.
|
|
47
|
+
*
|
|
48
|
+
* KNOWN GAP: the strategy is chosen once, at module evaluation. A host that
|
|
49
|
+
* hardens or re-wraps `createElement` afterwards silently disables marking with
|
|
50
|
+
* no fallback armed.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Synchronously apply any marks the observer has queued but not yet delivered.
|
|
54
|
+
*
|
|
55
|
+
* MutationObserver callbacks are microtasks, so a <style> inserted earlier in
|
|
56
|
+
* the same task is still unmarked when a synchronous reader looks at the DOM.
|
|
57
|
+
* IframePortal does exactly that: it sweeps `document.querySelectorAll("style")`
|
|
58
|
+
* once, synchronously, and registers its own observer only afterwards — so a
|
|
59
|
+
* style missed by that sweep is blocked permanently, because nothing re-reads it.
|
|
60
|
+
*
|
|
61
|
+
* Callers that synchronously read style marks must call this first. It is a
|
|
62
|
+
* no-op on the monkeypatch path, where marking already happened at creation.
|
|
22
63
|
*/
|
|
23
|
-
declare
|
|
24
|
-
<K extends keyof HTMLElementTagNameMap>(tagName: K, options?: ElementCreationOptions | undefined): HTMLElementTagNameMap[K];
|
|
25
|
-
<K_1 extends keyof HTMLElementDeprecatedTagNameMap>(tagName: K_1, options?: ElementCreationOptions | undefined): HTMLElementDeprecatedTagNameMap[K_1];
|
|
26
|
-
(tagName: string, options?: ElementCreationOptions | undefined): HTMLElement;
|
|
27
|
-
};
|
|
64
|
+
export declare function flushStyleMarks(): void;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cometchat-visual-builder-no-code",
|
|
3
|
-
"version": "1.0.20-
|
|
3
|
+
"version": "1.0.20-authtest53",
|
|
4
4
|
"description": "CometChat Widget Builder No-Code Integration",
|
|
5
5
|
"cometChatCustomConfig": {
|
|
6
|
-
"prodVersion": "1.0.
|
|
7
|
-
"devStagingVersion": "1.0.20-
|
|
6
|
+
"prodVersion": "1.0.36",
|
|
7
|
+
"devStagingVersion": "1.0.20-authtest49",
|
|
8
8
|
"prodName": "@cometchat/chat-embed",
|
|
9
9
|
"devName": "cometchat-visual-builder-no-code",
|
|
10
10
|
"name": "cometchat-visual-builder-react-no-code",
|
|
11
|
-
"version": "1.0.
|
|
11
|
+
"version": "1.0.36",
|
|
12
12
|
"production": true
|
|
13
13
|
},
|
|
14
14
|
"author": "CometChat",
|