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