@seamly/web-ui 20.8.0-alpha.1 → 20.8.0-beta.2
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/build/dist/lib/index.debug.js +48 -48
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +1 -1
- package/build/dist/lib/index.js +364 -284
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +551 -274
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +166 -85
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +1 -1
- package/src/javascripts/config.types.ts +1 -0
- package/src/javascripts/domains/app/actions.ts +45 -41
- package/src/javascripts/domains/config/slice.ts +2 -0
- package/src/javascripts/domains/i18n/slice.ts +0 -3
- package/src/javascripts/domains/store/slice.ts +23 -15
- package/src/javascripts/domains/store/store.types.ts +12 -1
- package/src/javascripts/domains/translations/hooks.ts +54 -48
- package/src/javascripts/domains/translations/selectors.ts +12 -0
- package/src/javascripts/domains/translations/slice.ts +70 -23
- package/src/javascripts/domains/translations/translations.types.ts +8 -1
- package/src/javascripts/schema.ts +3 -10
- package/src/javascripts/style-guide/components/app.js +2 -2
- package/src/javascripts/style-guide/states.js +61 -3
- package/src/javascripts/ui/components/conversation/conversation.js +7 -3
- package/src/javascripts/ui/components/conversation/event/card-message.js +1 -1
- package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +1 -1
- package/src/javascripts/ui/components/conversation/event/choice-prompt.js +1 -1
- package/src/javascripts/ui/components/conversation/event/conversation-suggestions.js +9 -2
- package/src/javascripts/ui/components/conversation/event/cta.js +1 -1
- package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +39 -3
- package/src/javascripts/ui/components/conversation/event/image.js +1 -1
- package/src/javascripts/ui/components/conversation/event/participant.js +1 -1
- package/src/javascripts/ui/components/conversation/event/splash.js +1 -1
- package/src/javascripts/ui/components/conversation/event/text.js +1 -1
- package/src/javascripts/ui/components/conversation/event/translation.js +1 -1
- package/src/javascripts/ui/components/conversation/event/upload.js +1 -1
- package/src/javascripts/ui/components/conversation/event/video.js +1 -1
- package/src/javascripts/ui/components/conversation/message-container.js +1 -23
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +3 -2
- package/src/javascripts/ui/components/faq/faq.js +3 -1
- package/src/javascripts/ui/components/options/options-button.js +3 -1
- package/src/javascripts/ui/components/suggestions/index.js +5 -2
- package/src/javascripts/ui/hooks/seamly-state-hooks.js +6 -0
- package/src/javascripts/ui/hooks/use-seamly-chat.js +3 -9
- package/src/stylesheets/5-components/_message-carousel.scss +10 -8
- package/CHANGELOG.md +0 -987
- package/src/javascripts/domains/translations/selectors.js +0 -11
package/build/dist/lib/index.js
CHANGED
|
@@ -6643,7 +6643,9 @@ const seamly_unavailable_error_1 = __importDefault(__webpack_require__(9060));
|
|
|
6643
6643
|
|
|
6644
6644
|
const actions_1 = __webpack_require__(915);
|
|
6645
6645
|
|
|
6646
|
-
const actions_2 = __webpack_require__(
|
|
6646
|
+
const actions_2 = __webpack_require__(59);
|
|
6647
|
+
|
|
6648
|
+
const actions_3 = __webpack_require__(5234);
|
|
6647
6649
|
|
|
6648
6650
|
const seamly_utils_1 = __webpack_require__(5740);
|
|
6649
6651
|
|
|
@@ -6652,7 +6654,8 @@ exports.initializeApp = (0, toolkit_1.createAsyncThunk)('initializeApp', (_, {
|
|
|
6652
6654
|
api,
|
|
6653
6655
|
config
|
|
6654
6656
|
},
|
|
6655
|
-
rejectWithValue
|
|
6657
|
+
rejectWithValue,
|
|
6658
|
+
dispatch
|
|
6656
6659
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6657
6660
|
var _a, _b, _c, _d;
|
|
6658
6661
|
|
|
@@ -6691,6 +6694,7 @@ exports.initializeApp = (0, toolkit_1.createAsyncThunk)('initializeApp', (_, {
|
|
|
6691
6694
|
});
|
|
6692
6695
|
}
|
|
6693
6696
|
|
|
6697
|
+
dispatch((0, actions_2.setLocale)(locale));
|
|
6694
6698
|
return {
|
|
6695
6699
|
initialState: undefined,
|
|
6696
6700
|
locale,
|
|
@@ -6728,7 +6732,7 @@ exports.resetApp = (0, toolkit_1.createAsyncThunk)('resetApp', (_, {
|
|
|
6728
6732
|
dispatch((0, actions_1.resetConfig)());
|
|
6729
6733
|
yield dispatch((0, actions_1.initializeConfig)());
|
|
6730
6734
|
yield dispatch((0, exports.initializeApp)());
|
|
6731
|
-
dispatch((0,
|
|
6735
|
+
dispatch((0, actions_3.initializeVisibility)());
|
|
6732
6736
|
}));
|
|
6733
6737
|
|
|
6734
6738
|
/***/ }),
|
|
@@ -7018,13 +7022,14 @@ exports.initialConfigState = Object.assign(Object.assign({}, config_1.defaultCon
|
|
|
7018
7022
|
connectWhenInView: true,
|
|
7019
7023
|
showDisclaimer: false,
|
|
7020
7024
|
showFaq: false,
|
|
7025
|
+
showSuggestions: true,
|
|
7021
7026
|
customComponents: {},
|
|
7022
7027
|
defaults: {
|
|
7023
7028
|
visible: null
|
|
7024
7029
|
},
|
|
7025
7030
|
preChatEvents: []
|
|
7026
7031
|
});
|
|
7027
|
-
const configKeys = ['hideOnNoUserResponse', 'connectWhenInView', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
|
|
7032
|
+
const configKeys = ['hideOnNoUserResponse', 'connectWhenInView', 'showDisclaimer', 'showFaq', 'showSuggestions', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
|
|
7028
7033
|
|
|
7029
7034
|
const updateState = (state, config) => {
|
|
7030
7035
|
const _a = (0, general_utils_1.pick)(config, configKeys),
|
|
@@ -7654,11 +7659,9 @@ exports.setTranslations = exports.setInitialLocale = exports.i18nSlice = void 0;
|
|
|
7654
7659
|
|
|
7655
7660
|
const toolkit_1 = __webpack_require__(575);
|
|
7656
7661
|
|
|
7657
|
-
const actions_1 = __webpack_require__(
|
|
7658
|
-
|
|
7659
|
-
const actions_2 = __webpack_require__(915);
|
|
7662
|
+
const actions_1 = __webpack_require__(915);
|
|
7660
7663
|
|
|
7661
|
-
const
|
|
7664
|
+
const actions_2 = __webpack_require__(59);
|
|
7662
7665
|
|
|
7663
7666
|
const initialState = {
|
|
7664
7667
|
translations: {
|
|
@@ -7696,15 +7699,11 @@ exports.i18nSlice = (0, toolkit_1.createSlice)({
|
|
|
7696
7699
|
},
|
|
7697
7700
|
extraReducers: builder => {
|
|
7698
7701
|
// Add reducers for additional action types here, and handle loading state as needed
|
|
7699
|
-
builder.addCase(
|
|
7702
|
+
builder.addCase(actions_1.initializeConfig.fulfilled, (state, {
|
|
7700
7703
|
payload
|
|
7701
7704
|
}) => {
|
|
7702
7705
|
state.initialLocale = payload.locale;
|
|
7703
|
-
}).addCase(
|
|
7704
|
-
payload
|
|
7705
|
-
}) => {
|
|
7706
|
-
state.locale = payload.locale;
|
|
7707
|
-
}).addCase(actions_3.setLocale.fulfilled, (state, {
|
|
7706
|
+
}).addCase(actions_2.setLocale.fulfilled, (state, {
|
|
7708
7707
|
payload
|
|
7709
7708
|
}) => {
|
|
7710
7709
|
if (!(payload === null || payload === void 0 ? void 0 : payload.translations)) {
|
|
@@ -8048,7 +8047,7 @@ var _a;
|
|
|
8048
8047
|
Object.defineProperty(exports, "__esModule", ({
|
|
8049
8048
|
value: true
|
|
8050
8049
|
}));
|
|
8051
|
-
exports.stopIdleDetachCountdownCounter = exports.showOption = exports.setUserSelectedOptions = exports.setUserSelectedOption = exports.setUserEntryType = exports.setUploadProgress = exports.setUploadError = exports.setUploadComplete = exports.setServiceEntryMetadata = exports.setServiceDataItem = exports.setSeamlyContainerElement = exports.setParticipant = exports.setLoadedImageEventIds = exports.setIsLoading = exports.setInitialState = exports.setHistory = exports.setHeaderTitle = exports.setHeaderSubTitle = exports.setFeatures = exports.setFeatureEnabledState = exports.setEventsRead = exports.setBlockAutoEntrySwitch = exports.setActiveService = exports.setActiveEntryType = exports.resetHistoryLoadedFlag = exports.registerUpload = exports.initResumeConversationPrompt = exports.initIdleDetachCountdown = exports.hideOption = exports.decrementIdleDetachCountdownCounter = exports.clearResumeConversationPrompt = exports.clearIdleDetachCountdown = exports.clearFeatures = exports.clearEvents = exports.clearAllUploads = exports.addEvent = exports.ackEvent = exports.storeSlice = exports.initialStoreState = exports.mergeHistory = exports.isUnreadMessage = void 0;
|
|
8050
|
+
exports.stopIdleDetachCountdownCounter = exports.showOption = exports.setUserSelectedOptions = exports.setUserSelectedOption = exports.setUserEntryType = exports.setUploadProgress = exports.setUploadError = exports.setUploadComplete = exports.setServiceEntryMetadata = exports.setServiceDataItem = exports.setSeamlyContainerElement = exports.setParticipant = exports.setLoadedImageEventIds = exports.setIsLoading = exports.setInitialState = exports.setHistory = exports.setHeaderTitle = exports.setHeaderSubTitle = exports.setFeatures = exports.setFeatureEnabledState = exports.setEventsRead = exports.setBlockAutoEntrySwitch = exports.setActiveService = exports.setActiveEntryType = exports.resetHistoryLoadedFlag = exports.registerUpload = exports.initResumeConversationPrompt = exports.initIdleDetachCountdown = exports.hideOption = exports.decrementIdleDetachCountdownCounter = exports.clearResumeConversationPrompt = exports.clearIdleDetachCountdown = exports.clearFeatures = exports.clearEvents = exports.clearAllUploads = exports.addEvent = exports.ackEvent = exports.storeSlice = exports.initialStoreState = exports.mergeHistory = exports.orderHistory = exports.isUnreadMessage = void 0;
|
|
8052
8051
|
|
|
8053
8052
|
const toolkit_1 = __webpack_require__(575);
|
|
8054
8053
|
|
|
@@ -8081,6 +8080,8 @@ const orderHistory = events => {
|
|
|
8081
8080
|
}) => occurredAtA - occurredAtB);
|
|
8082
8081
|
};
|
|
8083
8082
|
|
|
8083
|
+
exports.orderHistory = orderHistory;
|
|
8084
|
+
|
|
8084
8085
|
const mergeHistory = (stateEvents, historyEvents) => {
|
|
8085
8086
|
const newStateEvents = stateEvents.filter(stateEvent => // Deduplicate the event streams, giving events in historyEvents
|
|
8086
8087
|
// precedence so the server is able to push changes to events.
|
|
@@ -8091,7 +8092,7 @@ const mergeHistory = (stateEvents, historyEvents) => {
|
|
|
8091
8092
|
// these messages will be shown in the wrong order if not reversed. For
|
|
8092
8093
|
// the normal merging logic there is no added effect.
|
|
8093
8094
|
.reverse();
|
|
8094
|
-
return orderHistory([...newHistoryEvents, ...newStateEvents]);
|
|
8095
|
+
return (0, exports.orderHistory)([...newHistoryEvents, ...newStateEvents]);
|
|
8095
8096
|
};
|
|
8096
8097
|
|
|
8097
8098
|
exports.mergeHistory = mergeHistory;
|
|
@@ -8280,7 +8281,8 @@ exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
|
8280
8281
|
} = payload;
|
|
8281
8282
|
|
|
8282
8283
|
if (matchedEvent) {
|
|
8283
|
-
state.events =
|
|
8284
|
+
state.events = (0, exports.orderHistory)( //@ts-ignore
|
|
8285
|
+
state.events.map(m => m.payload.id === matchedEvent.payload.id ? Object.assign(Object.assign({}, m), {
|
|
8284
8286
|
payload: Object.assign(Object.assign({}, m.payload), {
|
|
8285
8287
|
id,
|
|
8286
8288
|
occurredAt
|
|
@@ -8340,9 +8342,11 @@ exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
|
8340
8342
|
}
|
|
8341
8343
|
|
|
8342
8344
|
const {
|
|
8343
|
-
entry
|
|
8344
|
-
uploads
|
|
8345
|
+
entry
|
|
8345
8346
|
} = activeServiceSettings;
|
|
8347
|
+
const {
|
|
8348
|
+
upload
|
|
8349
|
+
} = entry.options;
|
|
8346
8350
|
const historyNewEntryMeta = calculateNewEntryMeta(Object.assign(Object.assign(Object.assign({}, state.entryMeta), entry), {
|
|
8347
8351
|
active: entry.default || seamly_utils_1.payloadTypes.text,
|
|
8348
8352
|
options: Object.assign({}, entry && entry.options ? entry.options : {})
|
|
@@ -8350,14 +8354,14 @@ exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
|
8350
8354
|
let newFeatures = Object.assign({}, state.options.features);
|
|
8351
8355
|
const newFeaturesHasUpload = newFeatures.hasOwnProperty(seamly_utils_1.featureKeys.uploads); // Only set uploads if it was initialised by the account config.
|
|
8352
8356
|
|
|
8353
|
-
if (newFeaturesHasUpload && lastParticipantEvent.type === 'message') {
|
|
8357
|
+
if (newFeaturesHasUpload && (lastParticipantEvent === null || lastParticipantEvent === void 0 ? void 0 : lastParticipantEvent.type) === 'message') {
|
|
8354
8358
|
const {
|
|
8355
8359
|
payload: lastParticipantEventPayload
|
|
8356
8360
|
} = lastParticipantEvent;
|
|
8357
8361
|
const entryType = ((_a = lastParticipantEventPayload === null || lastParticipantEventPayload === void 0 ? void 0 : lastParticipantEventPayload.entry) === null || _a === void 0 ? void 0 : _a.type) || {};
|
|
8358
8362
|
newFeatures = Object.assign(Object.assign({}, newFeatures), {
|
|
8359
8363
|
uploads: {
|
|
8360
|
-
enabled: !!(
|
|
8364
|
+
enabled: !!(upload && upload.enabled),
|
|
8361
8365
|
enabledFromEntry: entryType === seamly_utils_1.entryTypes.upload
|
|
8362
8366
|
}
|
|
8363
8367
|
});
|
|
@@ -8374,7 +8378,7 @@ exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
|
8374
8378
|
state.serviceInfo = Object.assign(Object.assign({}, state.serviceInfo), {
|
|
8375
8379
|
activeServiceSessionId
|
|
8376
8380
|
});
|
|
8377
|
-
state.serviceData = serviceData
|
|
8381
|
+
state.serviceData = Object.assign(Object.assign({}, state.serviceData), serviceData);
|
|
8378
8382
|
state.options = Object.assign(Object.assign({}, state.options), {
|
|
8379
8383
|
features: newFeatures || {}
|
|
8380
8384
|
});
|
|
@@ -8445,8 +8449,8 @@ exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
|
8445
8449
|
setActiveService: (state, {
|
|
8446
8450
|
payload
|
|
8447
8451
|
}) => {
|
|
8448
|
-
if (state.serviceInfo.activeServiceSessionId !== payload
|
|
8449
|
-
state.serviceInfo.activeServiceSessionId = payload
|
|
8452
|
+
if (state.serviceInfo.activeServiceSessionId !== payload) {
|
|
8453
|
+
state.serviceInfo.activeServiceSessionId = payload;
|
|
8450
8454
|
}
|
|
8451
8455
|
},
|
|
8452
8456
|
setHeaderTitle: (state, {
|
|
@@ -8638,7 +8642,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8638
8642
|
}));
|
|
8639
8643
|
exports.useLocaleNativeName = exports.useTranslationsContainer = exports.useTranslatedEventData = exports.useTranslations = void 0;
|
|
8640
8644
|
|
|
8641
|
-
const selectors_1 = __webpack_require__(
|
|
8645
|
+
const selectors_1 = __webpack_require__(6787);
|
|
8642
8646
|
|
|
8643
8647
|
const slice_1 = __webpack_require__(841);
|
|
8644
8648
|
|
|
@@ -8655,7 +8659,7 @@ function useTranslations() {
|
|
|
8655
8659
|
sendAction
|
|
8656
8660
|
} = (0, seamly_hooks_1.useSeamlyCommands)();
|
|
8657
8661
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
8658
|
-
const enableTranslations = (0,
|
|
8662
|
+
const enableTranslations = (0, hooks_1.useCallback)(locale => {
|
|
8659
8663
|
sendAction({
|
|
8660
8664
|
type: seamly_utils_1.actionTypes.setTranslation,
|
|
8661
8665
|
body: {
|
|
@@ -8664,18 +8668,15 @@ function useTranslations() {
|
|
|
8664
8668
|
}
|
|
8665
8669
|
});
|
|
8666
8670
|
dispatch((0, slice_1.enableTranslation)(locale));
|
|
8667
|
-
},
|
|
8668
|
-
|
|
8669
|
-
[sendAction, dispatch]);
|
|
8670
|
-
const disableTranslations = (0, seamly_hooks_1.useStableCallback)(() => {
|
|
8671
|
+
}, [sendAction, dispatch]);
|
|
8672
|
+
const disableTranslations = (0, hooks_1.useCallback)(() => {
|
|
8671
8673
|
sendAction({
|
|
8672
8674
|
type: seamly_utils_1.actionTypes.setTranslation,
|
|
8673
8675
|
body: {
|
|
8674
8676
|
enabled: false
|
|
8675
8677
|
}
|
|
8676
8678
|
});
|
|
8677
|
-
dispatch((0, slice_1.disableTranslation)());
|
|
8678
|
-
// @ts-ignore
|
|
8679
|
+
dispatch((0, slice_1.disableTranslation)());
|
|
8679
8680
|
}, [sendAction, dispatch]);
|
|
8680
8681
|
const {
|
|
8681
8682
|
languages,
|
|
@@ -8697,44 +8698,40 @@ function useTranslations() {
|
|
|
8697
8698
|
|
|
8698
8699
|
exports.useTranslations = useTranslations;
|
|
8699
8700
|
|
|
8700
|
-
function useTranslatedEventData({
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
const payloadId = payload === null || payload === void 0 ? void 0 : payload.id;
|
|
8704
|
-
let body;
|
|
8705
|
-
let translatedBody;
|
|
8706
|
-
|
|
8707
|
-
switch (payload === null || payload === void 0 ? void 0 : payload.type) {
|
|
8708
|
-
case 'participant':
|
|
8709
|
-
body = payload.participant.introduction;
|
|
8710
|
-
translatedBody = payload.participant.translatedIntroduction;
|
|
8711
|
-
break;
|
|
8701
|
+
function useTranslatedEventData(channelEvent) {
|
|
8702
|
+
const getTranslations = () => {
|
|
8703
|
+
var _a, _b, _c;
|
|
8712
8704
|
|
|
8713
|
-
|
|
8714
|
-
body
|
|
8715
|
-
translatedBody
|
|
8716
|
-
|
|
8705
|
+
if (!channelEvent.payload) return {
|
|
8706
|
+
body: undefined,
|
|
8707
|
+
translatedBody: undefined
|
|
8708
|
+
};
|
|
8717
8709
|
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
dispatch((0, slice_1.disableEvent)(payloadId));
|
|
8725
|
-
} else {
|
|
8726
|
-
dispatch((0, slice_1.enableEvent)(payloadId));
|
|
8727
|
-
} // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8728
|
-
// @ts-ignore
|
|
8710
|
+
if (channelEvent.type === 'participant') {
|
|
8711
|
+
return {
|
|
8712
|
+
body: (_a = channelEvent.payload) === null || _a === void 0 ? void 0 : _a.participant.introduction,
|
|
8713
|
+
translatedBody: (_c = (_b = channelEvent.payload) === null || _b === void 0 ? void 0 : _b.participant) === null || _c === void 0 ? void 0 : _c.translatedIntroduction
|
|
8714
|
+
};
|
|
8715
|
+
}
|
|
8729
8716
|
|
|
8730
|
-
|
|
8731
|
-
|
|
8717
|
+
return {
|
|
8718
|
+
body: channelEvent.payload.body,
|
|
8719
|
+
translatedBody: channelEvent.payload.translatedBody
|
|
8720
|
+
};
|
|
8721
|
+
};
|
|
8722
|
+
|
|
8723
|
+
const {
|
|
8724
|
+
translatedBody,
|
|
8725
|
+
body
|
|
8726
|
+
} = getTranslations();
|
|
8727
|
+
const hasTranslation = !!translatedBody;
|
|
8728
|
+
const isTranslated = (0, react_redux_1.useSelector)((0, selectors_1.selectIsTranslated)(channelEvent));
|
|
8729
|
+
return {
|
|
8730
|
+
body: hasTranslation && isTranslated ? translatedBody === null || translatedBody === void 0 ? void 0 : translatedBody.data : body,
|
|
8732
8731
|
hasTranslation,
|
|
8733
8732
|
isTranslated: isTranslated && hasTranslation,
|
|
8734
|
-
toggleTranslation,
|
|
8735
|
-
translatedBy: translatedBody === null || translatedBody === void 0 ? void 0 : translatedBody.translatedBy,
|
|
8736
8733
|
locale: translatedBody === null || translatedBody === void 0 ? void 0 : translatedBody.locale
|
|
8737
|
-
}
|
|
8734
|
+
};
|
|
8738
8735
|
}
|
|
8739
8736
|
|
|
8740
8737
|
exports.useTranslatedEventData = useTranslatedEventData;
|
|
@@ -8767,6 +8764,29 @@ exports.useLocaleNativeName = useLocaleNativeName;
|
|
|
8767
8764
|
|
|
8768
8765
|
/***/ }),
|
|
8769
8766
|
|
|
8767
|
+
/***/ 6787:
|
|
8768
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8769
|
+
|
|
8770
|
+
"use strict";
|
|
8771
|
+
|
|
8772
|
+
|
|
8773
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
8774
|
+
value: true
|
|
8775
|
+
}));
|
|
8776
|
+
exports.selectIsTranslated = void 0;
|
|
8777
|
+
|
|
8778
|
+
const toolkit_1 = __webpack_require__(575);
|
|
8779
|
+
|
|
8780
|
+
const selectIsTranslated = channelEvent => (0, toolkit_1.createSelector)(store => store.translations.translatedEventGroups, translatedEventGroups => Object.values(translatedEventGroups).every(value => {
|
|
8781
|
+
var _a;
|
|
8782
|
+
|
|
8783
|
+
return !value.includes((_a = channelEvent === null || channelEvent === void 0 ? void 0 : channelEvent.payload) === null || _a === void 0 ? void 0 : _a.id);
|
|
8784
|
+
}));
|
|
8785
|
+
|
|
8786
|
+
exports.selectIsTranslated = selectIsTranslated;
|
|
8787
|
+
|
|
8788
|
+
/***/ }),
|
|
8789
|
+
|
|
8770
8790
|
/***/ 841:
|
|
8771
8791
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8772
8792
|
|
|
@@ -8778,22 +8798,58 @@ var _a;
|
|
|
8778
8798
|
Object.defineProperty(exports, "__esModule", ({
|
|
8779
8799
|
value: true
|
|
8780
8800
|
}));
|
|
8781
|
-
exports.
|
|
8801
|
+
exports.disableEventsTranslation = exports.enableEventsTranslation = exports.disableTranslation = exports.enableTranslation = exports.translationSlice = exports.translationsInitialState = void 0;
|
|
8782
8802
|
|
|
8783
8803
|
const toolkit_1 = __webpack_require__(575);
|
|
8784
8804
|
|
|
8785
|
-
const actions_1 = __webpack_require__(
|
|
8805
|
+
const actions_1 = __webpack_require__(915);
|
|
8786
8806
|
|
|
8787
|
-
const
|
|
8807
|
+
const slice_1 = __webpack_require__(1153);
|
|
8788
8808
|
|
|
8789
8809
|
exports.translationsInitialState = {
|
|
8790
8810
|
isActive: false,
|
|
8791
8811
|
currentLocale: undefined,
|
|
8792
8812
|
isAvailable: false,
|
|
8793
8813
|
languages: [],
|
|
8794
|
-
|
|
8795
|
-
|
|
8814
|
+
containerId: (0, toolkit_1.nanoid)(),
|
|
8815
|
+
translatedEventGroups: {}
|
|
8816
|
+
};
|
|
8817
|
+
|
|
8818
|
+
const getLastGroupId = (events, id) => {
|
|
8819
|
+
const eventGroup = [...events].reduce((acc, {
|
|
8820
|
+
payload
|
|
8821
|
+
}, _index, arr) => {
|
|
8822
|
+
var _a;
|
|
8823
|
+
|
|
8824
|
+
if (acc[id]) {
|
|
8825
|
+
// Splice to break early (make the reducer think we are done)
|
|
8826
|
+
// This is needed to avoid events of other groups from being added to the array.
|
|
8827
|
+
// @ts-ignore
|
|
8828
|
+
if ((payload === null || payload === void 0 ? void 0 : payload.type) === 'divider' && ((_a = payload === null || payload === void 0 ? void 0 : payload.body) === null || _a === void 0 ? void 0 : _a.translationEnabled)) {
|
|
8829
|
+
arr.splice(0);
|
|
8830
|
+
return acc;
|
|
8831
|
+
}
|
|
8832
|
+
|
|
8833
|
+
acc[id].push(payload.id);
|
|
8834
|
+
}
|
|
8835
|
+
|
|
8836
|
+
if (payload.id === id) acc[id] = [];
|
|
8837
|
+
return acc;
|
|
8838
|
+
}, {});
|
|
8839
|
+
const [[groupId, eventIds]] = Object.entries(eventGroup);
|
|
8840
|
+
const lastGroupId = events //@ts-ignore
|
|
8841
|
+
.filter(event => {
|
|
8842
|
+
var _a;
|
|
8843
|
+
|
|
8844
|
+
return ((_a = event.payload) === null || _a === void 0 ? void 0 : _a.type) === 'divider';
|
|
8845
|
+
}).map(event => event.payload.id).at(-1);
|
|
8846
|
+
return {
|
|
8847
|
+
lastGroupId,
|
|
8848
|
+
groupId,
|
|
8849
|
+
eventIds
|
|
8850
|
+
};
|
|
8796
8851
|
};
|
|
8852
|
+
|
|
8797
8853
|
exports.translationSlice = (0, toolkit_1.createSlice)({
|
|
8798
8854
|
name: 'translation',
|
|
8799
8855
|
initialState: exports.translationsInitialState,
|
|
@@ -8808,35 +8864,35 @@ exports.translationSlice = (0, toolkit_1.createSlice)({
|
|
|
8808
8864
|
state.isActive = false;
|
|
8809
8865
|
state.currentLocale = undefined;
|
|
8810
8866
|
},
|
|
8811
|
-
|
|
8812
|
-
payload
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
return;
|
|
8867
|
+
enableEventsTranslation: (state, {
|
|
8868
|
+
payload: {
|
|
8869
|
+
events,
|
|
8870
|
+
id
|
|
8816
8871
|
}
|
|
8817
|
-
|
|
8818
|
-
state.originalPayloadIds = state.originalPayloadIds.filter(id => id !== payload);
|
|
8819
|
-
},
|
|
8820
|
-
disableEvent: (state, {
|
|
8821
|
-
payload
|
|
8822
8872
|
}) => {
|
|
8823
|
-
|
|
8824
|
-
|
|
8873
|
+
delete state.translatedEventGroups[id];
|
|
8874
|
+
const {
|
|
8875
|
+
lastGroupId
|
|
8876
|
+
} = getLastGroupId(events, id);
|
|
8877
|
+
state.lastGroupId = lastGroupId;
|
|
8878
|
+
},
|
|
8879
|
+
disableEventsTranslation: (state, {
|
|
8880
|
+
payload: {
|
|
8881
|
+
events,
|
|
8882
|
+
id
|
|
8825
8883
|
}
|
|
8826
|
-
|
|
8827
|
-
|
|
8884
|
+
}) => {
|
|
8885
|
+
const {
|
|
8886
|
+
lastGroupId,
|
|
8887
|
+
groupId,
|
|
8888
|
+
eventIds
|
|
8889
|
+
} = getLastGroupId(events, id);
|
|
8890
|
+
state.lastGroupId = lastGroupId;
|
|
8891
|
+
state.translatedEventGroups[groupId] = eventIds;
|
|
8828
8892
|
}
|
|
8829
8893
|
},
|
|
8830
8894
|
extraReducers: builder => {
|
|
8831
|
-
builder.addCase(actions_1.
|
|
8832
|
-
payload
|
|
8833
|
-
}) => {
|
|
8834
|
-
var _a, _b;
|
|
8835
|
-
|
|
8836
|
-
if (!((_b = (_a = payload.config) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.translationLocale)) return;
|
|
8837
|
-
state.isActive = true;
|
|
8838
|
-
state.currentLocale = payload.locale;
|
|
8839
|
-
}).addCase(actions_2.initializeConfig.fulfilled, (state, {
|
|
8895
|
+
builder.addCase(actions_1.initializeConfig.fulfilled, (state, {
|
|
8840
8896
|
payload
|
|
8841
8897
|
}) => {
|
|
8842
8898
|
var _a;
|
|
@@ -8845,10 +8901,16 @@ exports.translationSlice = (0, toolkit_1.createSlice)({
|
|
|
8845
8901
|
if (!feature) return;
|
|
8846
8902
|
state.isAvailable = feature.enabled === true;
|
|
8847
8903
|
state.languages = feature.languages;
|
|
8904
|
+
}).addCase(slice_1.addEvent, (state, {
|
|
8905
|
+
payload
|
|
8906
|
+
}) => {
|
|
8907
|
+
if (state.translatedEventGroups[state.lastGroupId]) {
|
|
8908
|
+
state.translatedEventGroups[state.lastGroupId].push(payload.payload.id);
|
|
8909
|
+
}
|
|
8848
8910
|
});
|
|
8849
8911
|
}
|
|
8850
8912
|
});
|
|
8851
|
-
_a = exports.translationSlice.actions, exports.enableTranslation = _a.enableTranslation, exports.disableTranslation = _a.disableTranslation, exports.
|
|
8913
|
+
_a = exports.translationSlice.actions, exports.enableTranslation = _a.enableTranslation, exports.disableTranslation = _a.disableTranslation, exports.enableEventsTranslation = _a.enableEventsTranslation, exports.disableEventsTranslation = _a.disableEventsTranslation;
|
|
8852
8914
|
exports["default"] = exports.translationSlice.reducer;
|
|
8853
8915
|
|
|
8854
8916
|
/***/ }),
|
|
@@ -9753,13 +9815,13 @@ class SeamlyBaseError extends Error {
|
|
|
9753
9815
|
|
|
9754
9816
|
this.originalError = originalError;
|
|
9755
9817
|
|
|
9756
|
-
if (originalError
|
|
9818
|
+
if (originalError?.payload) {
|
|
9757
9819
|
this.originalEvent = originalError;
|
|
9758
9820
|
this.originalError = originalError.payload.error;
|
|
9759
9821
|
this.message = `Event of type ${originalError.payload.type} encountered`;
|
|
9760
9822
|
}
|
|
9761
9823
|
|
|
9762
|
-
if (originalError
|
|
9824
|
+
if (originalError?.error) {
|
|
9763
9825
|
this.originalError = originalError.error;
|
|
9764
9826
|
}
|
|
9765
9827
|
}
|
|
@@ -11541,8 +11603,6 @@ class API {
|
|
|
11541
11603
|
|
|
11542
11604
|
async createConversation() {
|
|
11543
11605
|
try {
|
|
11544
|
-
var _conversation$transla;
|
|
11545
|
-
|
|
11546
11606
|
const request = client_default().post(`${this.getUrlPrefix('http')}${this.URLS.conversations}`).set('Content-Type', 'application/json').query({
|
|
11547
11607
|
v: config.apiVersion
|
|
11548
11608
|
}) // withCredentials() is necessary to allow browsers to save received
|
|
@@ -11565,7 +11625,7 @@ class API {
|
|
|
11565
11625
|
this.setChannelTopic(conversation.channelTopic);
|
|
11566
11626
|
this.updateUrls(body);
|
|
11567
11627
|
this.setConversationUrl(this.URLS.conversation);
|
|
11568
|
-
this.locale =
|
|
11628
|
+
this.locale = conversation.translation?.locale;
|
|
11569
11629
|
this.userResponded = conversation.userResponded;
|
|
11570
11630
|
return initialState;
|
|
11571
11631
|
} catch (error) {
|
|
@@ -11800,7 +11860,7 @@ class API {
|
|
|
11800
11860
|
return {
|
|
11801
11861
|
clientName: "@seamly/web-ui",
|
|
11802
11862
|
clientVariant: this.layoutMode,
|
|
11803
|
-
clientVersion: "20.
|
|
11863
|
+
clientVersion: "20.7.0",
|
|
11804
11864
|
currentUrl: window.location.toString(),
|
|
11805
11865
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
11806
11866
|
timezone: getTimeZone(),
|
|
@@ -11856,7 +11916,7 @@ function createErrorsMiddleware({
|
|
|
11856
11916
|
api,
|
|
11857
11917
|
layoutMode
|
|
11858
11918
|
} = (0,domains_config_selectors__WEBPACK_IMPORTED_MODULE_0__.selectConfig)(getState());
|
|
11859
|
-
errorCallback
|
|
11919
|
+
errorCallback?.(action.error, {
|
|
11860
11920
|
namespace,
|
|
11861
11921
|
api,
|
|
11862
11922
|
layoutMode,
|
|
@@ -11867,14 +11927,10 @@ function createErrorsMiddleware({
|
|
|
11867
11927
|
|
|
11868
11928
|
return next => action => {
|
|
11869
11929
|
try {
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
if ((_action$payload = action.payload) !== null && _action$payload !== void 0 && (_action$payload$origi = _action$payload.originalEvent) !== null && _action$payload$origi !== void 0 && _action$payload$origi.payload) {
|
|
11873
|
-
var _action$payload2, _action$payload2$orig, _action$payload2$orig2;
|
|
11874
|
-
|
|
11930
|
+
if (action.payload?.originalEvent?.payload) {
|
|
11875
11931
|
handleError({
|
|
11876
11932
|
error: action.payload,
|
|
11877
|
-
type:
|
|
11933
|
+
type: action.payload?.originalEvent?.payload?.type
|
|
11878
11934
|
});
|
|
11879
11935
|
}
|
|
11880
11936
|
|
|
@@ -11957,8 +12013,6 @@ function createI18nMiddleware({
|
|
|
11957
12013
|
}) {
|
|
11958
12014
|
return next => {
|
|
11959
12015
|
return action => {
|
|
11960
|
-
var _payload$translation, _payload$translation2, _payload$payload, _payload$payload$body;
|
|
11961
|
-
|
|
11962
12016
|
const result = next(action);
|
|
11963
12017
|
const {
|
|
11964
12018
|
payload
|
|
@@ -11966,7 +12020,7 @@ function createI18nMiddleware({
|
|
|
11966
12020
|
|
|
11967
12021
|
switch (action.type) {
|
|
11968
12022
|
case domains_store_slice__WEBPACK_IMPORTED_MODULE_3__.setHistory.type:
|
|
11969
|
-
if (payload
|
|
12023
|
+
if (payload?.translation?.enabled) {
|
|
11970
12024
|
dispatch((0,domains_translations_slice__WEBPACK_IMPORTED_MODULE_4__.enableTranslation)(payload.translation.locale));
|
|
11971
12025
|
dispatch((0,domains_i18n_actions__WEBPACK_IMPORTED_MODULE_1__.setLocale)(payload.translation.locale));
|
|
11972
12026
|
}
|
|
@@ -11981,14 +12035,14 @@ function createI18nMiddleware({
|
|
|
11981
12035
|
break;
|
|
11982
12036
|
|
|
11983
12037
|
case domains_store_slice__WEBPACK_IMPORTED_MODULE_3__.setInitialState.type:
|
|
11984
|
-
if (payload
|
|
12038
|
+
if (payload?.translation?.enabled) {
|
|
11985
12039
|
dispatch((0,domains_translations_slice__WEBPACK_IMPORTED_MODULE_4__.enableTranslation)(payload.translation.locale));
|
|
11986
12040
|
}
|
|
11987
12041
|
|
|
11988
12042
|
break;
|
|
11989
12043
|
|
|
11990
12044
|
case domains_store_slice__WEBPACK_IMPORTED_MODULE_3__.addEvent.type:
|
|
11991
|
-
if (payload.type === 'info' &&
|
|
12045
|
+
if (payload.type === 'info' && payload?.payload?.body?.subtype === 'new_translation' && payload.payload.body.translationEnabled) {
|
|
11992
12046
|
dispatch((0,domains_i18n_actions__WEBPACK_IMPORTED_MODULE_1__.setLocale)(payload.payload.body.translationLocale));
|
|
11993
12047
|
}
|
|
11994
12048
|
|
|
@@ -12007,26 +12061,6 @@ function createI18nMiddleware({
|
|
|
12007
12061
|
|
|
12008
12062
|
/***/ }),
|
|
12009
12063
|
|
|
12010
|
-
/***/ 5238:
|
|
12011
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
12012
|
-
|
|
12013
|
-
"use strict";
|
|
12014
|
-
__webpack_require__.r(__webpack_exports__);
|
|
12015
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12016
|
-
/* harmony export */ "getIsPayloadTranslated": () => (/* binding */ getIsPayloadTranslated),
|
|
12017
|
-
/* harmony export */ "getOriginalPayloadIds": () => (/* binding */ getOriginalPayloadIds)
|
|
12018
|
-
/* harmony export */ });
|
|
12019
|
-
/* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(573);
|
|
12020
|
-
|
|
12021
|
-
const getOriginalPayloadIds = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createSelector)(({
|
|
12022
|
-
translations
|
|
12023
|
-
}) => translations, ({
|
|
12024
|
-
originalPayloadIds
|
|
12025
|
-
}) => originalPayloadIds);
|
|
12026
|
-
const getIsPayloadTranslated = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createSelector)([getOriginalPayloadIds, (_, payloadId) => payloadId], (payloadIds, payloadId) => !payloadIds.includes(payloadId));
|
|
12027
|
-
|
|
12028
|
-
/***/ }),
|
|
12029
|
-
|
|
12030
12064
|
/***/ 2629:
|
|
12031
12065
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
12032
12066
|
|
|
@@ -12405,12 +12439,14 @@ const SeamlyEventSubscriber = ({
|
|
|
12405
12439
|
eventPayload = _objectWithoutProperties(payload, _excluded);
|
|
12406
12440
|
|
|
12407
12441
|
const {
|
|
12408
|
-
uploads,
|
|
12409
12442
|
entry
|
|
12410
12443
|
} = serviceSettings;
|
|
12444
|
+
const {
|
|
12445
|
+
upload
|
|
12446
|
+
} = entry.options;
|
|
12411
12447
|
dispatch((0,store_slice.setFeatureEnabledState)({
|
|
12412
12448
|
key: seamly_utils.featureKeys.uploads,
|
|
12413
|
-
enabled: !!(
|
|
12449
|
+
enabled: !!(upload && upload.enabled)
|
|
12414
12450
|
}));
|
|
12415
12451
|
dispatch((0,store_slice.setServiceEntryMetadata)(entry));
|
|
12416
12452
|
dispatch((0,store_slice.setActiveService)(payload.serviceSessionId));
|
|
@@ -12727,11 +12763,7 @@ function useSeamlyInstanceFunction(functionName, fn, deps = []) {
|
|
|
12727
12763
|
return undefined;
|
|
12728
12764
|
}
|
|
12729
12765
|
|
|
12730
|
-
const callback = (...args) =>
|
|
12731
|
-
var _callbackRef$current;
|
|
12732
|
-
|
|
12733
|
-
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
12734
|
-
};
|
|
12766
|
+
const callback = (...args) => callbackRef.current?.(...args);
|
|
12735
12767
|
|
|
12736
12768
|
eventBus.emit('function.register', functionName, callback);
|
|
12737
12769
|
return () => eventBus.emit('function.unregister', functionName, callback); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -12776,12 +12808,12 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
12776
12808
|
sendMessage({
|
|
12777
12809
|
body: text
|
|
12778
12810
|
});
|
|
12779
|
-
}, [api
|
|
12811
|
+
}, [api?.send]);
|
|
12780
12812
|
useSeamlyInstanceFunction('setVariables', variables => {
|
|
12781
12813
|
sendContext({
|
|
12782
12814
|
variables
|
|
12783
12815
|
});
|
|
12784
|
-
}, [api
|
|
12816
|
+
}, [api?.send]);
|
|
12785
12817
|
useSeamlyInstanceFunction('getVisibility', callback => {
|
|
12786
12818
|
if (callback) {
|
|
12787
12819
|
callback(currentVisibility.current);
|
|
@@ -12797,7 +12829,7 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
12797
12829
|
|
|
12798
12830
|
onActivityHandler();
|
|
12799
12831
|
setVisibility(visibilityState);
|
|
12800
|
-
}, [config
|
|
12832
|
+
}, [config?.api]);
|
|
12801
12833
|
useSeamlyInstanceFunction('sendCustomAction', (actionType, body) => {
|
|
12802
12834
|
sendAction({
|
|
12803
12835
|
type: 'custom',
|
|
@@ -13476,9 +13508,7 @@ class ExternalApi {
|
|
|
13476
13508
|
}
|
|
13477
13509
|
|
|
13478
13510
|
getMergedVariables(userConfig) {
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
return _objectSpread(_objectSpread(_objectSpread({}, ((_this$appConfig$conte = this.appConfig.context) === null || _this$appConfig$conte === void 0 ? void 0 : _this$appConfig$conte.variables) || {}), ((_userConfig$context = userConfig.context) === null || _userConfig$context === void 0 ? void 0 : _userConfig$context.variables) || {}), this.context.variables || {});
|
|
13511
|
+
return _objectSpread(_objectSpread(_objectSpread({}, this.appConfig.context?.variables || {}), userConfig.context?.variables || {}), this.context.variables || {});
|
|
13482
13512
|
}
|
|
13483
13513
|
|
|
13484
13514
|
}
|
|
@@ -15116,7 +15146,9 @@ const Image = _ref => {
|
|
|
15116
15146
|
} = _ref,
|
|
15117
15147
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15118
15148
|
|
|
15119
|
-
const
|
|
15149
|
+
const {
|
|
15150
|
+
body
|
|
15151
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15120
15152
|
const {
|
|
15121
15153
|
description,
|
|
15122
15154
|
url,
|
|
@@ -15174,7 +15206,9 @@ const Video = _ref => {
|
|
|
15174
15206
|
} = _ref,
|
|
15175
15207
|
props = video_objectWithoutProperties(_ref, video_excluded);
|
|
15176
15208
|
|
|
15177
|
-
const
|
|
15209
|
+
const {
|
|
15210
|
+
body
|
|
15211
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15178
15212
|
const {
|
|
15179
15213
|
description,
|
|
15180
15214
|
url
|
|
@@ -15232,6 +15266,8 @@ const Divider = ({
|
|
|
15232
15266
|
};
|
|
15233
15267
|
|
|
15234
15268
|
/* harmony default export */ const variants_default = (Divider);
|
|
15269
|
+
// EXTERNAL MODULE: ./src/javascripts/domains/translations/slice.ts
|
|
15270
|
+
var translations_slice = __webpack_require__(841);
|
|
15235
15271
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js
|
|
15236
15272
|
|
|
15237
15273
|
|
|
@@ -15240,21 +15276,46 @@ const Divider = ({
|
|
|
15240
15276
|
|
|
15241
15277
|
|
|
15242
15278
|
|
|
15279
|
+
|
|
15280
|
+
|
|
15281
|
+
|
|
15282
|
+
|
|
15283
|
+
|
|
15243
15284
|
const NewTranslationDivider = ({
|
|
15244
15285
|
event
|
|
15245
15286
|
}) => {
|
|
15246
15287
|
const {
|
|
15247
15288
|
t
|
|
15248
15289
|
} = (0,i18n_hooks.useI18n)();
|
|
15290
|
+
const events = (0,seamly_hooks.useEvents)();
|
|
15249
15291
|
const {
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15292
|
+
body: {
|
|
15293
|
+
translationEnabled,
|
|
15294
|
+
translationLocale,
|
|
15295
|
+
text
|
|
15296
|
+
},
|
|
15297
|
+
id
|
|
15298
|
+
} = event.payload;
|
|
15254
15299
|
const {
|
|
15255
15300
|
enableTranslations
|
|
15256
15301
|
} = (0,translations_hooks.useTranslations)();
|
|
15257
15302
|
const localeNativeName = (0,translations_hooks.useLocaleNativeName)(translationLocale);
|
|
15303
|
+
const translatedEventGroups = (0,es.useSelector)(state => state.translations.translatedEventGroups);
|
|
15304
|
+
const dispatch = (0,es.useDispatch)();
|
|
15305
|
+
const toggleTranslations = (0,hooks_.useCallback)(() => {
|
|
15306
|
+
if (!translatedEventGroups[id]) {
|
|
15307
|
+
dispatch((0,translations_slice.disableEventsTranslation)({
|
|
15308
|
+
events,
|
|
15309
|
+
id
|
|
15310
|
+
}));
|
|
15311
|
+
return;
|
|
15312
|
+
}
|
|
15313
|
+
|
|
15314
|
+
dispatch((0,translations_slice.enableEventsTranslation)({
|
|
15315
|
+
events,
|
|
15316
|
+
id
|
|
15317
|
+
}));
|
|
15318
|
+
}, [dispatch, events, id, translatedEventGroups]);
|
|
15258
15319
|
|
|
15259
15320
|
const handleRestartButtonclick = () => {
|
|
15260
15321
|
enableTranslations(translationLocale);
|
|
@@ -15268,10 +15329,17 @@ const NewTranslationDivider = ({
|
|
|
15268
15329
|
children: t(translationEnabled ? 'translations.divider.startText' : 'translations.divider.stopText', {
|
|
15269
15330
|
language: localeNativeName
|
|
15270
15331
|
})
|
|
15271
|
-
}), translationEnabled ? (0,jsx_runtime_.
|
|
15272
|
-
children:
|
|
15332
|
+
}), translationEnabled ? (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
|
|
15333
|
+
children: [(0,jsx_runtime_.jsx)("p", {
|
|
15334
|
+
children: text
|
|
15335
|
+
}), (0,jsx_runtime_.jsx)("button", {
|
|
15336
|
+
className: (0,css.className)('button', 'button--secondary'),
|
|
15337
|
+
onClick: toggleTranslations,
|
|
15338
|
+
children: t(!translatedEventGroups[id] ? 'translations.toggle.hideTranslationsButtonText' : 'translations.toggle.showTranslationsButtonText')
|
|
15339
|
+
})]
|
|
15273
15340
|
}) : (0,jsx_runtime_.jsx)("button", {
|
|
15274
15341
|
className: (0,css.className)('button', 'button--secondary'),
|
|
15342
|
+
"data-testid": "restartTranslationButton",
|
|
15275
15343
|
onClick: handleRestartButtonclick,
|
|
15276
15344
|
children: t('translations.divider.restartButtonText')
|
|
15277
15345
|
})]
|
|
@@ -15341,7 +15409,9 @@ const Translation = _ref => {
|
|
|
15341
15409
|
const {
|
|
15342
15410
|
t
|
|
15343
15411
|
} = (0,i18n_hooks.useI18n)();
|
|
15344
|
-
const
|
|
15412
|
+
const {
|
|
15413
|
+
body
|
|
15414
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15345
15415
|
return (0,jsx_runtime_.jsx)(message_container["default"], translation_objectSpread(translation_objectSpread({
|
|
15346
15416
|
type: "text",
|
|
15347
15417
|
event: event
|
|
@@ -15362,7 +15432,9 @@ const Participant = ({
|
|
|
15362
15432
|
const {
|
|
15363
15433
|
participant
|
|
15364
15434
|
} = event.payload;
|
|
15365
|
-
const
|
|
15435
|
+
const {
|
|
15436
|
+
body: introduction
|
|
15437
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15366
15438
|
|
|
15367
15439
|
if (!introduction) {
|
|
15368
15440
|
return null;
|
|
@@ -15407,7 +15479,9 @@ const Splash = _ref => {
|
|
|
15407
15479
|
const {
|
|
15408
15480
|
payload
|
|
15409
15481
|
} = event;
|
|
15410
|
-
const
|
|
15482
|
+
const {
|
|
15483
|
+
body
|
|
15484
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15411
15485
|
const eventClick = (0,use_event_link_click_handler/* default */.Z)(payload.id);
|
|
15412
15486
|
return (0,jsx_runtime_.jsx)(message_container["default"], splash_objectSpread(splash_objectSpread({
|
|
15413
15487
|
type: "splash",
|
|
@@ -15469,7 +15543,9 @@ const Upload = _ref => {
|
|
|
15469
15543
|
const {
|
|
15470
15544
|
t
|
|
15471
15545
|
} = (0,i18n_hooks.useI18n)();
|
|
15472
|
-
const
|
|
15546
|
+
const {
|
|
15547
|
+
body
|
|
15548
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15473
15549
|
const {
|
|
15474
15550
|
fromClient
|
|
15475
15551
|
} = event.payload;
|
|
@@ -15519,7 +15595,9 @@ const Upload = _ref => {
|
|
|
15519
15595
|
const Cta = ({
|
|
15520
15596
|
event
|
|
15521
15597
|
}) => {
|
|
15522
|
-
const
|
|
15598
|
+
const {
|
|
15599
|
+
body
|
|
15600
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15523
15601
|
const eventClick = (0,use_event_link_click_handler/* default */.Z)(event.payload.id);
|
|
15524
15602
|
const {
|
|
15525
15603
|
emitEvent
|
|
@@ -15911,7 +15989,9 @@ const getItemLabel = item => item.title;
|
|
|
15911
15989
|
const CarouselMessage = ({
|
|
15912
15990
|
event
|
|
15913
15991
|
}) => {
|
|
15914
|
-
const
|
|
15992
|
+
const {
|
|
15993
|
+
body
|
|
15994
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15915
15995
|
const slides = body.cards;
|
|
15916
15996
|
return (0,jsx_runtime_.jsx)(message_container["default"], {
|
|
15917
15997
|
event: event,
|
|
@@ -15942,7 +16022,9 @@ function card_message_defineProperty(obj, key, value) { if (key in obj) { Object
|
|
|
15942
16022
|
const CardMessage = ({
|
|
15943
16023
|
event
|
|
15944
16024
|
}) => {
|
|
15945
|
-
const
|
|
16025
|
+
const {
|
|
16026
|
+
body
|
|
16027
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15946
16028
|
const descriptionId = (0,seamly_hooks.useGeneratedId)();
|
|
15947
16029
|
return (0,jsx_runtime_.jsx)(message_container["default"], {
|
|
15948
16030
|
type: "card",
|
|
@@ -15986,11 +16068,14 @@ function conversation_suggestions_objectWithoutPropertiesLoose(source, excluded)
|
|
|
15986
16068
|
|
|
15987
16069
|
|
|
15988
16070
|
|
|
16071
|
+
|
|
15989
16072
|
const useSuggestions = event => {
|
|
15990
16073
|
const {
|
|
15991
16074
|
payload
|
|
15992
16075
|
} = event;
|
|
15993
|
-
const
|
|
16076
|
+
const {
|
|
16077
|
+
body: suggestions
|
|
16078
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15994
16079
|
return {
|
|
15995
16080
|
suggestions,
|
|
15996
16081
|
payload
|
|
@@ -16014,6 +16099,9 @@ const ConversationSuggestions = _ref => {
|
|
|
16014
16099
|
suggestions,
|
|
16015
16100
|
payload
|
|
16016
16101
|
} = useSuggestions(event);
|
|
16102
|
+
const {
|
|
16103
|
+
showSuggestions
|
|
16104
|
+
} = (0,hooks.useConfig)();
|
|
16017
16105
|
const events = (0,seamly_hooks.useEvents)();
|
|
16018
16106
|
const {
|
|
16019
16107
|
t
|
|
@@ -16024,7 +16112,7 @@ const ConversationSuggestions = _ref => {
|
|
|
16024
16112
|
|
|
16025
16113
|
const hasLastTransactionEvent = (0,hooks_.useMemo)(() => events.some(({
|
|
16026
16114
|
payload: eventPayload
|
|
16027
|
-
}) => eventPayload
|
|
16115
|
+
}) => eventPayload?.transactionLast), [events]);
|
|
16028
16116
|
const handleClick = (0,hooks_.useCallback)(({
|
|
16029
16117
|
id,
|
|
16030
16118
|
question
|
|
@@ -16046,7 +16134,7 @@ const ConversationSuggestions = _ref => {
|
|
|
16046
16134
|
addMessageBubble(question);
|
|
16047
16135
|
}, [dispatch, sendAction, payload.id, addMessageBubble]);
|
|
16048
16136
|
|
|
16049
|
-
if (!isExpanded || userHasResponded || !hasLastTransactionEvent) {
|
|
16137
|
+
if (!isExpanded || userHasResponded || !hasLastTransactionEvent || !showSuggestions) {
|
|
16050
16138
|
return null;
|
|
16051
16139
|
}
|
|
16052
16140
|
|
|
@@ -16205,6 +16293,8 @@ const PrivacyDisclaimer = () => {
|
|
|
16205
16293
|
};
|
|
16206
16294
|
|
|
16207
16295
|
/* harmony default export */ const privacy_disclaimer = (PrivacyDisclaimer);
|
|
16296
|
+
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/focus-helper-hooks.js
|
|
16297
|
+
var focus_helper_hooks = __webpack_require__(8956);
|
|
16208
16298
|
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/seamly-hooks.js + 2 modules
|
|
16209
16299
|
var seamly_hooks = __webpack_require__(2849);
|
|
16210
16300
|
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
@@ -16317,6 +16407,7 @@ const Loader = () => {
|
|
|
16317
16407
|
|
|
16318
16408
|
|
|
16319
16409
|
|
|
16410
|
+
|
|
16320
16411
|
const Events = () => {
|
|
16321
16412
|
const events = (0,seamly_state_hooks.useEvents)();
|
|
16322
16413
|
let prevParticipant = null;
|
|
@@ -16361,11 +16452,15 @@ const Conversation = () => {
|
|
|
16361
16452
|
const skiplinkTargetId = (0,seamly_hooks.useSkiplink)();
|
|
16362
16453
|
const focusSkiplinkTarget = (0,seamly_hooks.useSkiplinkTargetFocusing)();
|
|
16363
16454
|
const loadedImageEventIds = (0,seamly_state_hooks.useLoadedImageEventIds)();
|
|
16364
|
-
(0,hooks_.
|
|
16455
|
+
(0,hooks_.useLayoutEffect)(() => {
|
|
16365
16456
|
const containerElement = chatBodyContainer.current;
|
|
16366
16457
|
|
|
16367
16458
|
if (containerElement) {
|
|
16368
|
-
|
|
16459
|
+
requestAnimationFrame(async () => {
|
|
16460
|
+
await (0,focus_helper_hooks/* timeout */.Vs)(30); // Wait for next frame tick
|
|
16461
|
+
|
|
16462
|
+
containerElement.scrollTop = containerElement.scrollHeight;
|
|
16463
|
+
});
|
|
16369
16464
|
}
|
|
16370
16465
|
}, [events, isLoading, isOpen, loadedImageEventIds]);
|
|
16371
16466
|
|
|
@@ -16524,16 +16619,16 @@ const useChoicePrompt = event => {
|
|
|
16524
16619
|
activeServiceSessionId
|
|
16525
16620
|
} = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_2__.useSeamlyServiceInfo)();
|
|
16526
16621
|
const lastEventId = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_2__.useLastMessageEventId)();
|
|
16527
|
-
const
|
|
16622
|
+
const {
|
|
16623
|
+
body
|
|
16624
|
+
} = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_7__.useTranslatedEventData)(event);
|
|
16528
16625
|
const {
|
|
16529
16626
|
service
|
|
16530
16627
|
} = payload;
|
|
16531
16628
|
const subEvent = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => {
|
|
16532
|
-
var _event$payload$body;
|
|
16533
|
-
|
|
16534
16629
|
return _objectSpread(_objectSpread({}, event), {}, {
|
|
16535
16630
|
payload: _objectSpread(_objectSpread({}, event.payload), {}, {
|
|
16536
|
-
body:
|
|
16631
|
+
body: event.payload.body?.prompt,
|
|
16537
16632
|
translatedBody: event.payload.translatedBody && _objectSpread(_objectSpread({}, event.payload.translatedBody), {}, {
|
|
16538
16633
|
data: event.payload.translatedBody.data.prompt
|
|
16539
16634
|
})
|
|
@@ -16679,13 +16774,11 @@ const timeFormatOptions = {
|
|
|
16679
16774
|
minute: 'numeric'
|
|
16680
16775
|
};
|
|
16681
16776
|
const useFormattedDate = date => {
|
|
16682
|
-
var _config$context;
|
|
16683
|
-
|
|
16684
16777
|
const {
|
|
16685
16778
|
t
|
|
16686
16779
|
} = (0,hooks.useI18n)();
|
|
16687
16780
|
const config = (0,config_hooks.useConfig)();
|
|
16688
|
-
const locale =
|
|
16781
|
+
const locale = config?.context?.locale ?? [];
|
|
16689
16782
|
const eventDate = new Date(date);
|
|
16690
16783
|
const currentDate = new Date();
|
|
16691
16784
|
const midnight = new Date(currentDate);
|
|
@@ -16925,7 +17018,9 @@ const Text = _ref => {
|
|
|
16925
17018
|
} = _ref,
|
|
16926
17019
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16927
17020
|
|
|
16928
|
-
const
|
|
17021
|
+
const {
|
|
17022
|
+
body
|
|
17023
|
+
} = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_2__.useTranslatedEventData)(event);
|
|
16929
17024
|
const eventClick = (0,_hooks_use_event_link_click_handler__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(event.payload.id);
|
|
16930
17025
|
const containerProps = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
|
|
16931
17026
|
if (event.payload.optimisticallyInjected) {
|
|
@@ -16966,12 +17061,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
16966
17061
|
/* harmony import */ var lib_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5567);
|
|
16967
17062
|
/* harmony import */ var ui_hooks_component_helper_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3357);
|
|
16968
17063
|
/* harmony import */ var domains_translations_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2108);
|
|
16969
|
-
/* harmony import */ var
|
|
16970
|
-
/* harmony import */ var
|
|
16971
|
-
/* harmony import */ var
|
|
16972
|
-
|
|
16973
|
-
/* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
|
|
16974
|
-
const _excluded = ["showParticipant", "showTranslationToggle", "event", "type", "modifiers", "children", "bodyProps", "info"];
|
|
17064
|
+
/* harmony import */ var _event_event_participant__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7409);
|
|
17065
|
+
/* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7844);
|
|
17066
|
+
/* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
|
|
17067
|
+
const _excluded = ["showParticipant", "event", "type", "modifiers", "children", "bodyProps", "info"];
|
|
16975
17068
|
|
|
16976
17069
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16977
17070
|
|
|
@@ -16991,11 +17084,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16991
17084
|
|
|
16992
17085
|
|
|
16993
17086
|
|
|
16994
|
-
|
|
16995
17087
|
function MessageContainer(_ref) {
|
|
16996
17088
|
let {
|
|
16997
17089
|
showParticipant = true,
|
|
16998
|
-
showTranslationToggle = true,
|
|
16999
17090
|
event,
|
|
17000
17091
|
type,
|
|
17001
17092
|
modifiers,
|
|
@@ -17007,14 +17098,10 @@ function MessageContainer(_ref) {
|
|
|
17007
17098
|
|
|
17008
17099
|
const classNames = (0,ui_hooks_component_helper_hooks__WEBPACK_IMPORTED_MODULE_1__/* .useSeamlyMessageContainerClassNames */ .j)(event);
|
|
17009
17100
|
const {
|
|
17010
|
-
t
|
|
17011
|
-
} = (0,domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_3__.useI18n)();
|
|
17012
|
-
const [, {
|
|
17013
17101
|
hasTranslation,
|
|
17014
17102
|
isTranslated,
|
|
17015
|
-
toggleTranslation,
|
|
17016
17103
|
locale
|
|
17017
|
-
}
|
|
17104
|
+
} = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_2__.useTranslatedEventData)(event);
|
|
17018
17105
|
|
|
17019
17106
|
if (type) {
|
|
17020
17107
|
classNames.push(`message--type-${type}`);
|
|
@@ -17046,27 +17133,20 @@ function MessageContainer(_ref) {
|
|
|
17046
17133
|
});
|
|
17047
17134
|
}
|
|
17048
17135
|
|
|
17049
|
-
return (0,
|
|
17050
|
-
children: (0,
|
|
17136
|
+
return (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
|
|
17137
|
+
children: (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", _objectSpread(_objectSpread({
|
|
17051
17138
|
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_0__.className)(classNames)
|
|
17052
17139
|
}, props), {}, {
|
|
17053
|
-
children: [showParticipant && (0,
|
|
17140
|
+
children: [showParticipant && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_event_event_participant__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
|
17054
17141
|
eventPayload: event.payload
|
|
17055
|
-
}), (0,
|
|
17142
|
+
}), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", _objectSpread(_objectSpread({
|
|
17056
17143
|
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_0__.className)('message__body')
|
|
17057
17144
|
}, bodyProps), {}, {
|
|
17058
17145
|
children: children
|
|
17059
|
-
})), info && (0,
|
|
17146
|
+
})), info && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
|
|
17060
17147
|
"aria-hidden": "true",
|
|
17061
17148
|
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_0__.className)('message__info'),
|
|
17062
17149
|
children: info
|
|
17063
|
-
}), showTranslationToggle && hasTranslation && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
|
|
17064
|
-
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_0__.className)('message__translation-info'),
|
|
17065
|
-
children: (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("button", {
|
|
17066
|
-
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_0__.className)('message__translation-toggle', 'button', 'button--secondary'),
|
|
17067
|
-
onClick: toggleTranslation,
|
|
17068
|
-
children: t(isTranslated ? 'translations.toggle.hideButtonText' : 'translations.toggle.showButtonText')
|
|
17069
|
-
})
|
|
17070
17150
|
})]
|
|
17071
17151
|
}))
|
|
17072
17152
|
});
|
|
@@ -18683,7 +18763,7 @@ const AgentInfo = () => {
|
|
|
18683
18763
|
hasInterrupt
|
|
18684
18764
|
} = (0,domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3__.useInterrupt)();
|
|
18685
18765
|
const startChatIcon = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_4__.useStartChatIcon)();
|
|
18686
|
-
const src =
|
|
18766
|
+
const src = currentAgent?.avatar ?? startChatIcon;
|
|
18687
18767
|
const displaySubtitle = hasInterrupt ? '' : subTitle;
|
|
18688
18768
|
const classNames = ['message-count'];
|
|
18689
18769
|
|
|
@@ -18700,7 +18780,7 @@ const AgentInfo = () => {
|
|
|
18700
18780
|
children: [(0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
|
|
18701
18781
|
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_1__.className)('agent-info__graphic'),
|
|
18702
18782
|
children: [src ? (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("img", {
|
|
18703
|
-
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_1__.className)(currentAgent
|
|
18783
|
+
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_1__.className)(currentAgent?.avatar ? 'avatar' : 'icon'),
|
|
18704
18784
|
src: src,
|
|
18705
18785
|
alt: ""
|
|
18706
18786
|
}) : (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icon__WEBPACK_IMPORTED_MODULE_6__["default"], {
|
|
@@ -19034,11 +19114,7 @@ const OptionsButton = () => {
|
|
|
19034
19114
|
const prevMenuIsOpen = (0,hooks_.useRef)(false);
|
|
19035
19115
|
const multiMenu = optionsLength > 1;
|
|
19036
19116
|
const firstOption = menuOptions[0];
|
|
19037
|
-
const firstOptionName = (0,hooks_.useMemo)(() =>
|
|
19038
|
-
var _firstOption$name;
|
|
19039
|
-
|
|
19040
|
-
return firstOption === null || firstOption === void 0 ? void 0 : (_firstOption$name = firstOption.name) === null || _firstOption$name === void 0 ? void 0 : _firstOption$name.trim().replace(/\s+/g, '');
|
|
19041
|
-
}, [firstOption]);
|
|
19117
|
+
const firstOptionName = (0,hooks_.useMemo)(() => firstOption?.name?.trim().replace(/\s+/g, ''), [firstOption]);
|
|
19042
19118
|
(0,hooks_.useEffect)(() => {
|
|
19043
19119
|
return () => {
|
|
19044
19120
|
clearTimeout(focusOutDelayTimeoutID.current);
|
|
@@ -19047,7 +19123,7 @@ const OptionsButton = () => {
|
|
|
19047
19123
|
(0,hooks_.useEffect)(() => {
|
|
19048
19124
|
if (menuIsOpen && !prevMenuIsOpen.current) {
|
|
19049
19125
|
requestAnimationFrame(async () => {
|
|
19050
|
-
await (0,focus_helper_hooks/* timeout */.Vs)(
|
|
19126
|
+
await (0,focus_helper_hooks/* timeout */.Vs)(60); // Wait for next frame tick
|
|
19051
19127
|
|
|
19052
19128
|
const firstActiveOptionIndex = menuOptions.findIndex(option => option.available);
|
|
19053
19129
|
const focusIndex = firstActiveOptionIndex === -1 ? 0 : firstActiveOptionIndex;
|
|
@@ -20107,30 +20183,32 @@ const Interrupt = ({
|
|
|
20107
20183
|
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
20108
20184
|
/* harmony export */ });
|
|
20109
20185
|
/* harmony import */ var domains_app_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9279);
|
|
20110
|
-
/* harmony import */ var
|
|
20111
|
-
/* harmony import */ var
|
|
20112
|
-
/* harmony import */ var
|
|
20113
|
-
/* harmony import */ var
|
|
20114
|
-
/* harmony import */ var
|
|
20115
|
-
/* harmony import */ var
|
|
20116
|
-
/* harmony import */ var
|
|
20117
|
-
/* harmony import */ var
|
|
20118
|
-
/* harmony import */ var
|
|
20119
|
-
/* harmony import */ var
|
|
20120
|
-
/* harmony import */ var
|
|
20121
|
-
/* harmony import */ var
|
|
20122
|
-
/* harmony import */ var
|
|
20123
|
-
/* harmony import */ var
|
|
20124
|
-
/* harmony import */ var
|
|
20125
|
-
/* harmony import */ var
|
|
20126
|
-
/* harmony import */ var
|
|
20127
|
-
/* harmony import */ var
|
|
20128
|
-
/* harmony import */ var
|
|
20129
|
-
/* harmony import */ var
|
|
20130
|
-
/* harmony import */ var
|
|
20131
|
-
/* harmony import */ var
|
|
20132
|
-
/* harmony import */ var
|
|
20133
|
-
/* harmony import */ var
|
|
20186
|
+
/* harmony import */ var domains_config_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6065);
|
|
20187
|
+
/* harmony import */ var domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(546);
|
|
20188
|
+
/* harmony import */ var domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2__);
|
|
20189
|
+
/* harmony import */ var domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8877);
|
|
20190
|
+
/* harmony import */ var domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3__);
|
|
20191
|
+
/* harmony import */ var domains_translations_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2108);
|
|
20192
|
+
/* harmony import */ var domains_visibility_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2629);
|
|
20193
|
+
/* harmony import */ var domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3742);
|
|
20194
|
+
/* harmony import */ var domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_6__);
|
|
20195
|
+
/* harmony import */ var lib_css__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(5567);
|
|
20196
|
+
/* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9207);
|
|
20197
|
+
/* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(preact_hooks__WEBPACK_IMPORTED_MODULE_8__);
|
|
20198
|
+
/* harmony import */ var ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2841);
|
|
20199
|
+
/* harmony import */ var ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(1433);
|
|
20200
|
+
/* harmony import */ var ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8956);
|
|
20201
|
+
/* harmony import */ var ui_hooks_live_region_hooks__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6639);
|
|
20202
|
+
/* harmony import */ var ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4809);
|
|
20203
|
+
/* harmony import */ var ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(4431);
|
|
20204
|
+
/* harmony import */ var ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(1154);
|
|
20205
|
+
/* harmony import */ var ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(1256);
|
|
20206
|
+
/* harmony import */ var ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(5029);
|
|
20207
|
+
/* harmony import */ var ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(4959);
|
|
20208
|
+
/* harmony import */ var ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(5740);
|
|
20209
|
+
/* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(7844);
|
|
20210
|
+
/* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__);
|
|
20211
|
+
|
|
20134
20212
|
|
|
20135
20213
|
|
|
20136
20214
|
|
|
@@ -20159,64 +20237,69 @@ const Suggestions = ({
|
|
|
20159
20237
|
// generic hooks
|
|
20160
20238
|
const {
|
|
20161
20239
|
isInline
|
|
20162
|
-
} = (0,
|
|
20240
|
+
} = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_13__.useSeamlyLayoutMode)();
|
|
20163
20241
|
const {
|
|
20164
20242
|
t
|
|
20165
|
-
} = (0,
|
|
20243
|
+
} = (0,domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2__.useI18n)();
|
|
20166
20244
|
const {
|
|
20167
20245
|
sendAction,
|
|
20168
20246
|
addMessageBubble
|
|
20169
|
-
} = (0,
|
|
20247
|
+
} = (0,ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z)();
|
|
20170
20248
|
const {
|
|
20171
20249
|
isOpen,
|
|
20172
20250
|
setVisibility
|
|
20173
|
-
} = (0,
|
|
20251
|
+
} = (0,domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_6__.useVisibility)();
|
|
20252
|
+
const {
|
|
20253
|
+
showSuggestions
|
|
20254
|
+
} = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_1__.useConfig)(); // a11y hooks
|
|
20174
20255
|
|
|
20175
|
-
const sectionId = (0,
|
|
20176
|
-
const focusSkiplinkTarget = (0,
|
|
20177
|
-
const containerRef = (0,
|
|
20256
|
+
const sectionId = (0,ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_17__/* .useGeneratedId */ .I8)();
|
|
20257
|
+
const focusSkiplinkTarget = (0,ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_11__/* .useSkiplinkTargetFocusing */ .MI)();
|
|
20258
|
+
const containerRef = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)(null);
|
|
20178
20259
|
const {
|
|
20179
20260
|
sendPolite
|
|
20180
|
-
} = (0,
|
|
20261
|
+
} = (0,ui_hooks_live_region_hooks__WEBPACK_IMPORTED_MODULE_12__/* .useLiveRegion */ .t)(); // interrupt & countdown hooks
|
|
20181
20262
|
|
|
20182
20263
|
const {
|
|
20183
20264
|
hasInterrupt
|
|
20184
|
-
} = (0,
|
|
20265
|
+
} = (0,domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3__.useInterrupt)();
|
|
20185
20266
|
const {
|
|
20186
20267
|
hasCountdown,
|
|
20187
20268
|
endCountdown
|
|
20188
|
-
} = (0,
|
|
20269
|
+
} = (0,ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z)();
|
|
20189
20270
|
const {
|
|
20190
20271
|
hasPrompt,
|
|
20191
20272
|
continueChat
|
|
20192
|
-
} = (0,
|
|
20273
|
+
} = (0,ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z)(); // data hooks
|
|
20193
20274
|
|
|
20194
20275
|
const userHasResponded = (0,domains_app_hooks__WEBPACK_IMPORTED_MODULE_0__/* .useUserHasResponded */ .h)();
|
|
20195
|
-
const payload = (0,
|
|
20196
|
-
const
|
|
20276
|
+
const payload = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_13__.useSeamlyServiceData)('suggestion');
|
|
20277
|
+
const {
|
|
20278
|
+
body: eventBody
|
|
20279
|
+
} = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_4__.useTranslatedEventData)({
|
|
20197
20280
|
payload
|
|
20198
20281
|
});
|
|
20199
|
-
const suggestions = (0,
|
|
20200
|
-
const prevSuggestions = (0,
|
|
20201
|
-
const prevHasSuggestions = (0,
|
|
20202
|
-
const previousRenderedSuggestions = (0,
|
|
20282
|
+
const suggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useMemo)(() => payload && !hasInterrupt ? eventBody : [], [payload, hasInterrupt, eventBody]);
|
|
20283
|
+
const prevSuggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)(null);
|
|
20284
|
+
const prevHasSuggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)(false);
|
|
20285
|
+
const previousRenderedSuggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)([]);
|
|
20203
20286
|
const hasSuggestions = !!suggestions.length;
|
|
20204
20287
|
const hideSuggestions = isInline ? (userHasResponded || isOpen) && !isAside : userHasResponded;
|
|
20205
|
-
const prevHideSuggestions = (0,
|
|
20206
|
-
const showSuggestionsContainer = hasSuggestions && !hideSuggestions;
|
|
20288
|
+
const prevHideSuggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)(hideSuggestions);
|
|
20289
|
+
const showSuggestionsContainer = hasSuggestions && !hideSuggestions && showSuggestions;
|
|
20207
20290
|
const renderedSuggestions = hasSuggestions ? suggestions : previousRenderedSuggestions.current;
|
|
20208
20291
|
previousRenderedSuggestions.current = renderedSuggestions;
|
|
20209
|
-
const suggestionsClassNames = (0,
|
|
20292
|
+
const suggestionsClassNames = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useMemo)(() => {
|
|
20210
20293
|
const classNames = ['suggestions'];
|
|
20211
20294
|
|
|
20212
20295
|
if (isAside) {
|
|
20213
20296
|
classNames.push('suggestions--aside');
|
|
20214
20297
|
}
|
|
20215
20298
|
|
|
20216
|
-
return (0,
|
|
20299
|
+
return (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)(classNames);
|
|
20217
20300
|
}, [isAside]); // click handler
|
|
20218
20301
|
|
|
20219
|
-
const handleClick = (0,
|
|
20302
|
+
const handleClick = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useCallback)(({
|
|
20220
20303
|
id,
|
|
20221
20304
|
question
|
|
20222
20305
|
}) => {
|
|
@@ -20230,7 +20313,7 @@ const Suggestions = ({
|
|
|
20230
20313
|
|
|
20231
20314
|
|
|
20232
20315
|
sendAction({
|
|
20233
|
-
type:
|
|
20316
|
+
type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_19__.actionTypes.custom,
|
|
20234
20317
|
originMessage: payload.id,
|
|
20235
20318
|
body: {
|
|
20236
20319
|
type: 'faqclick',
|
|
@@ -20243,12 +20326,12 @@ const Suggestions = ({
|
|
|
20243
20326
|
addMessageBubble(question);
|
|
20244
20327
|
|
|
20245
20328
|
if (!isOpen) {
|
|
20246
|
-
setVisibility(
|
|
20329
|
+
setVisibility(domains_visibility_constants__WEBPACK_IMPORTED_MODULE_5__.visibilityStates.open);
|
|
20247
20330
|
}
|
|
20248
20331
|
|
|
20249
20332
|
focusSkiplinkTarget();
|
|
20250
20333
|
}, [addMessageBubble, continueChat, endCountdown, focusSkiplinkTarget, hasCountdown, hasPrompt, payload, sendAction, setVisibility, isOpen]);
|
|
20251
|
-
(0,
|
|
20334
|
+
(0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useEffect)(() => {
|
|
20252
20335
|
if (prevSuggestions.current !== suggestions && !hideSuggestions) {
|
|
20253
20336
|
if (hasSuggestions) {
|
|
20254
20337
|
const politeText = prevHasSuggestions.current ? t('suggestions.srUpdatedText') : t('suggestions.srAvailableText');
|
|
@@ -20263,10 +20346,10 @@ const Suggestions = ({
|
|
|
20263
20346
|
}
|
|
20264
20347
|
|
|
20265
20348
|
if (!prevHideSuggestions.current && hideSuggestions) {
|
|
20266
|
-
(0,
|
|
20349
|
+
(0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_18__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
|
|
20267
20350
|
sendPolite(t('suggestions.srUnavailableText'));
|
|
20268
20351
|
} else if (!hasSuggestions && prevHasSuggestions.current) {
|
|
20269
|
-
(0,
|
|
20352
|
+
(0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_18__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
|
|
20270
20353
|
}
|
|
20271
20354
|
|
|
20272
20355
|
prevHasSuggestions.current = hasSuggestions;
|
|
@@ -20275,22 +20358,22 @@ const Suggestions = ({
|
|
|
20275
20358
|
const headingText = t('suggestions.headingText');
|
|
20276
20359
|
const footerText = t('suggestions.footerText');
|
|
20277
20360
|
const ContainerElement = headingText ? 'section' : 'div';
|
|
20278
|
-
return (0,
|
|
20361
|
+
return (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsx)(ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, {
|
|
20279
20362
|
isActive: showSuggestionsContainer,
|
|
20280
|
-
transitionStartState:
|
|
20281
|
-
children: (0,
|
|
20363
|
+
transitionStartState: ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_10__/* .transitionStartStates.notRendered */ .I.notRendered,
|
|
20364
|
+
children: (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsxs)(ContainerElement, {
|
|
20282
20365
|
className: suggestionsClassNames,
|
|
20283
20366
|
"aria-labelledby": headingText ? sectionId : null,
|
|
20284
20367
|
ref: containerRef,
|
|
20285
|
-
children: [headingText && (0,
|
|
20368
|
+
children: [headingText && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsx)("p", {
|
|
20286
20369
|
id: sectionId,
|
|
20287
|
-
className: (0,
|
|
20370
|
+
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)('suggestions__heading'),
|
|
20288
20371
|
children: headingText
|
|
20289
|
-
}), !!renderedSuggestions.length && (0,
|
|
20372
|
+
}), !!renderedSuggestions.length && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsx)(ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
20290
20373
|
suggestions: renderedSuggestions,
|
|
20291
20374
|
onClickSuggestion: handleClick
|
|
20292
|
-
}), footerText && !isOpen && (0,
|
|
20293
|
-
className: (0,
|
|
20375
|
+
}), footerText && !isOpen && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsx)("p", {
|
|
20376
|
+
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)('suggestions__footer'),
|
|
20294
20377
|
children: footerText
|
|
20295
20378
|
})]
|
|
20296
20379
|
})
|
|
@@ -20500,7 +20583,9 @@ const Faq = () => {
|
|
|
20500
20583
|
continueChat
|
|
20501
20584
|
} = (0,use_seamly_resume_conversation_prompt/* default */.Z)();
|
|
20502
20585
|
const lastFaqEventPayload = (0,seamly_state_hooks.useSeamlyServiceData)('suggestion');
|
|
20503
|
-
const
|
|
20586
|
+
const {
|
|
20587
|
+
body: eventBody
|
|
20588
|
+
} = (0,translations_hooks.useTranslatedEventData)({
|
|
20504
20589
|
payload: lastFaqEventPayload
|
|
20505
20590
|
});
|
|
20506
20591
|
const faqs = (0,hooks_.useMemo)(() => {
|
|
@@ -20867,7 +20952,7 @@ function PreChatMessages() {
|
|
|
20867
20952
|
const {
|
|
20868
20953
|
isOpen
|
|
20869
20954
|
} = (0,visibility_hooks.useVisibility)();
|
|
20870
|
-
const isVisible = !(hasInterrupt || !
|
|
20955
|
+
const isVisible = !(hasInterrupt || !preChatEvents?.length || isOpen);
|
|
20871
20956
|
return isVisible && (0,jsx_runtime_.jsx)("ul", {
|
|
20872
20957
|
className: (0,css.className)('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
|
|
20873
20958
|
"aria-hidden": !isVisible,
|
|
@@ -21805,11 +21890,13 @@ const useSeamlyEventStream = (nextFn, filterFn) => {
|
|
|
21805
21890
|
"use strict";
|
|
21806
21891
|
__webpack_require__.r(__webpack_exports__);
|
|
21807
21892
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
21893
|
+
/* harmony export */ "selectEventIds": () => (/* binding */ selectEventIds),
|
|
21808
21894
|
/* harmony export */ "selectEvents": () => (/* binding */ selectEvents),
|
|
21809
21895
|
/* harmony export */ "selectEventsWithSuggestion": () => (/* binding */ selectEventsWithSuggestion),
|
|
21810
21896
|
/* harmony export */ "selectState": () => (/* binding */ selectState),
|
|
21811
21897
|
/* harmony export */ "useEntryTextLimit": () => (/* binding */ useEntryTextLimit),
|
|
21812
21898
|
/* harmony export */ "useEvents": () => (/* binding */ useEvents),
|
|
21899
|
+
/* harmony export */ "useEventsIds": () => (/* binding */ useEventsIds),
|
|
21813
21900
|
/* harmony export */ "useLastMessageEventId": () => (/* binding */ useLastMessageEventId),
|
|
21814
21901
|
/* harmony export */ "useLoadedImageEventIds": () => (/* binding */ useLoadedImageEventIds),
|
|
21815
21902
|
/* harmony export */ "useSeamlyCurrentAgent": () => (/* binding */ useSeamlyCurrentAgent),
|
|
@@ -21850,9 +21937,7 @@ const selectEventsWithSuggestion = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_
|
|
|
21850
21937
|
events,
|
|
21851
21938
|
serviceData
|
|
21852
21939
|
}, config, hasUserResponded) => {
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
if (hasUserResponded || config.layoutMode === 'inline' || !(serviceData !== null && serviceData !== void 0 && serviceData.suggestion) || !(serviceData !== null && serviceData !== void 0 && (_serviceData$suggesti = serviceData.suggestion) !== null && _serviceData$suggesti !== void 0 && _serviceData$suggesti.body.length)) {
|
|
21940
|
+
if (hasUserResponded || config.layoutMode === 'inline' || !serviceData?.suggestion || !serviceData?.suggestion?.body.length) {
|
|
21856
21941
|
return events;
|
|
21857
21942
|
}
|
|
21858
21943
|
|
|
@@ -21863,12 +21948,10 @@ const selectEventsWithSuggestion = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_
|
|
|
21863
21948
|
return [...events, suggestionsEvent];
|
|
21864
21949
|
});
|
|
21865
21950
|
const selectEvents = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSelector)(selectEventsWithSuggestion, domains_config_selectors__WEBPACK_IMPORTED_MODULE_0__.selectConfig, (events, config) => {
|
|
21866
|
-
var _config$messages;
|
|
21867
|
-
|
|
21868
21951
|
const {
|
|
21869
21952
|
enabled,
|
|
21870
21953
|
threshold
|
|
21871
|
-
} =
|
|
21954
|
+
} = config?.messages?.timeIndicator ?? {};
|
|
21872
21955
|
|
|
21873
21956
|
if (!enabled) {
|
|
21874
21957
|
return events;
|
|
@@ -21894,6 +21977,10 @@ const selectEvents = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSele
|
|
|
21894
21977
|
return mappedEvents;
|
|
21895
21978
|
});
|
|
21896
21979
|
const useEvents = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(selectEvents);
|
|
21980
|
+
const selectEventIds = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSelector)(selectEvents, events => {
|
|
21981
|
+
return events.map(event => event.payload.id);
|
|
21982
|
+
});
|
|
21983
|
+
const useEventsIds = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(selectEventIds);
|
|
21897
21984
|
const useSeamlyIsLoading = () => useSeamlyStateContext().isLoading;
|
|
21898
21985
|
const useSeamlyHeaderData = () => useSeamlyStateContext().headerTitles;
|
|
21899
21986
|
const useSeamlyUnreadCount = () => useSeamlyStateContext().unreadEvents;
|
|
@@ -21902,10 +21989,8 @@ const useSkiplink = () => useSeamlyStateContext().skiplinkTargetId;
|
|
|
21902
21989
|
const useSeamlyParticipant = participantId => useSeamlyStateContext().participantInfo.participants[participantId];
|
|
21903
21990
|
const useSeamlyServiceInfo = () => useSeamlyStateContext().serviceInfo;
|
|
21904
21991
|
const selectLastMessageEventId = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSelector)(selectEvents, events => {
|
|
21905
|
-
var _filteredEvents;
|
|
21906
|
-
|
|
21907
21992
|
const filteredEvents = events.filter(event => event.type === 'message');
|
|
21908
|
-
return
|
|
21993
|
+
return filteredEvents[filteredEvents.length - 1]?.payload.id;
|
|
21909
21994
|
});
|
|
21910
21995
|
const useLastMessageEventId = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(selectLastMessageEventId);
|
|
21911
21996
|
const useSeamlyIsHistoryLoaded = () => useSeamlyStateContext().historyLoaded;
|
|
@@ -22051,7 +22136,6 @@ const useSeamlyChat = () => {
|
|
|
22051
22136
|
} = (0,domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_3__.useVisibility)();
|
|
22052
22137
|
const showInlineView = (0,react_redux__WEBPACK_IMPORTED_MODULE_5__.useSelector)(_domains_visibility_selectors__WEBPACK_IMPORTED_MODULE_6__.selectShowInlineView);
|
|
22053
22138
|
const dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_5__.useDispatch)();
|
|
22054
|
-
const events = (0,_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_9__.useEvents)();
|
|
22055
22139
|
const spinnerTimeout = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_4__.useRef)(null);
|
|
22056
22140
|
const {
|
|
22057
22141
|
start,
|
|
@@ -22066,7 +22150,6 @@ const useSeamlyChat = () => {
|
|
|
22066
22150
|
const {
|
|
22067
22151
|
sendAssertive
|
|
22068
22152
|
} = (0,_live_region_hooks__WEBPACK_IMPORTED_MODULE_7__/* .useLiveRegion */ .t)();
|
|
22069
|
-
const hasEvents = events.length > 0;
|
|
22070
22153
|
(0,preact_hooks__WEBPACK_IMPORTED_MODULE_4__.useEffect)(() => {
|
|
22071
22154
|
if (isVisible) {
|
|
22072
22155
|
// Wait for the live containers to stabilise in the DOM before injecting
|
|
@@ -22100,13 +22183,10 @@ const useSeamlyChat = () => {
|
|
|
22100
22183
|
spinnerTimeout.current = setTimeout(() => {
|
|
22101
22184
|
dispatch((0,domains_store_slice__WEBPACK_IMPORTED_MODULE_1__.setIsLoading)(true));
|
|
22102
22185
|
}, 500);
|
|
22103
|
-
|
|
22104
|
-
(0,preact_hooks__WEBPACK_IMPORTED_MODULE_4__.useEffect)(() => {
|
|
22105
|
-
if (hasEvents) {
|
|
22186
|
+
return () => {
|
|
22106
22187
|
clearTimeout(spinnerTimeout.current);
|
|
22107
|
-
|
|
22108
|
-
|
|
22109
|
-
}, [hasEvents, dispatch]);
|
|
22188
|
+
};
|
|
22189
|
+
}, [dispatch]);
|
|
22110
22190
|
(0,preact_hooks__WEBPACK_IMPORTED_MODULE_4__.useEffect)(() => {
|
|
22111
22191
|
// This is needed to reset the ref to allow connect and start to happen again.
|
|
22112
22192
|
// Mostly due to Interrupt situations and a reset being called.
|
|
@@ -22907,7 +22987,7 @@ const validateFileSize = (fileList, maxSize) => {
|
|
|
22907
22987
|
|
|
22908
22988
|
return isValid;
|
|
22909
22989
|
};
|
|
22910
|
-
const fileListObjectIsNotEmpty = fileListObj => !!
|
|
22990
|
+
const fileListObjectIsNotEmpty = fileListObj => !!fileListObj?.length > 0;
|
|
22911
22991
|
/* eslint-disable no-control-regex */
|
|
22912
22992
|
|
|
22913
22993
|
const isEmailString = val => {
|