@atlaskit/editor-plugin-autocomplete 3.4.1 → 3.5.0
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/CHANGELOG.md +12 -0
- package/dist/cjs/pm-plugins/debug-mode.js +48 -7
- package/dist/es2019/pm-plugins/debug-mode.js +46 -7
- package/dist/esm/pm-plugins/debug-mode.js +48 -7
- package/dist/types/pm-plugins/debug-mode.d.ts +19 -4
- package/dist/types-ts4.5/pm-plugins/debug-mode.d.ts +19 -4
- package/package.json +1 -1
- package/src/pm-plugins/debug-mode.ts +53 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-autocomplete
|
|
2
2
|
|
|
3
|
+
## 3.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`52c7f5f973025`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/52c7f5f973025) -
|
|
8
|
+
Switch the CTC autocomplete debug toggle off `localStorage` and onto a storage-free mechanism.
|
|
9
|
+
Debug logging is now enabled via the `__atlCtcDebug__.enable()` / `.disable()` console API for the
|
|
10
|
+
current session, or by appending `?atlCtcDebug=1` to the URL to have it active from initial load
|
|
11
|
+
(and survive reloads). This avoids browser-storage consent controls (BSC) that can block
|
|
12
|
+
uncategorized `localStorage` writes in some products. The `isAutocompleteDebugEnabled()` API is
|
|
13
|
+
unchanged for callers.
|
|
14
|
+
|
|
3
15
|
## 3.4.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -7,18 +7,59 @@ exports.isAutocompleteDebugEnabled = void 0;
|
|
|
7
7
|
/**
|
|
8
8
|
* Contextual Typeahead Completions (CTC) debug logging utility.
|
|
9
9
|
*
|
|
10
|
-
* Logs are silent by default.
|
|
10
|
+
* Logs are silent by default. Enable in any environment (dev, staging, prod):
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* // Live, for the current session (no reload required):
|
|
13
|
+
* __atlCtcDebug__.enable()
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
+
* // To disable:
|
|
16
|
+
* __atlCtcDebug__.disable()
|
|
15
17
|
*
|
|
16
|
-
*
|
|
18
|
+
* // From initial page load (survives reload) — append to the URL:
|
|
19
|
+
* ?atlCtcDebug=1
|
|
20
|
+
*
|
|
21
|
+
* Storage-free by design: avoids browser-storage consent controls (BSC), which can
|
|
22
|
+
* block uncategorized localStorage/sessionStorage/cookie writes in some products.
|
|
17
23
|
*/
|
|
18
|
-
|
|
24
|
+
|
|
25
|
+
var hasUrlDebugFlag = function hasUrlDebugFlag() {
|
|
26
|
+
if (typeof window === 'undefined') {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
19
29
|
try {
|
|
20
|
-
return
|
|
30
|
+
return new URLSearchParams(window.location.search).get('atlCtcDebug') === '1';
|
|
21
31
|
} catch (_unused) {
|
|
22
32
|
return false;
|
|
23
33
|
}
|
|
24
|
-
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// State lives on the window object (not a module closure) so duplicate copies of this
|
|
37
|
+
// module across separate bundles/realms share one source of truth and the console API
|
|
38
|
+
// controls them all. In-memory only; persisted across reload via the URL flag.
|
|
39
|
+
var getDebugApi = function getDebugApi() {
|
|
40
|
+
if (typeof window === 'undefined') {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
if (!window.__atlCtcDebug__) {
|
|
44
|
+
var debugEnabled = hasUrlDebugFlag();
|
|
45
|
+
window.__atlCtcDebug__ = {
|
|
46
|
+
enable: function enable() {
|
|
47
|
+
debugEnabled = true;
|
|
48
|
+
},
|
|
49
|
+
disable: function disable() {
|
|
50
|
+
debugEnabled = false;
|
|
51
|
+
},
|
|
52
|
+
isEnabled: function isEnabled() {
|
|
53
|
+
return debugEnabled;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return window.__atlCtcDebug__;
|
|
58
|
+
};
|
|
59
|
+
var isAutocompleteDebugEnabled = exports.isAutocompleteDebugEnabled = function isAutocompleteDebugEnabled() {
|
|
60
|
+
var _getDebugApi$isEnable, _getDebugApi;
|
|
61
|
+
return (_getDebugApi$isEnable = (_getDebugApi = getDebugApi()) === null || _getDebugApi === void 0 ? void 0 : _getDebugApi.isEnabled()) !== null && _getDebugApi$isEnable !== void 0 ? _getDebugApi$isEnable : false;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Eagerly install so the console API is available on load, regardless of call order.
|
|
65
|
+
getDebugApi();
|
|
@@ -1,18 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contextual Typeahead Completions (CTC) debug logging utility.
|
|
3
3
|
*
|
|
4
|
-
* Logs are silent by default.
|
|
4
|
+
* Logs are silent by default. Enable in any environment (dev, staging, prod):
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* // Live, for the current session (no reload required):
|
|
7
|
+
* __atlCtcDebug__.enable()
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
+
* // To disable:
|
|
10
|
+
* __atlCtcDebug__.disable()
|
|
9
11
|
*
|
|
10
|
-
*
|
|
12
|
+
* // From initial page load (survives reload) — append to the URL:
|
|
13
|
+
* ?atlCtcDebug=1
|
|
14
|
+
*
|
|
15
|
+
* Storage-free by design: avoids browser-storage consent controls (BSC), which can
|
|
16
|
+
* block uncategorized localStorage/sessionStorage/cookie writes in some products.
|
|
11
17
|
*/
|
|
12
|
-
|
|
18
|
+
|
|
19
|
+
const hasUrlDebugFlag = () => {
|
|
20
|
+
if (typeof window === 'undefined') {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
13
23
|
try {
|
|
14
|
-
return
|
|
24
|
+
return new URLSearchParams(window.location.search).get('atlCtcDebug') === '1';
|
|
15
25
|
} catch {
|
|
16
26
|
return false;
|
|
17
27
|
}
|
|
18
|
-
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// State lives on the window object (not a module closure) so duplicate copies of this
|
|
31
|
+
// module across separate bundles/realms share one source of truth and the console API
|
|
32
|
+
// controls them all. In-memory only; persisted across reload via the URL flag.
|
|
33
|
+
const getDebugApi = () => {
|
|
34
|
+
if (typeof window === 'undefined') {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
if (!window.__atlCtcDebug__) {
|
|
38
|
+
let debugEnabled = hasUrlDebugFlag();
|
|
39
|
+
window.__atlCtcDebug__ = {
|
|
40
|
+
enable: () => {
|
|
41
|
+
debugEnabled = true;
|
|
42
|
+
},
|
|
43
|
+
disable: () => {
|
|
44
|
+
debugEnabled = false;
|
|
45
|
+
},
|
|
46
|
+
isEnabled: () => debugEnabled
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return window.__atlCtcDebug__;
|
|
50
|
+
};
|
|
51
|
+
export const isAutocompleteDebugEnabled = () => {
|
|
52
|
+
var _getDebugApi$isEnable, _getDebugApi;
|
|
53
|
+
return (_getDebugApi$isEnable = (_getDebugApi = getDebugApi()) === null || _getDebugApi === void 0 ? void 0 : _getDebugApi.isEnabled()) !== null && _getDebugApi$isEnable !== void 0 ? _getDebugApi$isEnable : false;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Eagerly install so the console API is available on load, regardless of call order.
|
|
57
|
+
getDebugApi();
|
|
@@ -1,18 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contextual Typeahead Completions (CTC) debug logging utility.
|
|
3
3
|
*
|
|
4
|
-
* Logs are silent by default.
|
|
4
|
+
* Logs are silent by default. Enable in any environment (dev, staging, prod):
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* // Live, for the current session (no reload required):
|
|
7
|
+
* __atlCtcDebug__.enable()
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
+
* // To disable:
|
|
10
|
+
* __atlCtcDebug__.disable()
|
|
9
11
|
*
|
|
10
|
-
*
|
|
12
|
+
* // From initial page load (survives reload) — append to the URL:
|
|
13
|
+
* ?atlCtcDebug=1
|
|
14
|
+
*
|
|
15
|
+
* Storage-free by design: avoids browser-storage consent controls (BSC), which can
|
|
16
|
+
* block uncategorized localStorage/sessionStorage/cookie writes in some products.
|
|
11
17
|
*/
|
|
12
|
-
|
|
18
|
+
|
|
19
|
+
var hasUrlDebugFlag = function hasUrlDebugFlag() {
|
|
20
|
+
if (typeof window === 'undefined') {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
13
23
|
try {
|
|
14
|
-
return
|
|
24
|
+
return new URLSearchParams(window.location.search).get('atlCtcDebug') === '1';
|
|
15
25
|
} catch (_unused) {
|
|
16
26
|
return false;
|
|
17
27
|
}
|
|
18
|
-
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// State lives on the window object (not a module closure) so duplicate copies of this
|
|
31
|
+
// module across separate bundles/realms share one source of truth and the console API
|
|
32
|
+
// controls them all. In-memory only; persisted across reload via the URL flag.
|
|
33
|
+
var getDebugApi = function getDebugApi() {
|
|
34
|
+
if (typeof window === 'undefined') {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
if (!window.__atlCtcDebug__) {
|
|
38
|
+
var debugEnabled = hasUrlDebugFlag();
|
|
39
|
+
window.__atlCtcDebug__ = {
|
|
40
|
+
enable: function enable() {
|
|
41
|
+
debugEnabled = true;
|
|
42
|
+
},
|
|
43
|
+
disable: function disable() {
|
|
44
|
+
debugEnabled = false;
|
|
45
|
+
},
|
|
46
|
+
isEnabled: function isEnabled() {
|
|
47
|
+
return debugEnabled;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return window.__atlCtcDebug__;
|
|
52
|
+
};
|
|
53
|
+
export var isAutocompleteDebugEnabled = function isAutocompleteDebugEnabled() {
|
|
54
|
+
var _getDebugApi$isEnable, _getDebugApi;
|
|
55
|
+
return (_getDebugApi$isEnable = (_getDebugApi = getDebugApi()) === null || _getDebugApi === void 0 ? void 0 : _getDebugApi.isEnabled()) !== null && _getDebugApi$isEnable !== void 0 ? _getDebugApi$isEnable : false;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Eagerly install so the console API is available on load, regardless of call order.
|
|
59
|
+
getDebugApi();
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contextual Typeahead Completions (CTC) debug logging utility.
|
|
3
3
|
*
|
|
4
|
-
* Logs are silent by default.
|
|
4
|
+
* Logs are silent by default. Enable in any environment (dev, staging, prod):
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* // Live, for the current session (no reload required):
|
|
7
|
+
* __atlCtcDebug__.enable()
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
+
* // To disable:
|
|
10
|
+
* __atlCtcDebug__.disable()
|
|
9
11
|
*
|
|
10
|
-
*
|
|
12
|
+
* // From initial page load (survives reload) — append to the URL:
|
|
13
|
+
* ?atlCtcDebug=1
|
|
14
|
+
*
|
|
15
|
+
* Storage-free by design: avoids browser-storage consent controls (BSC), which can
|
|
16
|
+
* block uncategorized localStorage/sessionStorage/cookie writes in some products.
|
|
11
17
|
*/
|
|
18
|
+
declare global {
|
|
19
|
+
interface Window {
|
|
20
|
+
__atlCtcDebug__?: {
|
|
21
|
+
enable: () => void;
|
|
22
|
+
disable: () => void;
|
|
23
|
+
isEnabled: () => boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
12
27
|
export declare const isAutocompleteDebugEnabled: () => boolean;
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contextual Typeahead Completions (CTC) debug logging utility.
|
|
3
3
|
*
|
|
4
|
-
* Logs are silent by default.
|
|
4
|
+
* Logs are silent by default. Enable in any environment (dev, staging, prod):
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* // Live, for the current session (no reload required):
|
|
7
|
+
* __atlCtcDebug__.enable()
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
+
* // To disable:
|
|
10
|
+
* __atlCtcDebug__.disable()
|
|
9
11
|
*
|
|
10
|
-
*
|
|
12
|
+
* // From initial page load (survives reload) — append to the URL:
|
|
13
|
+
* ?atlCtcDebug=1
|
|
14
|
+
*
|
|
15
|
+
* Storage-free by design: avoids browser-storage consent controls (BSC), which can
|
|
16
|
+
* block uncategorized localStorage/sessionStorage/cookie writes in some products.
|
|
11
17
|
*/
|
|
18
|
+
declare global {
|
|
19
|
+
interface Window {
|
|
20
|
+
__atlCtcDebug__?: {
|
|
21
|
+
enable: () => void;
|
|
22
|
+
disable: () => void;
|
|
23
|
+
isEnabled: () => boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
12
27
|
export declare const isAutocompleteDebugEnabled: () => boolean;
|
package/package.json
CHANGED
|
@@ -1,18 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contextual Typeahead Completions (CTC) debug logging utility.
|
|
3
3
|
*
|
|
4
|
-
* Logs are silent by default.
|
|
4
|
+
* Logs are silent by default. Enable in any environment (dev, staging, prod):
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* // Live, for the current session (no reload required):
|
|
7
|
+
* __atlCtcDebug__.enable()
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
+
* // To disable:
|
|
10
|
+
* __atlCtcDebug__.disable()
|
|
9
11
|
*
|
|
10
|
-
*
|
|
12
|
+
* // From initial page load (survives reload) — append to the URL:
|
|
13
|
+
* ?atlCtcDebug=1
|
|
14
|
+
*
|
|
15
|
+
* Storage-free by design: avoids browser-storage consent controls (BSC), which can
|
|
16
|
+
* block uncategorized localStorage/sessionStorage/cookie writes in some products.
|
|
11
17
|
*/
|
|
12
|
-
|
|
18
|
+
|
|
19
|
+
declare global {
|
|
20
|
+
interface Window {
|
|
21
|
+
__atlCtcDebug__?: {
|
|
22
|
+
enable: () => void;
|
|
23
|
+
disable: () => void;
|
|
24
|
+
isEnabled: () => boolean;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const hasUrlDebugFlag = (): boolean => {
|
|
30
|
+
if (typeof window === 'undefined') {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
13
33
|
try {
|
|
14
|
-
return
|
|
34
|
+
return new URLSearchParams(window.location.search).get('atlCtcDebug') === '1';
|
|
15
35
|
} catch {
|
|
16
36
|
return false;
|
|
17
37
|
}
|
|
18
38
|
};
|
|
39
|
+
|
|
40
|
+
// State lives on the window object (not a module closure) so duplicate copies of this
|
|
41
|
+
// module across separate bundles/realms share one source of truth and the console API
|
|
42
|
+
// controls them all. In-memory only; persisted across reload via the URL flag.
|
|
43
|
+
const getDebugApi = (): Window['__atlCtcDebug__'] => {
|
|
44
|
+
if (typeof window === 'undefined') {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
if (!window.__atlCtcDebug__) {
|
|
48
|
+
let debugEnabled = hasUrlDebugFlag();
|
|
49
|
+
window.__atlCtcDebug__ = {
|
|
50
|
+
enable: () => {
|
|
51
|
+
debugEnabled = true;
|
|
52
|
+
},
|
|
53
|
+
disable: () => {
|
|
54
|
+
debugEnabled = false;
|
|
55
|
+
},
|
|
56
|
+
isEnabled: () => debugEnabled,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return window.__atlCtcDebug__;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const isAutocompleteDebugEnabled = (): boolean => getDebugApi()?.isEnabled() ?? false;
|
|
63
|
+
|
|
64
|
+
// Eagerly install so the console API is available on load, regardless of call order.
|
|
65
|
+
getDebugApi();
|