@xapp/chat-widget 1.74.2 → 1.74.3
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/assets/output-B2pfRgA-.css +1 -0
- package/dist/assets/output-BD-u-4c9.css +1 -0
- package/dist/assets/output-BchgdeoH.css +1 -0
- package/dist/assets/output-C26dXJmK.css +1 -0
- package/dist/assets/output-C7daA0ah.css +1 -0
- package/dist/assets/output-CQTaewH2.css +1 -0
- package/dist/assets/output-CYae4ZUa.css +1 -0
- package/dist/assets/output-D41CYJs3.css +1 -0
- package/dist/assets/output-DuGrkIo9.css +1 -0
- package/dist/index.es.js +461 -52
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +461 -71
- package/dist/index.js.map +1 -1
- package/dist/packages/chat-widget/src/App.d.ts +22 -0
- package/dist/packages/chat-widget/src/components/ActionButton/ActionButton.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/ActionButton/ActionButton.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ActionItem/ActionItem.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/ActionItem/ActionItem.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/Avatar/Avatar.stories.d.ts +9 -0
- package/dist/packages/chat-widget/src/components/Avatar/Avatar.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/CardContainer/CardContainer.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/CardContainer/CardContainer.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/Carousel/Carousel.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/Carousel/Carousel.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/CarouselItem/CarouselItem.stories.d.ts +9 -0
- package/dist/packages/chat-widget/src/components/CarouselItem/CarouselItem.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatActionButtons/ChatActionButton.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/ChatActionButtons/ChatActionButton.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatActionButtons/ChatActionButtons.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/ChatActionButtons/ChatActionButtons.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatBranding/ChatBranding.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/ChatButton/ChatButton.stories.d.ts +11 -0
- package/dist/packages/chat-widget/src/components/ChatButton/ChatButton.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatCard/ChatCard.stories.d.ts +7 -0
- package/dist/packages/chat-widget/src/components/ChatChip/ChatChip.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/ChatChip/ChatChip.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatChips/ChatChips.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/ChatChips/ChatChips.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatFooter/ChatFooter.stories.d.ts +8 -0
- package/dist/packages/chat-widget/src/components/ChatFooter/ChatFooter.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatHeader/ChatHeader.stories.d.ts +9 -0
- package/dist/packages/chat-widget/src/components/ChatHeader/ChatHeader.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatImage/ChatImage.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/ChatImage/ChatImage.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatMarkdownMessage/ChatMarkdownMessage.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/ChatMedia/ChatMedia.d.ts +9 -0
- package/dist/packages/chat-widget/src/components/ChatMedia/ChatMedia.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/ChatMedia/ChatMedia.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatMedia/index.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatMenu/ChatMenu.stories.d.ts +10 -0
- package/dist/packages/chat-widget/src/components/ChatMenu/ChatMenu.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatMessage/ChatMessage.stories.d.ts +20 -0
- package/dist/packages/chat-widget/src/components/ChatMessageBubble/ChatMessageBubble.stories.d.ts +8 -0
- package/dist/packages/chat-widget/src/components/ChatMessageBubble/ChatMessageBubble.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatMessagePart/ChatMessagePart.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatRating/ChatRating.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/ChatRating/ChatRating.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ChatWidget/ChatWidget.stories.d.ts +48 -0
- package/dist/packages/chat-widget/src/components/ChatWidget/ChatWidgetEnv.stories.d.ts +10 -0
- package/dist/packages/chat-widget/src/components/ChatWidget/StaticChatWidgetContainer.d.ts +11 -0
- package/dist/packages/chat-widget/src/components/ChatWidget/StaticChatWidgetContainer.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/ChatWidget/StaticMessagesChatWidgetContainer.d.ts +11 -0
- package/dist/packages/chat-widget/src/components/ChatWidget/StaticMessagesChatWidgetContainer.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/ChevronLeft/ChevronLeft.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/ChevronRight/ChevronRight.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/CtaBubble/CtaBubble.stories.d.ts +10 -0
- package/dist/packages/chat-widget/src/components/DrawerBars/DrawerBars.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/DrawerBars/DrawerBars.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ExternalLink/ExternalLink.stories.d.ts +7 -0
- package/dist/packages/chat-widget/src/components/FailureMessage/FailureMessage.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/Icons/Icons.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/Input/Input.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/Input/Input.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/List/List.stories.d.ts +8 -0
- package/dist/packages/chat-widget/src/components/List/List.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/ListItem/ListItem.stories.d.ts +9 -0
- package/dist/packages/chat-widget/src/components/ListItem/ListItem.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/MessageForm/MessageForm.stories.d.ts +7 -0
- package/dist/packages/chat-widget/src/components/MessageForm/MessageForm.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/MessageList/MessageList.stories.d.ts +7 -0
- package/dist/packages/chat-widget/src/components/MessageList/MessageList.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/MessageSvg/MessageSvg.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/MultiSelect/MultiSelect.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/OfflineForm/OfflineForm.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/OfflineForm/OfflineForm.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/OptionalLink/OptionalLink.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/PrechatForm/PrechatForm.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/PrechatForm/PrechatForm.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/PrechatForm/index.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/QueuePosition/QueuePosition.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/QueuePosition/QueuePosition.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/SendButton/SendButton.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/components/SendButton/SendButton.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/SmartLink/utils.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/Suggestions/Suggestions.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/Suggestions/data.d.ts +2 -0
- package/dist/packages/chat-widget/src/components/SystemMessage/SystemMessage.stories.d.ts +8 -0
- package/dist/packages/chat-widget/src/components/SystemMessage/SystemMessage.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/TypingIndicator/TypingIndicator.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/TypingStatus/TypingStatus.stories.d.ts +6 -0
- package/dist/packages/chat-widget/src/components/TypingStatus/TypingStatus.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/components/WidgetStylesheet/WidgetStylesheet.stories.d.ts +5 -0
- package/dist/packages/chat-widget/src/config/getBasePath.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/middlewares/fallback-middleware.d.ts +2 -0
- package/dist/packages/chat-widget/src/middlewares/join.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/store/BrowserStateStorage.d.ts +8 -0
- package/dist/packages/chat-widget/src/store/ChatAction.d.ts +0 -0
- package/dist/packages/chat-widget/src/store/ChatStaticStore.d.ts +3 -0
- package/dist/packages/chat-widget/src/store/ChatStore.d.ts +0 -0
- package/dist/packages/chat-widget/src/store/DefaultState.d.ts +3 -0
- package/dist/packages/chat-widget/src/store/LocalStorage.d.ts +14 -0
- package/dist/packages/chat-widget/src/store/StateStorage.d.ts +4 -0
- package/dist/packages/chat-widget/src/store/StaticStore.d.ts +0 -0
- package/dist/packages/chat-widget/src/store/reducers/connectionReducer.d.ts +3 -0
- package/dist/packages/chat-widget/src/store/reducers/joinMessages.d.ts +2 -0
- package/dist/packages/chat-widget/src/store/reducers/memberJoin.d.ts +3 -0
- package/dist/packages/chat-widget/src/store/reducers/memberJoin.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/store/reducers/memberLeave.d.ts +3 -0
- package/dist/packages/chat-widget/src/store/reducers/memberLeave.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/store/reducers/persistStateReducer.d.ts +3 -0
- package/dist/packages/chat-widget/src/store/reducers/resetReducer.d.ts +2 -0
- package/dist/packages/chat-widget/src/store/reducers/rootReducer.d.ts +0 -0
- package/dist/packages/chat-widget/src/storybook/RichTextValues.d.ts +2 -0
- package/dist/packages/chat-widget/src/storybook/agents.d.ts +2 -0
- package/dist/packages/chat-widget/src/storybook/messages.d.ts +6 -0
- package/dist/packages/chat-widget/src/storybook/store.d.ts +6 -0
- package/dist/packages/chat-widget/src/tests/App.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/tests/store.d.ts +3 -0
- package/dist/packages/chat-widget/src/utils/PersistentStorage.d.ts +13 -0
- package/dist/packages/chat-widget/src/utils/PersistentStorage.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/__tests__/configurableMessages.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/__tests__/insertSorted.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/__tests__/responseToMessage.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/fingerprint.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/insertSorted.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/nick-utils.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/parseEnv.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/parseEnv.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/random-theme.d.ts +3 -0
- package/dist/packages/chat-widget/src/utils/resolveUrlPolicy.test.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/sleep.d.ts +1 -0
- package/dist/packages/chat-widget/src/utils/useFetchStylesheet.d.ts +1 -0
- package/dist/xapp-chat-widget.js +4 -4
- package/dist/xapp-chat-widget.js.map +1 -1
- package/package.json +4 -7
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React$1, { createContext, useMemo, useContext, useRef, useEffect, useCallback, useState, useLayoutEffect } from 'react';
|
|
2
2
|
export { default as React } from 'react';
|
|
3
3
|
import { useSelector, useDispatch, Provider } from 'react-redux';
|
|
4
|
-
import { createStore, applyMiddleware, compose } from 'redux';
|
|
5
|
-
import * as thunk from 'redux-thunk';
|
|
6
4
|
|
|
7
5
|
var ActionButton = function (_a) {
|
|
8
6
|
var label = _a.label, disable = _a.disable, type = _a.type, addClass = _a.addClass, onClick = _a.onClick;
|
|
@@ -31484,6 +31482,433 @@ var ChatWidget = function (props) {
|
|
|
31484
31482
|
React$1.createElement(ChatButton, { addClass: getVisibilityClass(), onClick: chatButtonOnClick, config: config === null || config === void 0 ? void 0 : config.cta, imageUrl: (_2 = config === null || config === void 0 ? void 0 : config.chatButton) === null || _2 === void 0 ? void 0 : _2.imageUrl, visible: visible })));
|
|
31485
31483
|
};
|
|
31486
31484
|
|
|
31485
|
+
// src/utils/formatProdErrorMessage.ts
|
|
31486
|
+
function formatProdErrorMessage$1(code) {
|
|
31487
|
+
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
31488
|
+
}
|
|
31489
|
+
|
|
31490
|
+
// src/utils/symbol-observable.ts
|
|
31491
|
+
var $$observable = /* @__PURE__ */ (() => typeof Symbol === "function" && Symbol.observable || "@@observable")();
|
|
31492
|
+
var symbol_observable_default = $$observable;
|
|
31493
|
+
|
|
31494
|
+
// src/utils/actionTypes.ts
|
|
31495
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
31496
|
+
var ActionTypes = {
|
|
31497
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
31498
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
31499
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
31500
|
+
};
|
|
31501
|
+
var actionTypes_default = ActionTypes;
|
|
31502
|
+
|
|
31503
|
+
// src/utils/isPlainObject.ts
|
|
31504
|
+
function isPlainObject(obj) {
|
|
31505
|
+
if (typeof obj !== "object" || obj === null)
|
|
31506
|
+
return false;
|
|
31507
|
+
let proto = obj;
|
|
31508
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
31509
|
+
proto = Object.getPrototypeOf(proto);
|
|
31510
|
+
}
|
|
31511
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
31512
|
+
}
|
|
31513
|
+
|
|
31514
|
+
// src/createStore.ts
|
|
31515
|
+
function createStore(reducer, preloadedState, enhancer) {
|
|
31516
|
+
if (typeof reducer !== "function") {
|
|
31517
|
+
throw new Error(formatProdErrorMessage$1(2) );
|
|
31518
|
+
}
|
|
31519
|
+
if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") {
|
|
31520
|
+
throw new Error(formatProdErrorMessage$1(0) );
|
|
31521
|
+
}
|
|
31522
|
+
if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
|
|
31523
|
+
enhancer = preloadedState;
|
|
31524
|
+
preloadedState = void 0;
|
|
31525
|
+
}
|
|
31526
|
+
if (typeof enhancer !== "undefined") {
|
|
31527
|
+
if (typeof enhancer !== "function") {
|
|
31528
|
+
throw new Error(formatProdErrorMessage$1(1) );
|
|
31529
|
+
}
|
|
31530
|
+
return enhancer(createStore)(reducer, preloadedState);
|
|
31531
|
+
}
|
|
31532
|
+
let currentReducer = reducer;
|
|
31533
|
+
let currentState = preloadedState;
|
|
31534
|
+
let currentListeners = /* @__PURE__ */ new Map();
|
|
31535
|
+
let nextListeners = currentListeners;
|
|
31536
|
+
let listenerIdCounter = 0;
|
|
31537
|
+
let isDispatching = false;
|
|
31538
|
+
function ensureCanMutateNextListeners() {
|
|
31539
|
+
if (nextListeners === currentListeners) {
|
|
31540
|
+
nextListeners = /* @__PURE__ */ new Map();
|
|
31541
|
+
currentListeners.forEach((listener, key) => {
|
|
31542
|
+
nextListeners.set(key, listener);
|
|
31543
|
+
});
|
|
31544
|
+
}
|
|
31545
|
+
}
|
|
31546
|
+
function getState() {
|
|
31547
|
+
if (isDispatching) {
|
|
31548
|
+
throw new Error(formatProdErrorMessage$1(3) );
|
|
31549
|
+
}
|
|
31550
|
+
return currentState;
|
|
31551
|
+
}
|
|
31552
|
+
function subscribe(listener) {
|
|
31553
|
+
if (typeof listener !== "function") {
|
|
31554
|
+
throw new Error(formatProdErrorMessage$1(4) );
|
|
31555
|
+
}
|
|
31556
|
+
if (isDispatching) {
|
|
31557
|
+
throw new Error(formatProdErrorMessage$1(5) );
|
|
31558
|
+
}
|
|
31559
|
+
let isSubscribed = true;
|
|
31560
|
+
ensureCanMutateNextListeners();
|
|
31561
|
+
const listenerId = listenerIdCounter++;
|
|
31562
|
+
nextListeners.set(listenerId, listener);
|
|
31563
|
+
return function unsubscribe() {
|
|
31564
|
+
if (!isSubscribed) {
|
|
31565
|
+
return;
|
|
31566
|
+
}
|
|
31567
|
+
if (isDispatching) {
|
|
31568
|
+
throw new Error(formatProdErrorMessage$1(6) );
|
|
31569
|
+
}
|
|
31570
|
+
isSubscribed = false;
|
|
31571
|
+
ensureCanMutateNextListeners();
|
|
31572
|
+
nextListeners.delete(listenerId);
|
|
31573
|
+
currentListeners = null;
|
|
31574
|
+
};
|
|
31575
|
+
}
|
|
31576
|
+
function dispatch(action) {
|
|
31577
|
+
if (!isPlainObject(action)) {
|
|
31578
|
+
throw new Error(formatProdErrorMessage$1(7) );
|
|
31579
|
+
}
|
|
31580
|
+
if (typeof action.type === "undefined") {
|
|
31581
|
+
throw new Error(formatProdErrorMessage$1(8) );
|
|
31582
|
+
}
|
|
31583
|
+
if (typeof action.type !== "string") {
|
|
31584
|
+
throw new Error(formatProdErrorMessage$1(17) );
|
|
31585
|
+
}
|
|
31586
|
+
if (isDispatching) {
|
|
31587
|
+
throw new Error(formatProdErrorMessage$1(9) );
|
|
31588
|
+
}
|
|
31589
|
+
try {
|
|
31590
|
+
isDispatching = true;
|
|
31591
|
+
currentState = currentReducer(currentState, action);
|
|
31592
|
+
} finally {
|
|
31593
|
+
isDispatching = false;
|
|
31594
|
+
}
|
|
31595
|
+
const listeners = currentListeners = nextListeners;
|
|
31596
|
+
listeners.forEach((listener) => {
|
|
31597
|
+
listener();
|
|
31598
|
+
});
|
|
31599
|
+
return action;
|
|
31600
|
+
}
|
|
31601
|
+
function replaceReducer(nextReducer) {
|
|
31602
|
+
if (typeof nextReducer !== "function") {
|
|
31603
|
+
throw new Error(formatProdErrorMessage$1(10) );
|
|
31604
|
+
}
|
|
31605
|
+
currentReducer = nextReducer;
|
|
31606
|
+
dispatch({
|
|
31607
|
+
type: actionTypes_default.REPLACE
|
|
31608
|
+
});
|
|
31609
|
+
}
|
|
31610
|
+
function observable() {
|
|
31611
|
+
const outerSubscribe = subscribe;
|
|
31612
|
+
return {
|
|
31613
|
+
/**
|
|
31614
|
+
* The minimal observable subscription method.
|
|
31615
|
+
* @param observer Any object that can be used as an observer.
|
|
31616
|
+
* The observer object should have a `next` method.
|
|
31617
|
+
* @returns An object with an `unsubscribe` method that can
|
|
31618
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
|
31619
|
+
* emission of values from the observable.
|
|
31620
|
+
*/
|
|
31621
|
+
subscribe(observer) {
|
|
31622
|
+
if (typeof observer !== "object" || observer === null) {
|
|
31623
|
+
throw new Error(formatProdErrorMessage$1(11) );
|
|
31624
|
+
}
|
|
31625
|
+
function observeState() {
|
|
31626
|
+
const observerAsObserver = observer;
|
|
31627
|
+
if (observerAsObserver.next) {
|
|
31628
|
+
observerAsObserver.next(getState());
|
|
31629
|
+
}
|
|
31630
|
+
}
|
|
31631
|
+
observeState();
|
|
31632
|
+
const unsubscribe = outerSubscribe(observeState);
|
|
31633
|
+
return {
|
|
31634
|
+
unsubscribe
|
|
31635
|
+
};
|
|
31636
|
+
},
|
|
31637
|
+
[symbol_observable_default]() {
|
|
31638
|
+
return this;
|
|
31639
|
+
}
|
|
31640
|
+
};
|
|
31641
|
+
}
|
|
31642
|
+
dispatch({
|
|
31643
|
+
type: actionTypes_default.INIT
|
|
31644
|
+
});
|
|
31645
|
+
const store = {
|
|
31646
|
+
dispatch,
|
|
31647
|
+
subscribe,
|
|
31648
|
+
getState,
|
|
31649
|
+
replaceReducer,
|
|
31650
|
+
[symbol_observable_default]: observable
|
|
31651
|
+
};
|
|
31652
|
+
return store;
|
|
31653
|
+
}
|
|
31654
|
+
function assertReducerShape(reducers) {
|
|
31655
|
+
Object.keys(reducers).forEach((key) => {
|
|
31656
|
+
const reducer = reducers[key];
|
|
31657
|
+
const initialState = reducer(void 0, {
|
|
31658
|
+
type: actionTypes_default.INIT
|
|
31659
|
+
});
|
|
31660
|
+
if (typeof initialState === "undefined") {
|
|
31661
|
+
throw new Error(formatProdErrorMessage$1(12) );
|
|
31662
|
+
}
|
|
31663
|
+
if (typeof reducer(void 0, {
|
|
31664
|
+
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
31665
|
+
}) === "undefined") {
|
|
31666
|
+
throw new Error(formatProdErrorMessage$1(13) );
|
|
31667
|
+
}
|
|
31668
|
+
});
|
|
31669
|
+
}
|
|
31670
|
+
function combineReducers(reducers) {
|
|
31671
|
+
const reducerKeys = Object.keys(reducers);
|
|
31672
|
+
const finalReducers = {};
|
|
31673
|
+
for (let i = 0; i < reducerKeys.length; i++) {
|
|
31674
|
+
const key = reducerKeys[i];
|
|
31675
|
+
if (typeof reducers[key] === "function") {
|
|
31676
|
+
finalReducers[key] = reducers[key];
|
|
31677
|
+
}
|
|
31678
|
+
}
|
|
31679
|
+
const finalReducerKeys = Object.keys(finalReducers);
|
|
31680
|
+
let shapeAssertionError;
|
|
31681
|
+
try {
|
|
31682
|
+
assertReducerShape(finalReducers);
|
|
31683
|
+
} catch (e) {
|
|
31684
|
+
shapeAssertionError = e;
|
|
31685
|
+
}
|
|
31686
|
+
return function combination(state = {}, action) {
|
|
31687
|
+
if (shapeAssertionError) {
|
|
31688
|
+
throw shapeAssertionError;
|
|
31689
|
+
}
|
|
31690
|
+
let hasChanged = false;
|
|
31691
|
+
const nextState = {};
|
|
31692
|
+
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
31693
|
+
const key = finalReducerKeys[i];
|
|
31694
|
+
const reducer = finalReducers[key];
|
|
31695
|
+
const previousStateForKey = state[key];
|
|
31696
|
+
const nextStateForKey = reducer(previousStateForKey, action);
|
|
31697
|
+
if (typeof nextStateForKey === "undefined") {
|
|
31698
|
+
action && action.type;
|
|
31699
|
+
throw new Error(formatProdErrorMessage$1(14) );
|
|
31700
|
+
}
|
|
31701
|
+
nextState[key] = nextStateForKey;
|
|
31702
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
31703
|
+
}
|
|
31704
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
31705
|
+
return hasChanged ? nextState : state;
|
|
31706
|
+
};
|
|
31707
|
+
}
|
|
31708
|
+
|
|
31709
|
+
// src/compose.ts
|
|
31710
|
+
function compose(...funcs) {
|
|
31711
|
+
if (funcs.length === 0) {
|
|
31712
|
+
return (arg) => arg;
|
|
31713
|
+
}
|
|
31714
|
+
if (funcs.length === 1) {
|
|
31715
|
+
return funcs[0];
|
|
31716
|
+
}
|
|
31717
|
+
return funcs.reduce((a, b) => (...args) => a(b(...args)));
|
|
31718
|
+
}
|
|
31719
|
+
|
|
31720
|
+
// src/applyMiddleware.ts
|
|
31721
|
+
function applyMiddleware(...middlewares) {
|
|
31722
|
+
return (createStore2) => (reducer, preloadedState) => {
|
|
31723
|
+
const store = createStore2(reducer, preloadedState);
|
|
31724
|
+
let dispatch = () => {
|
|
31725
|
+
throw new Error(formatProdErrorMessage$1(15) );
|
|
31726
|
+
};
|
|
31727
|
+
const middlewareAPI = {
|
|
31728
|
+
getState: store.getState,
|
|
31729
|
+
dispatch: (action, ...args) => dispatch(action, ...args)
|
|
31730
|
+
};
|
|
31731
|
+
const chain = middlewares.map((middleware) => middleware(middlewareAPI));
|
|
31732
|
+
dispatch = compose(...chain)(store.dispatch);
|
|
31733
|
+
return {
|
|
31734
|
+
...store,
|
|
31735
|
+
dispatch
|
|
31736
|
+
};
|
|
31737
|
+
};
|
|
31738
|
+
}
|
|
31739
|
+
|
|
31740
|
+
// src/index.ts
|
|
31741
|
+
function createThunkMiddleware(extraArgument) {
|
|
31742
|
+
const middleware = ({ dispatch, getState }) => (next) => (action) => {
|
|
31743
|
+
if (typeof action === "function") {
|
|
31744
|
+
return action(dispatch, getState, extraArgument);
|
|
31745
|
+
}
|
|
31746
|
+
return next(action);
|
|
31747
|
+
};
|
|
31748
|
+
return middleware;
|
|
31749
|
+
}
|
|
31750
|
+
var thunk = createThunkMiddleware();
|
|
31751
|
+
var withExtraArgument = createThunkMiddleware;
|
|
31752
|
+
|
|
31753
|
+
// src/index.ts
|
|
31754
|
+
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
|
|
31755
|
+
if (arguments.length === 0) return void 0;
|
|
31756
|
+
if (typeof arguments[0] === "object") return compose;
|
|
31757
|
+
return compose.apply(null, arguments);
|
|
31758
|
+
};
|
|
31759
|
+
var Tuple = class _Tuple extends Array {
|
|
31760
|
+
constructor(...items) {
|
|
31761
|
+
super(...items);
|
|
31762
|
+
Object.setPrototypeOf(this, _Tuple.prototype);
|
|
31763
|
+
}
|
|
31764
|
+
static get [Symbol.species]() {
|
|
31765
|
+
return _Tuple;
|
|
31766
|
+
}
|
|
31767
|
+
concat(...arr) {
|
|
31768
|
+
return super.concat.apply(this, arr);
|
|
31769
|
+
}
|
|
31770
|
+
prepend(...arr) {
|
|
31771
|
+
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
31772
|
+
return new _Tuple(...arr[0].concat(this));
|
|
31773
|
+
}
|
|
31774
|
+
return new _Tuple(...arr.concat(this));
|
|
31775
|
+
}
|
|
31776
|
+
};
|
|
31777
|
+
|
|
31778
|
+
// src/getDefaultMiddleware.ts
|
|
31779
|
+
function isBoolean(x) {
|
|
31780
|
+
return typeof x === "boolean";
|
|
31781
|
+
}
|
|
31782
|
+
var buildGetDefaultMiddleware = () => function getDefaultMiddleware(options) {
|
|
31783
|
+
const {
|
|
31784
|
+
thunk: thunk$1 = true,
|
|
31785
|
+
immutableCheck = true,
|
|
31786
|
+
serializableCheck = true,
|
|
31787
|
+
actionCreatorCheck = true
|
|
31788
|
+
} = options ?? {};
|
|
31789
|
+
let middlewareArray = new Tuple();
|
|
31790
|
+
if (thunk$1) {
|
|
31791
|
+
if (isBoolean(thunk$1)) {
|
|
31792
|
+
middlewareArray.push(thunk);
|
|
31793
|
+
} else {
|
|
31794
|
+
middlewareArray.push(withExtraArgument(thunk$1.extraArgument));
|
|
31795
|
+
}
|
|
31796
|
+
}
|
|
31797
|
+
return middlewareArray;
|
|
31798
|
+
};
|
|
31799
|
+
|
|
31800
|
+
// src/autoBatchEnhancer.ts
|
|
31801
|
+
var SHOULD_AUTOBATCH = "RTK_autoBatch";
|
|
31802
|
+
var createQueueWithTimer = (timeout) => {
|
|
31803
|
+
return (notify) => {
|
|
31804
|
+
setTimeout(notify, timeout);
|
|
31805
|
+
};
|
|
31806
|
+
};
|
|
31807
|
+
var rAF = typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10);
|
|
31808
|
+
var autoBatchEnhancer = (options = {
|
|
31809
|
+
type: "raf"
|
|
31810
|
+
}) => (next) => (...args) => {
|
|
31811
|
+
const store = next(...args);
|
|
31812
|
+
let notifying = true;
|
|
31813
|
+
let shouldNotifyAtEndOfTick = false;
|
|
31814
|
+
let notificationQueued = false;
|
|
31815
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
31816
|
+
const queueCallback = options.type === "tick" ? queueMicrotask : options.type === "raf" ? rAF : options.type === "callback" ? options.queueNotification : createQueueWithTimer(options.timeout);
|
|
31817
|
+
const notifyListeners = () => {
|
|
31818
|
+
notificationQueued = false;
|
|
31819
|
+
if (shouldNotifyAtEndOfTick) {
|
|
31820
|
+
shouldNotifyAtEndOfTick = false;
|
|
31821
|
+
listeners.forEach((l) => l());
|
|
31822
|
+
}
|
|
31823
|
+
};
|
|
31824
|
+
return Object.assign({}, store, {
|
|
31825
|
+
// Override the base `store.subscribe` method to keep original listeners
|
|
31826
|
+
// from running if we're delaying notifications
|
|
31827
|
+
subscribe(listener2) {
|
|
31828
|
+
const wrappedListener = () => notifying && listener2();
|
|
31829
|
+
const unsubscribe = store.subscribe(wrappedListener);
|
|
31830
|
+
listeners.add(listener2);
|
|
31831
|
+
return () => {
|
|
31832
|
+
unsubscribe();
|
|
31833
|
+
listeners.delete(listener2);
|
|
31834
|
+
};
|
|
31835
|
+
},
|
|
31836
|
+
// Override the base `store.dispatch` method so that we can check actions
|
|
31837
|
+
// for the `shouldAutoBatch` flag and determine if batching is active
|
|
31838
|
+
dispatch(action) {
|
|
31839
|
+
try {
|
|
31840
|
+
notifying = !action?.meta?.[SHOULD_AUTOBATCH];
|
|
31841
|
+
shouldNotifyAtEndOfTick = !notifying;
|
|
31842
|
+
if (shouldNotifyAtEndOfTick) {
|
|
31843
|
+
if (!notificationQueued) {
|
|
31844
|
+
notificationQueued = true;
|
|
31845
|
+
queueCallback(notifyListeners);
|
|
31846
|
+
}
|
|
31847
|
+
}
|
|
31848
|
+
return store.dispatch(action);
|
|
31849
|
+
} finally {
|
|
31850
|
+
notifying = true;
|
|
31851
|
+
}
|
|
31852
|
+
}
|
|
31853
|
+
});
|
|
31854
|
+
};
|
|
31855
|
+
|
|
31856
|
+
// src/getDefaultEnhancers.ts
|
|
31857
|
+
var buildGetDefaultEnhancers = (middlewareEnhancer) => function getDefaultEnhancers(options) {
|
|
31858
|
+
const {
|
|
31859
|
+
autoBatch = true
|
|
31860
|
+
} = options ?? {};
|
|
31861
|
+
let enhancerArray = new Tuple(middlewareEnhancer);
|
|
31862
|
+
if (autoBatch) {
|
|
31863
|
+
enhancerArray.push(autoBatchEnhancer(typeof autoBatch === "object" ? autoBatch : void 0));
|
|
31864
|
+
}
|
|
31865
|
+
return enhancerArray;
|
|
31866
|
+
};
|
|
31867
|
+
|
|
31868
|
+
// src/configureStore.ts
|
|
31869
|
+
function configureStore(options) {
|
|
31870
|
+
const getDefaultMiddleware = buildGetDefaultMiddleware();
|
|
31871
|
+
const {
|
|
31872
|
+
reducer = void 0,
|
|
31873
|
+
middleware,
|
|
31874
|
+
devTools = true,
|
|
31875
|
+
preloadedState = void 0,
|
|
31876
|
+
enhancers = void 0
|
|
31877
|
+
} = options || {};
|
|
31878
|
+
let rootReducer;
|
|
31879
|
+
if (typeof reducer === "function") {
|
|
31880
|
+
rootReducer = reducer;
|
|
31881
|
+
} else if (isPlainObject(reducer)) {
|
|
31882
|
+
rootReducer = combineReducers(reducer);
|
|
31883
|
+
} else {
|
|
31884
|
+
throw new Error(formatProdErrorMessage(1) );
|
|
31885
|
+
}
|
|
31886
|
+
let finalMiddleware;
|
|
31887
|
+
if (typeof middleware === "function") {
|
|
31888
|
+
finalMiddleware = middleware(getDefaultMiddleware);
|
|
31889
|
+
} else {
|
|
31890
|
+
finalMiddleware = getDefaultMiddleware();
|
|
31891
|
+
}
|
|
31892
|
+
let finalCompose = compose;
|
|
31893
|
+
if (devTools) {
|
|
31894
|
+
finalCompose = composeWithDevTools({
|
|
31895
|
+
// Enable capture of stack traces for dispatched Redux actions
|
|
31896
|
+
trace: "production" !== "production",
|
|
31897
|
+
...typeof devTools === "object" && devTools
|
|
31898
|
+
});
|
|
31899
|
+
}
|
|
31900
|
+
const middlewareEnhancer = applyMiddleware(...finalMiddleware);
|
|
31901
|
+
const getDefaultEnhancers = buildGetDefaultEnhancers(middlewareEnhancer);
|
|
31902
|
+
let storeEnhancers = typeof enhancers === "function" ? enhancers(getDefaultEnhancers) : getDefaultEnhancers();
|
|
31903
|
+
const composedEnhancer = finalCompose(...storeEnhancers);
|
|
31904
|
+
return createStore(rootReducer, preloadedState, composedEnhancer);
|
|
31905
|
+
}
|
|
31906
|
+
|
|
31907
|
+
// src/formatProdErrorMessage.ts
|
|
31908
|
+
function formatProdErrorMessage(code) {
|
|
31909
|
+
return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
31910
|
+
}
|
|
31911
|
+
|
|
31487
31912
|
function tryParseJson(str) {
|
|
31488
31913
|
try {
|
|
31489
31914
|
if (str) {
|
|
@@ -31663,15 +32088,12 @@ function appendMessageToState(state, msg) {
|
|
|
31663
32088
|
}
|
|
31664
32089
|
function update(state, action) {
|
|
31665
32090
|
var _a, _b, _c, _d;
|
|
31666
|
-
var _e;
|
|
32091
|
+
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
31667
32092
|
if (state === void 0) { state = DEFAULT_STATE; }
|
|
31668
32093
|
log("action", action);
|
|
31669
32094
|
if (action.type === "reset") {
|
|
31670
32095
|
return resetReducer(state);
|
|
31671
32096
|
}
|
|
31672
|
-
if (action.detail) {
|
|
31673
|
-
state.lastTimestamp = action.detail.timestamp;
|
|
31674
|
-
}
|
|
31675
32097
|
switch (action.type) {
|
|
31676
32098
|
case "connection_update":
|
|
31677
32099
|
case "receiveToken":
|
|
@@ -31679,39 +32101,25 @@ function update(state, action) {
|
|
|
31679
32101
|
// workaround until state is split. Use combineReducers afterwards
|
|
31680
32102
|
var newConnectionState = connectionReducer(state.connection, action);
|
|
31681
32103
|
if (state.connection !== newConnectionState) {
|
|
31682
|
-
state = __assign(__assign({}, state), { connection: newConnectionState });
|
|
32104
|
+
state = __assign(__assign({}, state), { lastTimestamp: (_e = action.detail) === null || _e === void 0 ? void 0 : _e.timestamp, connection: newConnectionState });
|
|
31683
32105
|
}
|
|
31684
32106
|
return state;
|
|
31685
32107
|
case "account_status":
|
|
31686
|
-
return __assign(__assign({}, state), { accountStatus: action.detail.status });
|
|
32108
|
+
return __assign(__assign({}, state), { lastTimestamp: (_f = action.detail) === null || _f === void 0 ? void 0 : _f.timestamp, accountStatus: action.detail.status });
|
|
31687
32109
|
case "session_id":
|
|
31688
|
-
return __assign(__assign({}, state), { sessionId: action.detail.sessionId });
|
|
32110
|
+
return __assign(__assign({}, state), { lastTimestamp: (_g = action.detail) === null || _g === void 0 ? void 0 : _g.timestamp, sessionId: action.detail.sessionId });
|
|
31689
32111
|
case "visual_status":
|
|
31690
|
-
|
|
31691
|
-
// Backward compatibility
|
|
31692
|
-
if (!newVisualState.visuals) {
|
|
31693
|
-
newVisualState.visuals = {};
|
|
31694
|
-
}
|
|
31695
|
-
if (action.detail.status.drawer !== undefined) {
|
|
31696
|
-
newVisualState.visuals.drawer = action.detail.status.drawer;
|
|
31697
|
-
}
|
|
31698
|
-
if (action.detail.status.opened !== undefined) {
|
|
31699
|
-
newVisualState.visuals.opened = action.detail.status.opened;
|
|
31700
|
-
}
|
|
31701
|
-
if (action.detail.status.visible !== undefined) {
|
|
31702
|
-
newVisualState.visuals.visible = action.detail.status.visible;
|
|
31703
|
-
}
|
|
31704
|
-
return newVisualState;
|
|
32112
|
+
return __assign(__assign({}, state), { lastTimestamp: (_h = action.detail) === null || _h === void 0 ? void 0 : _h.timestamp, visuals: __assign(__assign(__assign(__assign({}, (state.visuals || {})), (action.detail.status.drawer !== undefined && { drawer: action.detail.status.drawer })), (action.detail.status.opened !== undefined && { opened: action.detail.status.opened })), (action.detail.status.visible !== undefined && { visible: action.detail.status.visible })) });
|
|
31705
32113
|
case "department_update":
|
|
31706
|
-
return __assign(__assign({}, state), { departments: __assign(__assign({}, state.departments), (_a = {}, _a[action.detail.id] = __assign({}, action.detail), _a)) });
|
|
32114
|
+
return __assign(__assign({}, state), { lastTimestamp: (_j = action.detail) === null || _j === void 0 ? void 0 : _j.timestamp, departments: __assign(__assign({}, state.departments), (_a = {}, _a[action.detail.id] = __assign({}, action.detail), _a)) });
|
|
31707
32115
|
case "visitor_update":
|
|
31708
|
-
return __assign(__assign({}, state), { visitor: __assign(__assign({}, state.visitor), action.detail) });
|
|
32116
|
+
return __assign(__assign({}, state), { lastTimestamp: (_k = action.detail) === null || _k === void 0 ? void 0 : _k.timestamp, visitor: __assign(__assign({}, state.visitor), action.detail) });
|
|
31709
32117
|
case "agent_update":
|
|
31710
32118
|
var prevUpdateAgent = state.agents[action.detail.nick];
|
|
31711
|
-
return __assign(__assign({}, state), { agents: __assign(__assign({}, state.agents), (_b = {}, _b[action.detail.nick] = __assign(__assign({}, prevUpdateAgent), { user: __assign(__assign({}, prevUpdateAgent.user), action.detail), typing: (prevUpdateAgent || { typing: false }).typing // if we had it - keep it
|
|
32119
|
+
return __assign(__assign({}, state), { lastTimestamp: (_l = action.detail) === null || _l === void 0 ? void 0 : _l.timestamp, agents: __assign(__assign({}, state.agents), (_b = {}, _b[action.detail.nick] = __assign(__assign({}, prevUpdateAgent), { user: __assign(__assign({}, prevUpdateAgent.user), action.detail), typing: (prevUpdateAgent || { typing: false }).typing // if we had it - keep it
|
|
31712
32120
|
}), _b)) });
|
|
31713
32121
|
case "chat":
|
|
31714
|
-
var newState = __assign({}, state);
|
|
32122
|
+
var newState = __assign(__assign({}, state), { lastTimestamp: (_m = action.detail) === null || _m === void 0 ? void 0 : _m.timestamp });
|
|
31715
32123
|
switch (action.detail.type) {
|
|
31716
32124
|
case "chat.memberjoin":
|
|
31717
32125
|
return memberJoin(state, action.detail);
|
|
@@ -31731,7 +32139,7 @@ function update(state, action) {
|
|
|
31731
32139
|
appendMessageToState(newState, action.detail);
|
|
31732
32140
|
var detail = action.detail;
|
|
31733
32141
|
var msg = detail.type === "chat.msg" ? detail.msg : null;
|
|
31734
|
-
newState.chips = ((
|
|
32142
|
+
newState.chips = ((_o = msg === null || msg === void 0 ? void 0 : msg.options) === null || _o === void 0 ? void 0 : _o.length) ? msg.options : [];
|
|
31735
32143
|
return newState;
|
|
31736
32144
|
case "chat.failureMsg":
|
|
31737
32145
|
var agentDetails = newState.agents[action.detail.user.nick];
|
|
@@ -31751,7 +32159,7 @@ function update(state, action) {
|
|
|
31751
32159
|
return __assign(__assign({}, finalState), { agents: __assign(__assign({}, finalState.agents), (_c = {}, _c[action.detail.user.nick] = __assign(__assign({}, agentDetails), { typing: false, requestFailed: true }), _c)), failureMsg: action.detail.failureMsg });
|
|
31752
32160
|
case "chat.typing":
|
|
31753
32161
|
var agent = state.agents[action.detail.user.nick];
|
|
31754
|
-
return __assign(__assign({}, state), { agents: __assign(__assign({}, state.agents), (_d = {}, _d[action.detail.user.nick] = __assign(__assign({}, agent), { typing: action.detail.typing }), _d)) });
|
|
32162
|
+
return __assign(__assign({}, state), { lastTimestamp: (_p = action.detail) === null || _p === void 0 ? void 0 : _p.timestamp, agents: __assign(__assign({}, state.agents), (_d = {}, _d[action.detail.user.nick] = __assign(__assign({}, agent), { typing: action.detail.typing }), _d)) });
|
|
31755
32163
|
default:
|
|
31756
32164
|
return state;
|
|
31757
32165
|
}
|
|
@@ -31822,9 +32230,7 @@ function createChatStore(config, dataStorage) {
|
|
|
31822
32230
|
var now = new Date().getTime();
|
|
31823
32231
|
if (joinSessionId) {
|
|
31824
32232
|
var adminTimesData = dataStorage.getItem(ADMIN_STORE_KEY);
|
|
31825
|
-
// Create
|
|
31826
32233
|
var adminTimes = adminTimesData ? JSON.parse(adminTimesData) : {};
|
|
31827
|
-
// if exists, use it. If not, check if we are maxed out. evict one session if we are.
|
|
31828
32234
|
if (adminTimes[joinSessionId]) {
|
|
31829
32235
|
log("ChatStore: reusing session: ".concat(joinSessionId));
|
|
31830
32236
|
adminTimes[joinSessionId].lastAccessMs = now;
|
|
@@ -31837,7 +32243,6 @@ function createChatStore(config, dataStorage) {
|
|
|
31837
32243
|
dataStorage.removeItem(adminTimes[evictedSessionId].dataStorageKey);
|
|
31838
32244
|
adminTimes[evictedSessionId] = undefined;
|
|
31839
32245
|
}
|
|
31840
|
-
// We now have room
|
|
31841
32246
|
dataStorageKey = generateKey(connection, joinSessionId);
|
|
31842
32247
|
adminTimes[joinSessionId] = {
|
|
31843
32248
|
lastAccessMs: now,
|
|
@@ -31857,21 +32262,19 @@ function createChatStore(config, dataStorage) {
|
|
|
31857
32262
|
sessionExpiration: config.sessionExpiration
|
|
31858
32263
|
});
|
|
31859
32264
|
var chatReducer = persistStateReducer(storage, defaultState, storeHandler);
|
|
31860
|
-
|
|
31861
|
-
|
|
31862
|
-
|
|
31863
|
-
|
|
31864
|
-
|
|
31865
|
-
|
|
32265
|
+
// Configure store with @reduxjs/toolkit
|
|
32266
|
+
var store = configureStore({
|
|
32267
|
+
reducer: chatReducer,
|
|
32268
|
+
middleware: function (getDefaultMiddleware) {
|
|
32269
|
+
return getDefaultMiddleware({
|
|
32270
|
+
thunk: true,
|
|
32271
|
+
});
|
|
32272
|
+
},
|
|
32273
|
+
devTools: "production" !== 'production', // Include dev tools in non-production environments
|
|
32274
|
+
});
|
|
32275
|
+
return store;
|
|
31866
32276
|
}
|
|
31867
|
-
/**
|
|
31868
|
-
* Pick one admin session for eviction
|
|
31869
|
-
*
|
|
31870
|
-
* @param adminTimes
|
|
31871
|
-
* @returns
|
|
31872
|
-
*/
|
|
31873
32277
|
function evictAdminSession(adminTimes) {
|
|
31874
|
-
// Find the oldest
|
|
31875
32278
|
var minTimeTs = Number.MAX_VALUE;
|
|
31876
32279
|
var minSessionId;
|
|
31877
32280
|
for (var _i = 0, _a = Object.keys(adminTimes); _i < _a.length; _i++) {
|
|
@@ -31917,6 +32320,7 @@ var ChatWidgetContainer = function (props) {
|
|
|
31917
32320
|
React$1.createElement(ChatWidgetWrapper, __assign({}, widgetProps))));
|
|
31918
32321
|
};
|
|
31919
32322
|
|
|
32323
|
+
// Function to create a static reducer
|
|
31920
32324
|
function createStaticReducer(state) {
|
|
31921
32325
|
return function (oldState, action) {
|
|
31922
32326
|
if (oldState === void 0) { oldState = state; }
|
|
@@ -31924,14 +32328,19 @@ function createStaticReducer(state) {
|
|
|
31924
32328
|
return oldState;
|
|
31925
32329
|
};
|
|
31926
32330
|
}
|
|
31927
|
-
//
|
|
31928
|
-
var composeEnhancers = (globalThis === null || globalThis === void 0 ? void 0 : globalThis.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;
|
|
31929
|
-
var middlewares = [
|
|
31930
|
-
thunk.default
|
|
31931
|
-
];
|
|
32331
|
+
// Function to create the store using @reduxjs/toolkit's configureStore
|
|
31932
32332
|
function createStaticStore(state) {
|
|
31933
32333
|
var reducer = createStaticReducer(state);
|
|
31934
|
-
|
|
32334
|
+
var store = configureStore({
|
|
32335
|
+
reducer: reducer,
|
|
32336
|
+
middleware: function (getDefaultMiddleware) {
|
|
32337
|
+
return getDefaultMiddleware({
|
|
32338
|
+
thunk: true, // Thunk is included by default, this is just for explicitness
|
|
32339
|
+
});
|
|
32340
|
+
},
|
|
32341
|
+
devTools: "production" !== 'production', // Redux DevTools in non-production environments
|
|
32342
|
+
});
|
|
32343
|
+
return store;
|
|
31935
32344
|
}
|
|
31936
32345
|
|
|
31937
32346
|
var StaticChatWidgetContainer = function (props) {
|