dce-reactkit 3.10.3 → 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 +16 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/client/initClient.d.ts +16 -2
- package/dist/esm/index.js +16 -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/helpers/logClientEvent.tsx +8 -0
- package/src/helpers/visitServerEndpoint.tsx +1 -0
package/dist/cjs/index.js
CHANGED
|
@@ -317,11 +317,23 @@ const isDarkModeOn = () => {
|
|
|
317
317
|
* @param opts object containing all arguments
|
|
318
318
|
* @param opts.sendRequest caccl send request functions
|
|
319
319
|
* @param [opts.sessionExpiredMessage] a custom session expired message
|
|
320
|
+
* @param [opts.darkModeOn] if true, dark mode is enabled
|
|
321
|
+
* @param [opts.noServer] if true, there is no server for this app
|
|
320
322
|
*/
|
|
321
323
|
const initClient = (opts) => {
|
|
322
|
-
//
|
|
323
|
-
|
|
324
|
-
|
|
324
|
+
// Handle separately if there is no server
|
|
325
|
+
if (opts.noServer) {
|
|
326
|
+
// Store values
|
|
327
|
+
storedSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
328
|
+
throw new Error('Cannot send requests because there is no server');
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
// Store values
|
|
333
|
+
storedSendRequest = opts.sendRequest;
|
|
334
|
+
sessionExpiredMessage = opts.sessionExpiredMessage;
|
|
335
|
+
}
|
|
336
|
+
// Handle universal parts
|
|
325
337
|
darkModeOn = !!opts.darkModeOn;
|
|
326
338
|
// Mark as initialized
|
|
327
339
|
onInitialized(null);
|
|
@@ -785,6 +797,7 @@ const _setStubResponse = (opts) => {
|
|
|
785
797
|
*/
|
|
786
798
|
const visitServerEndpoint = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
787
799
|
var _a, _b, _c;
|
|
800
|
+
// Set default method
|
|
788
801
|
const method = ((_a = opts.method) !== null && _a !== void 0 ? _a : 'GET');
|
|
789
802
|
// Handle stubs
|
|
790
803
|
const stubResponse = (_b = stubResponses[method]) === null || _b === void 0 ? void 0 : _b[opts.path];
|