dce-reactkit 3.10.2 → 3.11.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/dist/cjs/index.js +18 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/client/initClient.d.ts +16 -2
- package/dist/esm/index.js +18 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/client/initClient.d.ts +16 -2
- package/dist/index.d.ts +10 -2
- package/package.json +1 -1
- package/src/client/initClient.tsx +49 -11
- package/src/components/CheckboxButton.tsx +1 -0
- package/src/components/RadioButton.tsx +1 -0
- package/src/helpers/logClientEvent.tsx +8 -0
- package/src/helpers/visitServerEndpoint.tsx +1 -0
|
@@ -19,6 +19,12 @@ type SendRequestFunction = (opts: {
|
|
|
19
19
|
[x: string]: any;
|
|
20
20
|
};
|
|
21
21
|
}>;
|
|
22
|
+
declare let noServer: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Check if there is no server for this app
|
|
25
|
+
* @author Gabe Abrams
|
|
26
|
+
*/
|
|
27
|
+
export declare const appHasNoServer: () => boolean;
|
|
22
28
|
/**
|
|
23
29
|
* Get the send request function
|
|
24
30
|
* @author Gabe Abrams
|
|
@@ -44,10 +50,18 @@ export declare const isDarkModeOn: () => boolean;
|
|
|
44
50
|
* @param opts object containing all arguments
|
|
45
51
|
* @param opts.sendRequest caccl send request functions
|
|
46
52
|
* @param [opts.sessionExpiredMessage] a custom session expired message
|
|
53
|
+
* @param [opts.darkModeOn] if true, dark mode is enabled
|
|
54
|
+
* @param [opts.noServer] if true, there is no server for this app
|
|
47
55
|
*/
|
|
48
|
-
declare const initClient: (opts: {
|
|
56
|
+
declare const initClient: (opts: ({
|
|
49
57
|
sendRequest: SendRequestFunction;
|
|
50
58
|
sessionExpiredMessage?: string;
|
|
51
59
|
darkModeOn?: boolean;
|
|
52
|
-
|
|
60
|
+
noServer?: false;
|
|
61
|
+
} | {
|
|
62
|
+
darkModeOn?: boolean;
|
|
63
|
+
noServer: true;
|
|
64
|
+
sendRequest?: undefined;
|
|
65
|
+
sessionExpiredMessage?: undefined;
|
|
66
|
+
})) => void;
|
|
53
67
|
export default initClient;
|
package/dist/esm/index.js
CHANGED
|
@@ -289,11 +289,23 @@ const isDarkModeOn = () => {
|
|
|
289
289
|
* @param opts object containing all arguments
|
|
290
290
|
* @param opts.sendRequest caccl send request functions
|
|
291
291
|
* @param [opts.sessionExpiredMessage] a custom session expired message
|
|
292
|
+
* @param [opts.darkModeOn] if true, dark mode is enabled
|
|
293
|
+
* @param [opts.noServer] if true, there is no server for this app
|
|
292
294
|
*/
|
|
293
295
|
const initClient = (opts) => {
|
|
294
|
-
//
|
|
295
|
-
|
|
296
|
-
|
|
296
|
+
// Handle separately if there is no server
|
|
297
|
+
if (opts.noServer) {
|
|
298
|
+
// Store values
|
|
299
|
+
storedSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
300
|
+
throw new Error('Cannot send requests because there is no server');
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
// Store values
|
|
305
|
+
storedSendRequest = opts.sendRequest;
|
|
306
|
+
sessionExpiredMessage = opts.sessionExpiredMessage;
|
|
307
|
+
}
|
|
308
|
+
// Handle universal parts
|
|
297
309
|
darkModeOn = !!opts.darkModeOn;
|
|
298
310
|
// Mark as initialized
|
|
299
311
|
onInitialized(null);
|
|
@@ -757,6 +769,7 @@ const _setStubResponse = (opts) => {
|
|
|
757
769
|
*/
|
|
758
770
|
const visitServerEndpoint = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
759
771
|
var _a, _b, _c;
|
|
772
|
+
// Set default method
|
|
760
773
|
const method = ((_a = opts.method) !== null && _a !== void 0 ? _a : 'GET');
|
|
761
774
|
// Handle stubs
|
|
762
775
|
const stubResponse = (_b = stubResponses[method]) === null || _b === void 0 ? void 0 : _b[opts.path];
|
|
@@ -1688,6 +1701,7 @@ const RadioButton = (props) => {
|
|
|
1688
1701
|
useComplexFormatting
|
|
1689
1702
|
? (React__default.createElement("pre", { className: "ps-1 text-start text-break", style: {
|
|
1690
1703
|
whiteSpace: 'pre-wrap',
|
|
1704
|
+
tabSize: 2,
|
|
1691
1705
|
} }, text))
|
|
1692
1706
|
: (React__default.createElement("div", { className: "flex-grow-1 text-start text-break" }, text)))));
|
|
1693
1707
|
};
|
|
@@ -1735,6 +1749,7 @@ const CheckboxButton = (props) => {
|
|
|
1735
1749
|
useComplexFormatting
|
|
1736
1750
|
? (React__default.createElement("pre", { className: "ps-1 text-start text-break", style: {
|
|
1737
1751
|
whiteSpace: 'pre-wrap',
|
|
1752
|
+
tabSize: 2,
|
|
1738
1753
|
} }, text))
|
|
1739
1754
|
: (React__default.createElement("div", { className: "flex-grow-1 text-start text-break" }, text)))));
|
|
1740
1755
|
};
|