dce-reactkit 5.0.7 → 5.0.8
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/cjs/index.js +19 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/visitServerEndpoint.d.ts +5 -0
- package/dist/esm/index.js +19 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/visitServerEndpoint.d.ts +5 -0
- package/dist/index.d.ts +5 -0
- package/package.json +1 -1
- package/src/components/Tooltip.tsx +17 -0
- package/src/helpers/visitServerEndpoint.tsx +5 -0
|
@@ -22,6 +22,8 @@ export declare const _setStubResponse: (opts: {
|
|
|
22
22
|
* @param opts.path - the path of the server endpoint
|
|
23
23
|
* @param [opts.method=GET] - the method of the endpoint
|
|
24
24
|
* @param [opts.params] - query/body parameters to include
|
|
25
|
+
* @param [opts.headers] - custom headers to include; values must already be
|
|
26
|
+
* string to avoid issue with header serialization
|
|
25
27
|
* @returns response from server
|
|
26
28
|
*/
|
|
27
29
|
declare const visitServerEndpoint: (opts: {
|
|
@@ -30,5 +32,8 @@ declare const visitServerEndpoint: (opts: {
|
|
|
30
32
|
params?: {
|
|
31
33
|
[x: string]: any;
|
|
32
34
|
} | undefined;
|
|
35
|
+
headers?: {
|
|
36
|
+
[x: string]: string;
|
|
37
|
+
} | undefined;
|
|
33
38
|
}) => Promise<any>;
|
|
34
39
|
export default visitServerEndpoint;
|
package/dist/index.d.ts
CHANGED
|
@@ -865,6 +865,8 @@ declare const initClient: (opts: ({
|
|
|
865
865
|
* @param opts.path - the path of the server endpoint
|
|
866
866
|
* @param [opts.method=GET] - the method of the endpoint
|
|
867
867
|
* @param [opts.params] - query/body parameters to include
|
|
868
|
+
* @param [opts.headers] - custom headers to include; values must already be
|
|
869
|
+
* string to avoid issue with header serialization
|
|
868
870
|
* @returns response from server
|
|
869
871
|
*/
|
|
870
872
|
declare const visitServerEndpoint: (opts: {
|
|
@@ -873,6 +875,9 @@ declare const visitServerEndpoint: (opts: {
|
|
|
873
875
|
params?: {
|
|
874
876
|
[x: string]: any;
|
|
875
877
|
} | undefined;
|
|
878
|
+
headers?: {
|
|
879
|
+
[x: string]: string;
|
|
880
|
+
} | undefined;
|
|
876
881
|
}) => Promise<any>;
|
|
877
882
|
|
|
878
883
|
/**
|
package/package.json
CHANGED
|
@@ -63,6 +63,14 @@ const Tooltip: React.FC<Props> = (props) => {
|
|
|
63
63
|
// Import bootstrap tooltip
|
|
64
64
|
const BSTooltip = (await import('bootstrap')).Tooltip;
|
|
65
65
|
|
|
66
|
+
// The child may have unmounted while the dynamic import above was
|
|
67
|
+
// resolving (React nulls the ref on unmount). Constructing a
|
|
68
|
+
// Bootstrap tooltip with a null element causes an error,
|
|
69
|
+
// so bail out instead
|
|
70
|
+
if (!childRef.current) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
// Initialize
|
|
67
75
|
t = new BSTooltip(
|
|
68
76
|
childRef.current,
|
|
@@ -78,6 +86,15 @@ const Tooltip: React.FC<Props> = (props) => {
|
|
|
78
86
|
return () => {
|
|
79
87
|
if (t) {
|
|
80
88
|
t.dispose();
|
|
89
|
+
// Bootstrap's hide() queues a transition-end callback that can
|
|
90
|
+
// fire AFTER dispose and touch the (now null) trigger map and
|
|
91
|
+
// element (twbs/bootstrap issue #37474). Point those private
|
|
92
|
+
// fields at harmless stand-ins so the late callback is a no-op
|
|
93
|
+
// instead of a crash.
|
|
94
|
+
/* eslint-disable no-underscore-dangle */
|
|
95
|
+
t._activeTrigger = {};
|
|
96
|
+
t._element = document.createElement('noscript');
|
|
97
|
+
/* eslint-enable no-underscore-dangle */
|
|
81
98
|
}
|
|
82
99
|
};
|
|
83
100
|
},
|
|
@@ -96,6 +96,8 @@ export const _setStubResponse = (
|
|
|
96
96
|
* @param opts.path - the path of the server endpoint
|
|
97
97
|
* @param [opts.method=GET] - the method of the endpoint
|
|
98
98
|
* @param [opts.params] - query/body parameters to include
|
|
99
|
+
* @param [opts.headers] - custom headers to include; values must already be
|
|
100
|
+
* string to avoid issue with header serialization
|
|
99
101
|
* @returns response from server
|
|
100
102
|
*/
|
|
101
103
|
const visitServerEndpoint = async (
|
|
@@ -103,6 +105,8 @@ const visitServerEndpoint = async (
|
|
|
103
105
|
path: string,
|
|
104
106
|
method?: ('GET' | 'POST' | 'DELETE' | 'PUT'),
|
|
105
107
|
params?: { [key in string]: any },
|
|
108
|
+
// Headers have no serialization layer, so use string
|
|
109
|
+
headers?: { [key in string]: string },
|
|
106
110
|
},
|
|
107
111
|
): Promise<any> => {
|
|
108
112
|
// Set default method
|
|
@@ -159,6 +163,7 @@ const visitServerEndpoint = async (
|
|
|
159
163
|
path: opts.path,
|
|
160
164
|
method: opts.method ?? 'GET',
|
|
161
165
|
params,
|
|
166
|
+
headers: opts.headers,
|
|
162
167
|
});
|
|
163
168
|
|
|
164
169
|
// Check for failure
|