@seamly/web-ui 20.8.0-alpha.1 → 20.8.0-beta.1
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 +46 -46
- 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 +351 -260
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +542 -252
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +156 -69
- 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/config/slice.ts +2 -0
- package/src/javascripts/domains/i18n/slice.ts +0 -3
- package/src/javascripts/domains/store/slice.ts +16 -13
- 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 -17
- 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/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
|
@@ -7018,13 +7018,14 @@ exports.initialConfigState = Object.assign(Object.assign({}, config_1.defaultCon
|
|
|
7018
7018
|
connectWhenInView: true,
|
|
7019
7019
|
showDisclaimer: false,
|
|
7020
7020
|
showFaq: false,
|
|
7021
|
+
showSuggestions: true,
|
|
7021
7022
|
customComponents: {},
|
|
7022
7023
|
defaults: {
|
|
7023
7024
|
visible: null
|
|
7024
7025
|
},
|
|
7025
7026
|
preChatEvents: []
|
|
7026
7027
|
});
|
|
7027
|
-
const configKeys = ['hideOnNoUserResponse', 'connectWhenInView', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
|
|
7028
|
+
const configKeys = ['hideOnNoUserResponse', 'connectWhenInView', 'showDisclaimer', 'showFaq', 'showSuggestions', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
|
|
7028
7029
|
|
|
7029
7030
|
const updateState = (state, config) => {
|
|
7030
7031
|
const _a = (0, general_utils_1.pick)(config, configKeys),
|
|
@@ -7654,11 +7655,9 @@ exports.setTranslations = exports.setInitialLocale = exports.i18nSlice = void 0;
|
|
|
7654
7655
|
|
|
7655
7656
|
const toolkit_1 = __webpack_require__(575);
|
|
7656
7657
|
|
|
7657
|
-
const actions_1 = __webpack_require__(
|
|
7658
|
-
|
|
7659
|
-
const actions_2 = __webpack_require__(915);
|
|
7658
|
+
const actions_1 = __webpack_require__(915);
|
|
7660
7659
|
|
|
7661
|
-
const
|
|
7660
|
+
const actions_2 = __webpack_require__(59);
|
|
7662
7661
|
|
|
7663
7662
|
const initialState = {
|
|
7664
7663
|
translations: {
|
|
@@ -7696,15 +7695,11 @@ exports.i18nSlice = (0, toolkit_1.createSlice)({
|
|
|
7696
7695
|
},
|
|
7697
7696
|
extraReducers: builder => {
|
|
7698
7697
|
// Add reducers for additional action types here, and handle loading state as needed
|
|
7699
|
-
builder.addCase(
|
|
7698
|
+
builder.addCase(actions_1.initializeConfig.fulfilled, (state, {
|
|
7700
7699
|
payload
|
|
7701
7700
|
}) => {
|
|
7702
7701
|
state.initialLocale = payload.locale;
|
|
7703
|
-
}).addCase(
|
|
7704
|
-
payload
|
|
7705
|
-
}) => {
|
|
7706
|
-
state.locale = payload.locale;
|
|
7707
|
-
}).addCase(actions_3.setLocale.fulfilled, (state, {
|
|
7702
|
+
}).addCase(actions_2.setLocale.fulfilled, (state, {
|
|
7708
7703
|
payload
|
|
7709
7704
|
}) => {
|
|
7710
7705
|
if (!(payload === null || payload === void 0 ? void 0 : payload.translations)) {
|
|
@@ -8048,7 +8043,7 @@ var _a;
|
|
|
8048
8043
|
Object.defineProperty(exports, "__esModule", ({
|
|
8049
8044
|
value: true
|
|
8050
8045
|
}));
|
|
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;
|
|
8046
|
+
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
8047
|
|
|
8053
8048
|
const toolkit_1 = __webpack_require__(575);
|
|
8054
8049
|
|
|
@@ -8081,6 +8076,8 @@ const orderHistory = events => {
|
|
|
8081
8076
|
}) => occurredAtA - occurredAtB);
|
|
8082
8077
|
};
|
|
8083
8078
|
|
|
8079
|
+
exports.orderHistory = orderHistory;
|
|
8080
|
+
|
|
8084
8081
|
const mergeHistory = (stateEvents, historyEvents) => {
|
|
8085
8082
|
const newStateEvents = stateEvents.filter(stateEvent => // Deduplicate the event streams, giving events in historyEvents
|
|
8086
8083
|
// precedence so the server is able to push changes to events.
|
|
@@ -8091,7 +8088,7 @@ const mergeHistory = (stateEvents, historyEvents) => {
|
|
|
8091
8088
|
// these messages will be shown in the wrong order if not reversed. For
|
|
8092
8089
|
// the normal merging logic there is no added effect.
|
|
8093
8090
|
.reverse();
|
|
8094
|
-
return orderHistory([...newHistoryEvents, ...newStateEvents]);
|
|
8091
|
+
return (0, exports.orderHistory)([...newHistoryEvents, ...newStateEvents]);
|
|
8095
8092
|
};
|
|
8096
8093
|
|
|
8097
8094
|
exports.mergeHistory = mergeHistory;
|
|
@@ -8280,7 +8277,8 @@ exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
|
8280
8277
|
} = payload;
|
|
8281
8278
|
|
|
8282
8279
|
if (matchedEvent) {
|
|
8283
|
-
state.events =
|
|
8280
|
+
state.events = (0, exports.orderHistory)( //@ts-ignore
|
|
8281
|
+
state.events.map(m => m.payload.id === matchedEvent.payload.id ? Object.assign(Object.assign({}, m), {
|
|
8284
8282
|
payload: Object.assign(Object.assign({}, m.payload), {
|
|
8285
8283
|
id,
|
|
8286
8284
|
occurredAt
|
|
@@ -8340,9 +8338,11 @@ exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
|
8340
8338
|
}
|
|
8341
8339
|
|
|
8342
8340
|
const {
|
|
8343
|
-
entry
|
|
8344
|
-
uploads
|
|
8341
|
+
entry
|
|
8345
8342
|
} = activeServiceSettings;
|
|
8343
|
+
const {
|
|
8344
|
+
upload
|
|
8345
|
+
} = entry.options;
|
|
8346
8346
|
const historyNewEntryMeta = calculateNewEntryMeta(Object.assign(Object.assign(Object.assign({}, state.entryMeta), entry), {
|
|
8347
8347
|
active: entry.default || seamly_utils_1.payloadTypes.text,
|
|
8348
8348
|
options: Object.assign({}, entry && entry.options ? entry.options : {})
|
|
@@ -8357,7 +8357,7 @@ exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
|
8357
8357
|
const entryType = ((_a = lastParticipantEventPayload === null || lastParticipantEventPayload === void 0 ? void 0 : lastParticipantEventPayload.entry) === null || _a === void 0 ? void 0 : _a.type) || {};
|
|
8358
8358
|
newFeatures = Object.assign(Object.assign({}, newFeatures), {
|
|
8359
8359
|
uploads: {
|
|
8360
|
-
enabled: !!(
|
|
8360
|
+
enabled: !!(upload && upload.enabled),
|
|
8361
8361
|
enabledFromEntry: entryType === seamly_utils_1.entryTypes.upload
|
|
8362
8362
|
}
|
|
8363
8363
|
});
|
|
@@ -8445,8 +8445,8 @@ exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
|
8445
8445
|
setActiveService: (state, {
|
|
8446
8446
|
payload
|
|
8447
8447
|
}) => {
|
|
8448
|
-
if (state.serviceInfo.activeServiceSessionId !== payload
|
|
8449
|
-
state.serviceInfo.activeServiceSessionId = payload
|
|
8448
|
+
if (state.serviceInfo.activeServiceSessionId !== payload) {
|
|
8449
|
+
state.serviceInfo.activeServiceSessionId = payload;
|
|
8450
8450
|
}
|
|
8451
8451
|
},
|
|
8452
8452
|
setHeaderTitle: (state, {
|
|
@@ -8638,7 +8638,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8638
8638
|
}));
|
|
8639
8639
|
exports.useLocaleNativeName = exports.useTranslationsContainer = exports.useTranslatedEventData = exports.useTranslations = void 0;
|
|
8640
8640
|
|
|
8641
|
-
const selectors_1 = __webpack_require__(
|
|
8641
|
+
const selectors_1 = __webpack_require__(6787);
|
|
8642
8642
|
|
|
8643
8643
|
const slice_1 = __webpack_require__(841);
|
|
8644
8644
|
|
|
@@ -8655,7 +8655,7 @@ function useTranslations() {
|
|
|
8655
8655
|
sendAction
|
|
8656
8656
|
} = (0, seamly_hooks_1.useSeamlyCommands)();
|
|
8657
8657
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
8658
|
-
const enableTranslations = (0,
|
|
8658
|
+
const enableTranslations = (0, hooks_1.useCallback)(locale => {
|
|
8659
8659
|
sendAction({
|
|
8660
8660
|
type: seamly_utils_1.actionTypes.setTranslation,
|
|
8661
8661
|
body: {
|
|
@@ -8664,18 +8664,15 @@ function useTranslations() {
|
|
|
8664
8664
|
}
|
|
8665
8665
|
});
|
|
8666
8666
|
dispatch((0, slice_1.enableTranslation)(locale));
|
|
8667
|
-
},
|
|
8668
|
-
|
|
8669
|
-
[sendAction, dispatch]);
|
|
8670
|
-
const disableTranslations = (0, seamly_hooks_1.useStableCallback)(() => {
|
|
8667
|
+
}, [sendAction, dispatch]);
|
|
8668
|
+
const disableTranslations = (0, hooks_1.useCallback)(() => {
|
|
8671
8669
|
sendAction({
|
|
8672
8670
|
type: seamly_utils_1.actionTypes.setTranslation,
|
|
8673
8671
|
body: {
|
|
8674
8672
|
enabled: false
|
|
8675
8673
|
}
|
|
8676
8674
|
});
|
|
8677
|
-
dispatch((0, slice_1.disableTranslation)());
|
|
8678
|
-
// @ts-ignore
|
|
8675
|
+
dispatch((0, slice_1.disableTranslation)());
|
|
8679
8676
|
}, [sendAction, dispatch]);
|
|
8680
8677
|
const {
|
|
8681
8678
|
languages,
|
|
@@ -8697,44 +8694,40 @@ function useTranslations() {
|
|
|
8697
8694
|
|
|
8698
8695
|
exports.useTranslations = useTranslations;
|
|
8699
8696
|
|
|
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;
|
|
8697
|
+
function useTranslatedEventData(channelEvent) {
|
|
8698
|
+
const getTranslations = () => {
|
|
8699
|
+
var _a, _b, _c;
|
|
8712
8700
|
|
|
8713
|
-
|
|
8714
|
-
body
|
|
8715
|
-
translatedBody
|
|
8716
|
-
|
|
8701
|
+
if (!channelEvent.payload) return {
|
|
8702
|
+
body: undefined,
|
|
8703
|
+
translatedBody: undefined
|
|
8704
|
+
};
|
|
8717
8705
|
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8706
|
+
if (channelEvent.type === 'participant') {
|
|
8707
|
+
return {
|
|
8708
|
+
body: (_a = channelEvent.payload) === null || _a === void 0 ? void 0 : _a.participant.introduction,
|
|
8709
|
+
translatedBody: (_c = (_b = channelEvent.payload) === null || _b === void 0 ? void 0 : _b.participant) === null || _c === void 0 ? void 0 : _c.translatedIntroduction
|
|
8710
|
+
};
|
|
8711
|
+
}
|
|
8712
|
+
|
|
8713
|
+
return {
|
|
8714
|
+
body: channelEvent.payload.body,
|
|
8715
|
+
translatedBody: channelEvent.payload.translatedBody
|
|
8716
|
+
};
|
|
8717
|
+
};
|
|
8729
8718
|
|
|
8730
|
-
|
|
8731
|
-
|
|
8719
|
+
const {
|
|
8720
|
+
translatedBody,
|
|
8721
|
+
body
|
|
8722
|
+
} = getTranslations();
|
|
8723
|
+
const hasTranslation = !!translatedBody;
|
|
8724
|
+
const isTranslated = (0, react_redux_1.useSelector)((0, selectors_1.selectIsTranslated)(channelEvent));
|
|
8725
|
+
return {
|
|
8726
|
+
body: hasTranslation && isTranslated ? translatedBody === null || translatedBody === void 0 ? void 0 : translatedBody.data : body,
|
|
8732
8727
|
hasTranslation,
|
|
8733
8728
|
isTranslated: isTranslated && hasTranslation,
|
|
8734
|
-
toggleTranslation,
|
|
8735
|
-
translatedBy: translatedBody === null || translatedBody === void 0 ? void 0 : translatedBody.translatedBy,
|
|
8736
8729
|
locale: translatedBody === null || translatedBody === void 0 ? void 0 : translatedBody.locale
|
|
8737
|
-
}
|
|
8730
|
+
};
|
|
8738
8731
|
}
|
|
8739
8732
|
|
|
8740
8733
|
exports.useTranslatedEventData = useTranslatedEventData;
|
|
@@ -8767,6 +8760,29 @@ exports.useLocaleNativeName = useLocaleNativeName;
|
|
|
8767
8760
|
|
|
8768
8761
|
/***/ }),
|
|
8769
8762
|
|
|
8763
|
+
/***/ 6787:
|
|
8764
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8765
|
+
|
|
8766
|
+
"use strict";
|
|
8767
|
+
|
|
8768
|
+
|
|
8769
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
8770
|
+
value: true
|
|
8771
|
+
}));
|
|
8772
|
+
exports.selectIsTranslated = void 0;
|
|
8773
|
+
|
|
8774
|
+
const toolkit_1 = __webpack_require__(575);
|
|
8775
|
+
|
|
8776
|
+
const selectIsTranslated = channelEvent => (0, toolkit_1.createSelector)(store => store.translations.translatedEventGroups, translatedEventGroups => Object.values(translatedEventGroups).every(value => {
|
|
8777
|
+
var _a;
|
|
8778
|
+
|
|
8779
|
+
return !value.includes((_a = channelEvent === null || channelEvent === void 0 ? void 0 : channelEvent.payload) === null || _a === void 0 ? void 0 : _a.id);
|
|
8780
|
+
}));
|
|
8781
|
+
|
|
8782
|
+
exports.selectIsTranslated = selectIsTranslated;
|
|
8783
|
+
|
|
8784
|
+
/***/ }),
|
|
8785
|
+
|
|
8770
8786
|
/***/ 841:
|
|
8771
8787
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8772
8788
|
|
|
@@ -8778,7 +8794,7 @@ var _a;
|
|
|
8778
8794
|
Object.defineProperty(exports, "__esModule", ({
|
|
8779
8795
|
value: true
|
|
8780
8796
|
}));
|
|
8781
|
-
exports.
|
|
8797
|
+
exports.disableEventsTranslation = exports.enableEventsTranslation = exports.disableTranslation = exports.enableTranslation = exports.translationSlice = exports.translationsInitialState = void 0;
|
|
8782
8798
|
|
|
8783
8799
|
const toolkit_1 = __webpack_require__(575);
|
|
8784
8800
|
|
|
@@ -8786,14 +8802,52 @@ const actions_1 = __webpack_require__(4134);
|
|
|
8786
8802
|
|
|
8787
8803
|
const actions_2 = __webpack_require__(915);
|
|
8788
8804
|
|
|
8805
|
+
const slice_1 = __webpack_require__(1153);
|
|
8806
|
+
|
|
8789
8807
|
exports.translationsInitialState = {
|
|
8790
8808
|
isActive: false,
|
|
8791
8809
|
currentLocale: undefined,
|
|
8792
8810
|
isAvailable: false,
|
|
8793
8811
|
languages: [],
|
|
8794
|
-
|
|
8795
|
-
|
|
8812
|
+
containerId: (0, toolkit_1.nanoid)(),
|
|
8813
|
+
translatedEventGroups: {}
|
|
8814
|
+
};
|
|
8815
|
+
|
|
8816
|
+
const getLastGroupId = (events, id) => {
|
|
8817
|
+
const eventGroup = [...events].reduce((acc, {
|
|
8818
|
+
payload
|
|
8819
|
+
}, _index, arr) => {
|
|
8820
|
+
var _a;
|
|
8821
|
+
|
|
8822
|
+
if (acc[id]) {
|
|
8823
|
+
// Splice to break early (make the reducer think we are done)
|
|
8824
|
+
// This is needed to avoid events of other groups from being added to the array.
|
|
8825
|
+
// @ts-ignore
|
|
8826
|
+
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)) {
|
|
8827
|
+
arr.splice(0);
|
|
8828
|
+
return acc;
|
|
8829
|
+
}
|
|
8830
|
+
|
|
8831
|
+
acc[id].push(payload.id);
|
|
8832
|
+
}
|
|
8833
|
+
|
|
8834
|
+
if (payload.id === id) acc[id] = [];
|
|
8835
|
+
return acc;
|
|
8836
|
+
}, {});
|
|
8837
|
+
const [[groupId, eventIds]] = Object.entries(eventGroup);
|
|
8838
|
+
const lastGroupId = events //@ts-ignore
|
|
8839
|
+
.filter(event => {
|
|
8840
|
+
var _a;
|
|
8841
|
+
|
|
8842
|
+
return ((_a = event.payload) === null || _a === void 0 ? void 0 : _a.type) === 'divider';
|
|
8843
|
+
}).map(event => event.payload.id).at(-1);
|
|
8844
|
+
return {
|
|
8845
|
+
lastGroupId,
|
|
8846
|
+
groupId,
|
|
8847
|
+
eventIds
|
|
8848
|
+
};
|
|
8796
8849
|
};
|
|
8850
|
+
|
|
8797
8851
|
exports.translationSlice = (0, toolkit_1.createSlice)({
|
|
8798
8852
|
name: 'translation',
|
|
8799
8853
|
initialState: exports.translationsInitialState,
|
|
@@ -8808,23 +8862,31 @@ exports.translationSlice = (0, toolkit_1.createSlice)({
|
|
|
8808
8862
|
state.isActive = false;
|
|
8809
8863
|
state.currentLocale = undefined;
|
|
8810
8864
|
},
|
|
8811
|
-
|
|
8812
|
-
payload
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
return;
|
|
8865
|
+
enableEventsTranslation: (state, {
|
|
8866
|
+
payload: {
|
|
8867
|
+
events,
|
|
8868
|
+
id
|
|
8816
8869
|
}
|
|
8817
|
-
|
|
8818
|
-
state.originalPayloadIds = state.originalPayloadIds.filter(id => id !== payload);
|
|
8819
|
-
},
|
|
8820
|
-
disableEvent: (state, {
|
|
8821
|
-
payload
|
|
8822
8870
|
}) => {
|
|
8823
|
-
|
|
8824
|
-
|
|
8871
|
+
delete state.translatedEventGroups[id];
|
|
8872
|
+
const {
|
|
8873
|
+
lastGroupId
|
|
8874
|
+
} = getLastGroupId(events, id);
|
|
8875
|
+
state.lastGroupId = lastGroupId;
|
|
8876
|
+
},
|
|
8877
|
+
disableEventsTranslation: (state, {
|
|
8878
|
+
payload: {
|
|
8879
|
+
events,
|
|
8880
|
+
id
|
|
8825
8881
|
}
|
|
8826
|
-
|
|
8827
|
-
|
|
8882
|
+
}) => {
|
|
8883
|
+
const {
|
|
8884
|
+
lastGroupId,
|
|
8885
|
+
groupId,
|
|
8886
|
+
eventIds
|
|
8887
|
+
} = getLastGroupId(events, id);
|
|
8888
|
+
state.lastGroupId = lastGroupId;
|
|
8889
|
+
state.translatedEventGroups[groupId] = eventIds;
|
|
8828
8890
|
}
|
|
8829
8891
|
},
|
|
8830
8892
|
extraReducers: builder => {
|
|
@@ -8845,10 +8907,16 @@ exports.translationSlice = (0, toolkit_1.createSlice)({
|
|
|
8845
8907
|
if (!feature) return;
|
|
8846
8908
|
state.isAvailable = feature.enabled === true;
|
|
8847
8909
|
state.languages = feature.languages;
|
|
8910
|
+
}).addCase(slice_1.addEvent, (state, {
|
|
8911
|
+
payload
|
|
8912
|
+
}) => {
|
|
8913
|
+
if (state.translatedEventGroups[state.lastGroupId]) {
|
|
8914
|
+
state.translatedEventGroups[state.lastGroupId].push(payload.payload.id);
|
|
8915
|
+
}
|
|
8848
8916
|
});
|
|
8849
8917
|
}
|
|
8850
8918
|
});
|
|
8851
|
-
_a = exports.translationSlice.actions, exports.enableTranslation = _a.enableTranslation, exports.disableTranslation = _a.disableTranslation, exports.
|
|
8919
|
+
_a = exports.translationSlice.actions, exports.enableTranslation = _a.enableTranslation, exports.disableTranslation = _a.disableTranslation, exports.enableEventsTranslation = _a.enableEventsTranslation, exports.disableEventsTranslation = _a.disableEventsTranslation;
|
|
8852
8920
|
exports["default"] = exports.translationSlice.reducer;
|
|
8853
8921
|
|
|
8854
8922
|
/***/ }),
|
|
@@ -9753,13 +9821,13 @@ class SeamlyBaseError extends Error {
|
|
|
9753
9821
|
|
|
9754
9822
|
this.originalError = originalError;
|
|
9755
9823
|
|
|
9756
|
-
if (originalError
|
|
9824
|
+
if (originalError?.payload) {
|
|
9757
9825
|
this.originalEvent = originalError;
|
|
9758
9826
|
this.originalError = originalError.payload.error;
|
|
9759
9827
|
this.message = `Event of type ${originalError.payload.type} encountered`;
|
|
9760
9828
|
}
|
|
9761
9829
|
|
|
9762
|
-
if (originalError
|
|
9830
|
+
if (originalError?.error) {
|
|
9763
9831
|
this.originalError = originalError.error;
|
|
9764
9832
|
}
|
|
9765
9833
|
}
|
|
@@ -11541,8 +11609,6 @@ class API {
|
|
|
11541
11609
|
|
|
11542
11610
|
async createConversation() {
|
|
11543
11611
|
try {
|
|
11544
|
-
var _conversation$transla;
|
|
11545
|
-
|
|
11546
11612
|
const request = client_default().post(`${this.getUrlPrefix('http')}${this.URLS.conversations}`).set('Content-Type', 'application/json').query({
|
|
11547
11613
|
v: config.apiVersion
|
|
11548
11614
|
}) // withCredentials() is necessary to allow browsers to save received
|
|
@@ -11565,7 +11631,7 @@ class API {
|
|
|
11565
11631
|
this.setChannelTopic(conversation.channelTopic);
|
|
11566
11632
|
this.updateUrls(body);
|
|
11567
11633
|
this.setConversationUrl(this.URLS.conversation);
|
|
11568
|
-
this.locale =
|
|
11634
|
+
this.locale = conversation.translation?.locale;
|
|
11569
11635
|
this.userResponded = conversation.userResponded;
|
|
11570
11636
|
return initialState;
|
|
11571
11637
|
} catch (error) {
|
|
@@ -11800,7 +11866,7 @@ class API {
|
|
|
11800
11866
|
return {
|
|
11801
11867
|
clientName: "@seamly/web-ui",
|
|
11802
11868
|
clientVariant: this.layoutMode,
|
|
11803
|
-
clientVersion: "20.8.0-
|
|
11869
|
+
clientVersion: "20.8.0-beta.1",
|
|
11804
11870
|
currentUrl: window.location.toString(),
|
|
11805
11871
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
11806
11872
|
timezone: getTimeZone(),
|
|
@@ -11856,7 +11922,7 @@ function createErrorsMiddleware({
|
|
|
11856
11922
|
api,
|
|
11857
11923
|
layoutMode
|
|
11858
11924
|
} = (0,domains_config_selectors__WEBPACK_IMPORTED_MODULE_0__.selectConfig)(getState());
|
|
11859
|
-
errorCallback
|
|
11925
|
+
errorCallback?.(action.error, {
|
|
11860
11926
|
namespace,
|
|
11861
11927
|
api,
|
|
11862
11928
|
layoutMode,
|
|
@@ -11867,14 +11933,10 @@ function createErrorsMiddleware({
|
|
|
11867
11933
|
|
|
11868
11934
|
return next => action => {
|
|
11869
11935
|
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
|
-
|
|
11936
|
+
if (action.payload?.originalEvent?.payload) {
|
|
11875
11937
|
handleError({
|
|
11876
11938
|
error: action.payload,
|
|
11877
|
-
type:
|
|
11939
|
+
type: action.payload?.originalEvent?.payload?.type
|
|
11878
11940
|
});
|
|
11879
11941
|
}
|
|
11880
11942
|
|
|
@@ -11957,8 +12019,6 @@ function createI18nMiddleware({
|
|
|
11957
12019
|
}) {
|
|
11958
12020
|
return next => {
|
|
11959
12021
|
return action => {
|
|
11960
|
-
var _payload$translation, _payload$translation2, _payload$payload, _payload$payload$body;
|
|
11961
|
-
|
|
11962
12022
|
const result = next(action);
|
|
11963
12023
|
const {
|
|
11964
12024
|
payload
|
|
@@ -11966,7 +12026,7 @@ function createI18nMiddleware({
|
|
|
11966
12026
|
|
|
11967
12027
|
switch (action.type) {
|
|
11968
12028
|
case domains_store_slice__WEBPACK_IMPORTED_MODULE_3__.setHistory.type:
|
|
11969
|
-
if (payload
|
|
12029
|
+
if (payload?.translation?.enabled) {
|
|
11970
12030
|
dispatch((0,domains_translations_slice__WEBPACK_IMPORTED_MODULE_4__.enableTranslation)(payload.translation.locale));
|
|
11971
12031
|
dispatch((0,domains_i18n_actions__WEBPACK_IMPORTED_MODULE_1__.setLocale)(payload.translation.locale));
|
|
11972
12032
|
}
|
|
@@ -11981,14 +12041,14 @@ function createI18nMiddleware({
|
|
|
11981
12041
|
break;
|
|
11982
12042
|
|
|
11983
12043
|
case domains_store_slice__WEBPACK_IMPORTED_MODULE_3__.setInitialState.type:
|
|
11984
|
-
if (payload
|
|
12044
|
+
if (payload?.translation?.enabled) {
|
|
11985
12045
|
dispatch((0,domains_translations_slice__WEBPACK_IMPORTED_MODULE_4__.enableTranslation)(payload.translation.locale));
|
|
11986
12046
|
}
|
|
11987
12047
|
|
|
11988
12048
|
break;
|
|
11989
12049
|
|
|
11990
12050
|
case domains_store_slice__WEBPACK_IMPORTED_MODULE_3__.addEvent.type:
|
|
11991
|
-
if (payload.type === 'info' &&
|
|
12051
|
+
if (payload.type === 'info' && payload?.payload?.body?.subtype === 'new_translation' && payload.payload.body.translationEnabled) {
|
|
11992
12052
|
dispatch((0,domains_i18n_actions__WEBPACK_IMPORTED_MODULE_1__.setLocale)(payload.payload.body.translationLocale));
|
|
11993
12053
|
}
|
|
11994
12054
|
|
|
@@ -12007,26 +12067,6 @@ function createI18nMiddleware({
|
|
|
12007
12067
|
|
|
12008
12068
|
/***/ }),
|
|
12009
12069
|
|
|
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
12070
|
/***/ 2629:
|
|
12031
12071
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
12032
12072
|
|
|
@@ -12405,12 +12445,14 @@ const SeamlyEventSubscriber = ({
|
|
|
12405
12445
|
eventPayload = _objectWithoutProperties(payload, _excluded);
|
|
12406
12446
|
|
|
12407
12447
|
const {
|
|
12408
|
-
uploads,
|
|
12409
12448
|
entry
|
|
12410
12449
|
} = serviceSettings;
|
|
12450
|
+
const {
|
|
12451
|
+
upload
|
|
12452
|
+
} = entry.options;
|
|
12411
12453
|
dispatch((0,store_slice.setFeatureEnabledState)({
|
|
12412
12454
|
key: seamly_utils.featureKeys.uploads,
|
|
12413
|
-
enabled: !!(
|
|
12455
|
+
enabled: !!(upload && upload.enabled)
|
|
12414
12456
|
}));
|
|
12415
12457
|
dispatch((0,store_slice.setServiceEntryMetadata)(entry));
|
|
12416
12458
|
dispatch((0,store_slice.setActiveService)(payload.serviceSessionId));
|
|
@@ -12727,11 +12769,7 @@ function useSeamlyInstanceFunction(functionName, fn, deps = []) {
|
|
|
12727
12769
|
return undefined;
|
|
12728
12770
|
}
|
|
12729
12771
|
|
|
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
|
-
};
|
|
12772
|
+
const callback = (...args) => callbackRef.current?.(...args);
|
|
12735
12773
|
|
|
12736
12774
|
eventBus.emit('function.register', functionName, callback);
|
|
12737
12775
|
return () => eventBus.emit('function.unregister', functionName, callback); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -12776,12 +12814,12 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
12776
12814
|
sendMessage({
|
|
12777
12815
|
body: text
|
|
12778
12816
|
});
|
|
12779
|
-
}, [api
|
|
12817
|
+
}, [api?.send]);
|
|
12780
12818
|
useSeamlyInstanceFunction('setVariables', variables => {
|
|
12781
12819
|
sendContext({
|
|
12782
12820
|
variables
|
|
12783
12821
|
});
|
|
12784
|
-
}, [api
|
|
12822
|
+
}, [api?.send]);
|
|
12785
12823
|
useSeamlyInstanceFunction('getVisibility', callback => {
|
|
12786
12824
|
if (callback) {
|
|
12787
12825
|
callback(currentVisibility.current);
|
|
@@ -12797,7 +12835,7 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
12797
12835
|
|
|
12798
12836
|
onActivityHandler();
|
|
12799
12837
|
setVisibility(visibilityState);
|
|
12800
|
-
}, [config
|
|
12838
|
+
}, [config?.api]);
|
|
12801
12839
|
useSeamlyInstanceFunction('sendCustomAction', (actionType, body) => {
|
|
12802
12840
|
sendAction({
|
|
12803
12841
|
type: 'custom',
|
|
@@ -13476,9 +13514,7 @@ class ExternalApi {
|
|
|
13476
13514
|
}
|
|
13477
13515
|
|
|
13478
13516
|
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 || {});
|
|
13517
|
+
return _objectSpread(_objectSpread(_objectSpread({}, this.appConfig.context?.variables || {}), userConfig.context?.variables || {}), this.context.variables || {});
|
|
13482
13518
|
}
|
|
13483
13519
|
|
|
13484
13520
|
}
|
|
@@ -15116,7 +15152,9 @@ const Image = _ref => {
|
|
|
15116
15152
|
} = _ref,
|
|
15117
15153
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15118
15154
|
|
|
15119
|
-
const
|
|
15155
|
+
const {
|
|
15156
|
+
body
|
|
15157
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15120
15158
|
const {
|
|
15121
15159
|
description,
|
|
15122
15160
|
url,
|
|
@@ -15174,7 +15212,9 @@ const Video = _ref => {
|
|
|
15174
15212
|
} = _ref,
|
|
15175
15213
|
props = video_objectWithoutProperties(_ref, video_excluded);
|
|
15176
15214
|
|
|
15177
|
-
const
|
|
15215
|
+
const {
|
|
15216
|
+
body
|
|
15217
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15178
15218
|
const {
|
|
15179
15219
|
description,
|
|
15180
15220
|
url
|
|
@@ -15232,6 +15272,8 @@ const Divider = ({
|
|
|
15232
15272
|
};
|
|
15233
15273
|
|
|
15234
15274
|
/* harmony default export */ const variants_default = (Divider);
|
|
15275
|
+
// EXTERNAL MODULE: ./src/javascripts/domains/translations/slice.ts
|
|
15276
|
+
var translations_slice = __webpack_require__(841);
|
|
15235
15277
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js
|
|
15236
15278
|
|
|
15237
15279
|
|
|
@@ -15240,21 +15282,46 @@ const Divider = ({
|
|
|
15240
15282
|
|
|
15241
15283
|
|
|
15242
15284
|
|
|
15285
|
+
|
|
15286
|
+
|
|
15287
|
+
|
|
15288
|
+
|
|
15289
|
+
|
|
15243
15290
|
const NewTranslationDivider = ({
|
|
15244
15291
|
event
|
|
15245
15292
|
}) => {
|
|
15246
15293
|
const {
|
|
15247
15294
|
t
|
|
15248
15295
|
} = (0,i18n_hooks.useI18n)();
|
|
15296
|
+
const events = (0,seamly_hooks.useEvents)();
|
|
15249
15297
|
const {
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15298
|
+
body: {
|
|
15299
|
+
translationEnabled,
|
|
15300
|
+
translationLocale,
|
|
15301
|
+
text
|
|
15302
|
+
},
|
|
15303
|
+
id
|
|
15304
|
+
} = event.payload;
|
|
15254
15305
|
const {
|
|
15255
15306
|
enableTranslations
|
|
15256
15307
|
} = (0,translations_hooks.useTranslations)();
|
|
15257
15308
|
const localeNativeName = (0,translations_hooks.useLocaleNativeName)(translationLocale);
|
|
15309
|
+
const translatedEventGroups = (0,es.useSelector)(state => state.translations.translatedEventGroups);
|
|
15310
|
+
const dispatch = (0,es.useDispatch)();
|
|
15311
|
+
const toggleTranslations = (0,hooks_.useCallback)(() => {
|
|
15312
|
+
if (!translatedEventGroups[id]) {
|
|
15313
|
+
dispatch((0,translations_slice.disableEventsTranslation)({
|
|
15314
|
+
events,
|
|
15315
|
+
id
|
|
15316
|
+
}));
|
|
15317
|
+
return;
|
|
15318
|
+
}
|
|
15319
|
+
|
|
15320
|
+
dispatch((0,translations_slice.enableEventsTranslation)({
|
|
15321
|
+
events,
|
|
15322
|
+
id
|
|
15323
|
+
}));
|
|
15324
|
+
}, [dispatch, events, id, translatedEventGroups]);
|
|
15258
15325
|
|
|
15259
15326
|
const handleRestartButtonclick = () => {
|
|
15260
15327
|
enableTranslations(translationLocale);
|
|
@@ -15268,10 +15335,17 @@ const NewTranslationDivider = ({
|
|
|
15268
15335
|
children: t(translationEnabled ? 'translations.divider.startText' : 'translations.divider.stopText', {
|
|
15269
15336
|
language: localeNativeName
|
|
15270
15337
|
})
|
|
15271
|
-
}), translationEnabled ? (0,jsx_runtime_.
|
|
15272
|
-
children:
|
|
15338
|
+
}), translationEnabled ? (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
|
|
15339
|
+
children: [(0,jsx_runtime_.jsx)("p", {
|
|
15340
|
+
children: text
|
|
15341
|
+
}), (0,jsx_runtime_.jsx)("button", {
|
|
15342
|
+
className: (0,css.className)('button', 'button--secondary'),
|
|
15343
|
+
onClick: toggleTranslations,
|
|
15344
|
+
children: t(!translatedEventGroups[id] ? 'translations.toggle.hideTranslationsButtonText' : 'translations.toggle.showTranslationsButtonText')
|
|
15345
|
+
})]
|
|
15273
15346
|
}) : (0,jsx_runtime_.jsx)("button", {
|
|
15274
15347
|
className: (0,css.className)('button', 'button--secondary'),
|
|
15348
|
+
"data-testid": "restartTranslationButton",
|
|
15275
15349
|
onClick: handleRestartButtonclick,
|
|
15276
15350
|
children: t('translations.divider.restartButtonText')
|
|
15277
15351
|
})]
|
|
@@ -15341,7 +15415,9 @@ const Translation = _ref => {
|
|
|
15341
15415
|
const {
|
|
15342
15416
|
t
|
|
15343
15417
|
} = (0,i18n_hooks.useI18n)();
|
|
15344
|
-
const
|
|
15418
|
+
const {
|
|
15419
|
+
body
|
|
15420
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15345
15421
|
return (0,jsx_runtime_.jsx)(message_container["default"], translation_objectSpread(translation_objectSpread({
|
|
15346
15422
|
type: "text",
|
|
15347
15423
|
event: event
|
|
@@ -15362,7 +15438,9 @@ const Participant = ({
|
|
|
15362
15438
|
const {
|
|
15363
15439
|
participant
|
|
15364
15440
|
} = event.payload;
|
|
15365
|
-
const
|
|
15441
|
+
const {
|
|
15442
|
+
body: introduction
|
|
15443
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15366
15444
|
|
|
15367
15445
|
if (!introduction) {
|
|
15368
15446
|
return null;
|
|
@@ -15407,7 +15485,9 @@ const Splash = _ref => {
|
|
|
15407
15485
|
const {
|
|
15408
15486
|
payload
|
|
15409
15487
|
} = event;
|
|
15410
|
-
const
|
|
15488
|
+
const {
|
|
15489
|
+
body
|
|
15490
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15411
15491
|
const eventClick = (0,use_event_link_click_handler/* default */.Z)(payload.id);
|
|
15412
15492
|
return (0,jsx_runtime_.jsx)(message_container["default"], splash_objectSpread(splash_objectSpread({
|
|
15413
15493
|
type: "splash",
|
|
@@ -15469,7 +15549,9 @@ const Upload = _ref => {
|
|
|
15469
15549
|
const {
|
|
15470
15550
|
t
|
|
15471
15551
|
} = (0,i18n_hooks.useI18n)();
|
|
15472
|
-
const
|
|
15552
|
+
const {
|
|
15553
|
+
body
|
|
15554
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15473
15555
|
const {
|
|
15474
15556
|
fromClient
|
|
15475
15557
|
} = event.payload;
|
|
@@ -15519,7 +15601,9 @@ const Upload = _ref => {
|
|
|
15519
15601
|
const Cta = ({
|
|
15520
15602
|
event
|
|
15521
15603
|
}) => {
|
|
15522
|
-
const
|
|
15604
|
+
const {
|
|
15605
|
+
body
|
|
15606
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15523
15607
|
const eventClick = (0,use_event_link_click_handler/* default */.Z)(event.payload.id);
|
|
15524
15608
|
const {
|
|
15525
15609
|
emitEvent
|
|
@@ -15911,7 +15995,9 @@ const getItemLabel = item => item.title;
|
|
|
15911
15995
|
const CarouselMessage = ({
|
|
15912
15996
|
event
|
|
15913
15997
|
}) => {
|
|
15914
|
-
const
|
|
15998
|
+
const {
|
|
15999
|
+
body
|
|
16000
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15915
16001
|
const slides = body.cards;
|
|
15916
16002
|
return (0,jsx_runtime_.jsx)(message_container["default"], {
|
|
15917
16003
|
event: event,
|
|
@@ -15942,7 +16028,9 @@ function card_message_defineProperty(obj, key, value) { if (key in obj) { Object
|
|
|
15942
16028
|
const CardMessage = ({
|
|
15943
16029
|
event
|
|
15944
16030
|
}) => {
|
|
15945
|
-
const
|
|
16031
|
+
const {
|
|
16032
|
+
body
|
|
16033
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15946
16034
|
const descriptionId = (0,seamly_hooks.useGeneratedId)();
|
|
15947
16035
|
return (0,jsx_runtime_.jsx)(message_container["default"], {
|
|
15948
16036
|
type: "card",
|
|
@@ -15986,11 +16074,14 @@ function conversation_suggestions_objectWithoutPropertiesLoose(source, excluded)
|
|
|
15986
16074
|
|
|
15987
16075
|
|
|
15988
16076
|
|
|
16077
|
+
|
|
15989
16078
|
const useSuggestions = event => {
|
|
15990
16079
|
const {
|
|
15991
16080
|
payload
|
|
15992
16081
|
} = event;
|
|
15993
|
-
const
|
|
16082
|
+
const {
|
|
16083
|
+
body: suggestions
|
|
16084
|
+
} = (0,translations_hooks.useTranslatedEventData)(event);
|
|
15994
16085
|
return {
|
|
15995
16086
|
suggestions,
|
|
15996
16087
|
payload
|
|
@@ -16014,6 +16105,9 @@ const ConversationSuggestions = _ref => {
|
|
|
16014
16105
|
suggestions,
|
|
16015
16106
|
payload
|
|
16016
16107
|
} = useSuggestions(event);
|
|
16108
|
+
const {
|
|
16109
|
+
showSuggestions
|
|
16110
|
+
} = (0,hooks.useConfig)();
|
|
16017
16111
|
const events = (0,seamly_hooks.useEvents)();
|
|
16018
16112
|
const {
|
|
16019
16113
|
t
|
|
@@ -16024,7 +16118,7 @@ const ConversationSuggestions = _ref => {
|
|
|
16024
16118
|
|
|
16025
16119
|
const hasLastTransactionEvent = (0,hooks_.useMemo)(() => events.some(({
|
|
16026
16120
|
payload: eventPayload
|
|
16027
|
-
}) => eventPayload
|
|
16121
|
+
}) => eventPayload?.transactionLast), [events]);
|
|
16028
16122
|
const handleClick = (0,hooks_.useCallback)(({
|
|
16029
16123
|
id,
|
|
16030
16124
|
question
|
|
@@ -16046,7 +16140,7 @@ const ConversationSuggestions = _ref => {
|
|
|
16046
16140
|
addMessageBubble(question);
|
|
16047
16141
|
}, [dispatch, sendAction, payload.id, addMessageBubble]);
|
|
16048
16142
|
|
|
16049
|
-
if (!isExpanded || userHasResponded || !hasLastTransactionEvent) {
|
|
16143
|
+
if (!isExpanded || userHasResponded || !hasLastTransactionEvent || !showSuggestions) {
|
|
16050
16144
|
return null;
|
|
16051
16145
|
}
|
|
16052
16146
|
|
|
@@ -16205,6 +16299,8 @@ const PrivacyDisclaimer = () => {
|
|
|
16205
16299
|
};
|
|
16206
16300
|
|
|
16207
16301
|
/* harmony default export */ const privacy_disclaimer = (PrivacyDisclaimer);
|
|
16302
|
+
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/focus-helper-hooks.js
|
|
16303
|
+
var focus_helper_hooks = __webpack_require__(8956);
|
|
16208
16304
|
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/seamly-hooks.js + 2 modules
|
|
16209
16305
|
var seamly_hooks = __webpack_require__(2849);
|
|
16210
16306
|
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
@@ -16317,6 +16413,7 @@ const Loader = () => {
|
|
|
16317
16413
|
|
|
16318
16414
|
|
|
16319
16415
|
|
|
16416
|
+
|
|
16320
16417
|
const Events = () => {
|
|
16321
16418
|
const events = (0,seamly_state_hooks.useEvents)();
|
|
16322
16419
|
let prevParticipant = null;
|
|
@@ -16361,11 +16458,15 @@ const Conversation = () => {
|
|
|
16361
16458
|
const skiplinkTargetId = (0,seamly_hooks.useSkiplink)();
|
|
16362
16459
|
const focusSkiplinkTarget = (0,seamly_hooks.useSkiplinkTargetFocusing)();
|
|
16363
16460
|
const loadedImageEventIds = (0,seamly_state_hooks.useLoadedImageEventIds)();
|
|
16364
|
-
(0,hooks_.
|
|
16461
|
+
(0,hooks_.useLayoutEffect)(() => {
|
|
16365
16462
|
const containerElement = chatBodyContainer.current;
|
|
16366
16463
|
|
|
16367
16464
|
if (containerElement) {
|
|
16368
|
-
|
|
16465
|
+
requestAnimationFrame(async () => {
|
|
16466
|
+
await (0,focus_helper_hooks/* timeout */.Vs)(30); // Wait for next frame tick
|
|
16467
|
+
|
|
16468
|
+
containerElement.scrollTop = containerElement.scrollHeight;
|
|
16469
|
+
});
|
|
16369
16470
|
}
|
|
16370
16471
|
}, [events, isLoading, isOpen, loadedImageEventIds]);
|
|
16371
16472
|
|
|
@@ -16524,16 +16625,16 @@ const useChoicePrompt = event => {
|
|
|
16524
16625
|
activeServiceSessionId
|
|
16525
16626
|
} = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_2__.useSeamlyServiceInfo)();
|
|
16526
16627
|
const lastEventId = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_2__.useLastMessageEventId)();
|
|
16527
|
-
const
|
|
16628
|
+
const {
|
|
16629
|
+
body
|
|
16630
|
+
} = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_7__.useTranslatedEventData)(event);
|
|
16528
16631
|
const {
|
|
16529
16632
|
service
|
|
16530
16633
|
} = payload;
|
|
16531
16634
|
const subEvent = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => {
|
|
16532
|
-
var _event$payload$body;
|
|
16533
|
-
|
|
16534
16635
|
return _objectSpread(_objectSpread({}, event), {}, {
|
|
16535
16636
|
payload: _objectSpread(_objectSpread({}, event.payload), {}, {
|
|
16536
|
-
body:
|
|
16637
|
+
body: event.payload.body?.prompt,
|
|
16537
16638
|
translatedBody: event.payload.translatedBody && _objectSpread(_objectSpread({}, event.payload.translatedBody), {}, {
|
|
16538
16639
|
data: event.payload.translatedBody.data.prompt
|
|
16539
16640
|
})
|
|
@@ -16679,13 +16780,11 @@ const timeFormatOptions = {
|
|
|
16679
16780
|
minute: 'numeric'
|
|
16680
16781
|
};
|
|
16681
16782
|
const useFormattedDate = date => {
|
|
16682
|
-
var _config$context;
|
|
16683
|
-
|
|
16684
16783
|
const {
|
|
16685
16784
|
t
|
|
16686
16785
|
} = (0,hooks.useI18n)();
|
|
16687
16786
|
const config = (0,config_hooks.useConfig)();
|
|
16688
|
-
const locale =
|
|
16787
|
+
const locale = config?.context?.locale ?? [];
|
|
16689
16788
|
const eventDate = new Date(date);
|
|
16690
16789
|
const currentDate = new Date();
|
|
16691
16790
|
const midnight = new Date(currentDate);
|
|
@@ -16925,7 +17024,9 @@ const Text = _ref => {
|
|
|
16925
17024
|
} = _ref,
|
|
16926
17025
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16927
17026
|
|
|
16928
|
-
const
|
|
17027
|
+
const {
|
|
17028
|
+
body
|
|
17029
|
+
} = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_2__.useTranslatedEventData)(event);
|
|
16929
17030
|
const eventClick = (0,_hooks_use_event_link_click_handler__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(event.payload.id);
|
|
16930
17031
|
const containerProps = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
|
|
16931
17032
|
if (event.payload.optimisticallyInjected) {
|
|
@@ -16966,12 +17067,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
16966
17067
|
/* harmony import */ var lib_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5567);
|
|
16967
17068
|
/* harmony import */ var ui_hooks_component_helper_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3357);
|
|
16968
17069
|
/* 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"];
|
|
17070
|
+
/* harmony import */ var _event_event_participant__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7409);
|
|
17071
|
+
/* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7844);
|
|
17072
|
+
/* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
|
|
17073
|
+
const _excluded = ["showParticipant", "event", "type", "modifiers", "children", "bodyProps", "info"];
|
|
16975
17074
|
|
|
16976
17075
|
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
17076
|
|
|
@@ -16991,11 +17090,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16991
17090
|
|
|
16992
17091
|
|
|
16993
17092
|
|
|
16994
|
-
|
|
16995
17093
|
function MessageContainer(_ref) {
|
|
16996
17094
|
let {
|
|
16997
17095
|
showParticipant = true,
|
|
16998
|
-
showTranslationToggle = true,
|
|
16999
17096
|
event,
|
|
17000
17097
|
type,
|
|
17001
17098
|
modifiers,
|
|
@@ -17007,14 +17104,10 @@ function MessageContainer(_ref) {
|
|
|
17007
17104
|
|
|
17008
17105
|
const classNames = (0,ui_hooks_component_helper_hooks__WEBPACK_IMPORTED_MODULE_1__/* .useSeamlyMessageContainerClassNames */ .j)(event);
|
|
17009
17106
|
const {
|
|
17010
|
-
t
|
|
17011
|
-
} = (0,domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_3__.useI18n)();
|
|
17012
|
-
const [, {
|
|
17013
17107
|
hasTranslation,
|
|
17014
17108
|
isTranslated,
|
|
17015
|
-
toggleTranslation,
|
|
17016
17109
|
locale
|
|
17017
|
-
}
|
|
17110
|
+
} = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_2__.useTranslatedEventData)(event);
|
|
17018
17111
|
|
|
17019
17112
|
if (type) {
|
|
17020
17113
|
classNames.push(`message--type-${type}`);
|
|
@@ -17046,27 +17139,20 @@ function MessageContainer(_ref) {
|
|
|
17046
17139
|
});
|
|
17047
17140
|
}
|
|
17048
17141
|
|
|
17049
|
-
return (0,
|
|
17050
|
-
children: (0,
|
|
17142
|
+
return (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
|
|
17143
|
+
children: (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", _objectSpread(_objectSpread({
|
|
17051
17144
|
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_0__.className)(classNames)
|
|
17052
17145
|
}, props), {}, {
|
|
17053
|
-
children: [showParticipant && (0,
|
|
17146
|
+
children: [showParticipant && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_event_event_participant__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
|
17054
17147
|
eventPayload: event.payload
|
|
17055
|
-
}), (0,
|
|
17148
|
+
}), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", _objectSpread(_objectSpread({
|
|
17056
17149
|
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_0__.className)('message__body')
|
|
17057
17150
|
}, bodyProps), {}, {
|
|
17058
17151
|
children: children
|
|
17059
|
-
})), info && (0,
|
|
17152
|
+
})), info && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
|
|
17060
17153
|
"aria-hidden": "true",
|
|
17061
17154
|
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_0__.className)('message__info'),
|
|
17062
17155
|
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
17156
|
})]
|
|
17071
17157
|
}))
|
|
17072
17158
|
});
|
|
@@ -18683,7 +18769,7 @@ const AgentInfo = () => {
|
|
|
18683
18769
|
hasInterrupt
|
|
18684
18770
|
} = (0,domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3__.useInterrupt)();
|
|
18685
18771
|
const startChatIcon = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_4__.useStartChatIcon)();
|
|
18686
|
-
const src =
|
|
18772
|
+
const src = currentAgent?.avatar ?? startChatIcon;
|
|
18687
18773
|
const displaySubtitle = hasInterrupt ? '' : subTitle;
|
|
18688
18774
|
const classNames = ['message-count'];
|
|
18689
18775
|
|
|
@@ -18700,7 +18786,7 @@ const AgentInfo = () => {
|
|
|
18700
18786
|
children: [(0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
|
|
18701
18787
|
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_1__.className)('agent-info__graphic'),
|
|
18702
18788
|
children: [src ? (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("img", {
|
|
18703
|
-
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_1__.className)(currentAgent
|
|
18789
|
+
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_1__.className)(currentAgent?.avatar ? 'avatar' : 'icon'),
|
|
18704
18790
|
src: src,
|
|
18705
18791
|
alt: ""
|
|
18706
18792
|
}) : (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icon__WEBPACK_IMPORTED_MODULE_6__["default"], {
|
|
@@ -19034,11 +19120,7 @@ const OptionsButton = () => {
|
|
|
19034
19120
|
const prevMenuIsOpen = (0,hooks_.useRef)(false);
|
|
19035
19121
|
const multiMenu = optionsLength > 1;
|
|
19036
19122
|
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]);
|
|
19123
|
+
const firstOptionName = (0,hooks_.useMemo)(() => firstOption?.name?.trim().replace(/\s+/g, ''), [firstOption]);
|
|
19042
19124
|
(0,hooks_.useEffect)(() => {
|
|
19043
19125
|
return () => {
|
|
19044
19126
|
clearTimeout(focusOutDelayTimeoutID.current);
|
|
@@ -19047,7 +19129,7 @@ const OptionsButton = () => {
|
|
|
19047
19129
|
(0,hooks_.useEffect)(() => {
|
|
19048
19130
|
if (menuIsOpen && !prevMenuIsOpen.current) {
|
|
19049
19131
|
requestAnimationFrame(async () => {
|
|
19050
|
-
await (0,focus_helper_hooks/* timeout */.Vs)(
|
|
19132
|
+
await (0,focus_helper_hooks/* timeout */.Vs)(60); // Wait for next frame tick
|
|
19051
19133
|
|
|
19052
19134
|
const firstActiveOptionIndex = menuOptions.findIndex(option => option.available);
|
|
19053
19135
|
const focusIndex = firstActiveOptionIndex === -1 ? 0 : firstActiveOptionIndex;
|
|
@@ -20107,30 +20189,32 @@ const Interrupt = ({
|
|
|
20107
20189
|
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
20108
20190
|
/* harmony export */ });
|
|
20109
20191
|
/* 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
|
|
20192
|
+
/* harmony import */ var domains_config_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6065);
|
|
20193
|
+
/* harmony import */ var domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(546);
|
|
20194
|
+
/* harmony import */ var domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2__);
|
|
20195
|
+
/* harmony import */ var domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8877);
|
|
20196
|
+
/* harmony import */ var domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3__);
|
|
20197
|
+
/* harmony import */ var domains_translations_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2108);
|
|
20198
|
+
/* harmony import */ var domains_visibility_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2629);
|
|
20199
|
+
/* harmony import */ var domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3742);
|
|
20200
|
+
/* harmony import */ var domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_6__);
|
|
20201
|
+
/* harmony import */ var lib_css__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(5567);
|
|
20202
|
+
/* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9207);
|
|
20203
|
+
/* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(preact_hooks__WEBPACK_IMPORTED_MODULE_8__);
|
|
20204
|
+
/* harmony import */ var ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2841);
|
|
20205
|
+
/* harmony import */ var ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(1433);
|
|
20206
|
+
/* harmony import */ var ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8956);
|
|
20207
|
+
/* harmony import */ var ui_hooks_live_region_hooks__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6639);
|
|
20208
|
+
/* harmony import */ var ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4809);
|
|
20209
|
+
/* harmony import */ var ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(4431);
|
|
20210
|
+
/* harmony import */ var ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(1154);
|
|
20211
|
+
/* harmony import */ var ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(1256);
|
|
20212
|
+
/* harmony import */ var ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(5029);
|
|
20213
|
+
/* harmony import */ var ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(4959);
|
|
20214
|
+
/* harmony import */ var ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(5740);
|
|
20215
|
+
/* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(7844);
|
|
20216
|
+
/* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__);
|
|
20217
|
+
|
|
20134
20218
|
|
|
20135
20219
|
|
|
20136
20220
|
|
|
@@ -20159,64 +20243,69 @@ const Suggestions = ({
|
|
|
20159
20243
|
// generic hooks
|
|
20160
20244
|
const {
|
|
20161
20245
|
isInline
|
|
20162
|
-
} = (0,
|
|
20246
|
+
} = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_13__.useSeamlyLayoutMode)();
|
|
20163
20247
|
const {
|
|
20164
20248
|
t
|
|
20165
|
-
} = (0,
|
|
20249
|
+
} = (0,domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2__.useI18n)();
|
|
20166
20250
|
const {
|
|
20167
20251
|
sendAction,
|
|
20168
20252
|
addMessageBubble
|
|
20169
|
-
} = (0,
|
|
20253
|
+
} = (0,ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z)();
|
|
20170
20254
|
const {
|
|
20171
20255
|
isOpen,
|
|
20172
20256
|
setVisibility
|
|
20173
|
-
} = (0,
|
|
20257
|
+
} = (0,domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_6__.useVisibility)();
|
|
20258
|
+
const {
|
|
20259
|
+
showSuggestions
|
|
20260
|
+
} = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_1__.useConfig)(); // a11y hooks
|
|
20174
20261
|
|
|
20175
|
-
const sectionId = (0,
|
|
20176
|
-
const focusSkiplinkTarget = (0,
|
|
20177
|
-
const containerRef = (0,
|
|
20262
|
+
const sectionId = (0,ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_17__/* .useGeneratedId */ .I8)();
|
|
20263
|
+
const focusSkiplinkTarget = (0,ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_11__/* .useSkiplinkTargetFocusing */ .MI)();
|
|
20264
|
+
const containerRef = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)(null);
|
|
20178
20265
|
const {
|
|
20179
20266
|
sendPolite
|
|
20180
|
-
} = (0,
|
|
20267
|
+
} = (0,ui_hooks_live_region_hooks__WEBPACK_IMPORTED_MODULE_12__/* .useLiveRegion */ .t)(); // interrupt & countdown hooks
|
|
20181
20268
|
|
|
20182
20269
|
const {
|
|
20183
20270
|
hasInterrupt
|
|
20184
|
-
} = (0,
|
|
20271
|
+
} = (0,domains_interrupt_hooks__WEBPACK_IMPORTED_MODULE_3__.useInterrupt)();
|
|
20185
20272
|
const {
|
|
20186
20273
|
hasCountdown,
|
|
20187
20274
|
endCountdown
|
|
20188
|
-
} = (0,
|
|
20275
|
+
} = (0,ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z)();
|
|
20189
20276
|
const {
|
|
20190
20277
|
hasPrompt,
|
|
20191
20278
|
continueChat
|
|
20192
|
-
} = (0,
|
|
20279
|
+
} = (0,ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z)(); // data hooks
|
|
20193
20280
|
|
|
20194
20281
|
const userHasResponded = (0,domains_app_hooks__WEBPACK_IMPORTED_MODULE_0__/* .useUserHasResponded */ .h)();
|
|
20195
|
-
const payload = (0,
|
|
20196
|
-
const
|
|
20282
|
+
const payload = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_13__.useSeamlyServiceData)('suggestion');
|
|
20283
|
+
const {
|
|
20284
|
+
body: eventBody
|
|
20285
|
+
} = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_4__.useTranslatedEventData)({
|
|
20197
20286
|
payload
|
|
20198
20287
|
});
|
|
20199
|
-
const suggestions = (0,
|
|
20200
|
-
const prevSuggestions = (0,
|
|
20201
|
-
const prevHasSuggestions = (0,
|
|
20202
|
-
const previousRenderedSuggestions = (0,
|
|
20288
|
+
const suggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useMemo)(() => payload && !hasInterrupt ? eventBody : [], [payload, hasInterrupt, eventBody]);
|
|
20289
|
+
const prevSuggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)(null);
|
|
20290
|
+
const prevHasSuggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)(false);
|
|
20291
|
+
const previousRenderedSuggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)([]);
|
|
20203
20292
|
const hasSuggestions = !!suggestions.length;
|
|
20204
20293
|
const hideSuggestions = isInline ? (userHasResponded || isOpen) && !isAside : userHasResponded;
|
|
20205
|
-
const prevHideSuggestions = (0,
|
|
20206
|
-
const showSuggestionsContainer = hasSuggestions && !hideSuggestions;
|
|
20294
|
+
const prevHideSuggestions = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useRef)(hideSuggestions);
|
|
20295
|
+
const showSuggestionsContainer = hasSuggestions && !hideSuggestions && showSuggestions;
|
|
20207
20296
|
const renderedSuggestions = hasSuggestions ? suggestions : previousRenderedSuggestions.current;
|
|
20208
20297
|
previousRenderedSuggestions.current = renderedSuggestions;
|
|
20209
|
-
const suggestionsClassNames = (0,
|
|
20298
|
+
const suggestionsClassNames = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useMemo)(() => {
|
|
20210
20299
|
const classNames = ['suggestions'];
|
|
20211
20300
|
|
|
20212
20301
|
if (isAside) {
|
|
20213
20302
|
classNames.push('suggestions--aside');
|
|
20214
20303
|
}
|
|
20215
20304
|
|
|
20216
|
-
return (0,
|
|
20305
|
+
return (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)(classNames);
|
|
20217
20306
|
}, [isAside]); // click handler
|
|
20218
20307
|
|
|
20219
|
-
const handleClick = (0,
|
|
20308
|
+
const handleClick = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useCallback)(({
|
|
20220
20309
|
id,
|
|
20221
20310
|
question
|
|
20222
20311
|
}) => {
|
|
@@ -20230,7 +20319,7 @@ const Suggestions = ({
|
|
|
20230
20319
|
|
|
20231
20320
|
|
|
20232
20321
|
sendAction({
|
|
20233
|
-
type:
|
|
20322
|
+
type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_19__.actionTypes.custom,
|
|
20234
20323
|
originMessage: payload.id,
|
|
20235
20324
|
body: {
|
|
20236
20325
|
type: 'faqclick',
|
|
@@ -20243,12 +20332,12 @@ const Suggestions = ({
|
|
|
20243
20332
|
addMessageBubble(question);
|
|
20244
20333
|
|
|
20245
20334
|
if (!isOpen) {
|
|
20246
|
-
setVisibility(
|
|
20335
|
+
setVisibility(domains_visibility_constants__WEBPACK_IMPORTED_MODULE_5__.visibilityStates.open);
|
|
20247
20336
|
}
|
|
20248
20337
|
|
|
20249
20338
|
focusSkiplinkTarget();
|
|
20250
20339
|
}, [addMessageBubble, continueChat, endCountdown, focusSkiplinkTarget, hasCountdown, hasPrompt, payload, sendAction, setVisibility, isOpen]);
|
|
20251
|
-
(0,
|
|
20340
|
+
(0,preact_hooks__WEBPACK_IMPORTED_MODULE_8__.useEffect)(() => {
|
|
20252
20341
|
if (prevSuggestions.current !== suggestions && !hideSuggestions) {
|
|
20253
20342
|
if (hasSuggestions) {
|
|
20254
20343
|
const politeText = prevHasSuggestions.current ? t('suggestions.srUpdatedText') : t('suggestions.srAvailableText');
|
|
@@ -20263,10 +20352,10 @@ const Suggestions = ({
|
|
|
20263
20352
|
}
|
|
20264
20353
|
|
|
20265
20354
|
if (!prevHideSuggestions.current && hideSuggestions) {
|
|
20266
|
-
(0,
|
|
20355
|
+
(0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_18__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
|
|
20267
20356
|
sendPolite(t('suggestions.srUnavailableText'));
|
|
20268
20357
|
} else if (!hasSuggestions && prevHasSuggestions.current) {
|
|
20269
|
-
(0,
|
|
20358
|
+
(0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_18__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
|
|
20270
20359
|
}
|
|
20271
20360
|
|
|
20272
20361
|
prevHasSuggestions.current = hasSuggestions;
|
|
@@ -20275,22 +20364,22 @@ const Suggestions = ({
|
|
|
20275
20364
|
const headingText = t('suggestions.headingText');
|
|
20276
20365
|
const footerText = t('suggestions.footerText');
|
|
20277
20366
|
const ContainerElement = headingText ? 'section' : 'div';
|
|
20278
|
-
return (0,
|
|
20367
|
+
return (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsx)(ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, {
|
|
20279
20368
|
isActive: showSuggestionsContainer,
|
|
20280
|
-
transitionStartState:
|
|
20281
|
-
children: (0,
|
|
20369
|
+
transitionStartState: ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_10__/* .transitionStartStates.notRendered */ .I.notRendered,
|
|
20370
|
+
children: (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsxs)(ContainerElement, {
|
|
20282
20371
|
className: suggestionsClassNames,
|
|
20283
20372
|
"aria-labelledby": headingText ? sectionId : null,
|
|
20284
20373
|
ref: containerRef,
|
|
20285
|
-
children: [headingText && (0,
|
|
20374
|
+
children: [headingText && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsx)("p", {
|
|
20286
20375
|
id: sectionId,
|
|
20287
|
-
className: (0,
|
|
20376
|
+
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)('suggestions__heading'),
|
|
20288
20377
|
children: headingText
|
|
20289
|
-
}), !!renderedSuggestions.length && (0,
|
|
20378
|
+
}), !!renderedSuggestions.length && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsx)(ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
20290
20379
|
suggestions: renderedSuggestions,
|
|
20291
20380
|
onClickSuggestion: handleClick
|
|
20292
|
-
}), footerText && !isOpen && (0,
|
|
20293
|
-
className: (0,
|
|
20381
|
+
}), footerText && !isOpen && (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_20__.jsx)("p", {
|
|
20382
|
+
className: (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)('suggestions__footer'),
|
|
20294
20383
|
children: footerText
|
|
20295
20384
|
})]
|
|
20296
20385
|
})
|
|
@@ -20500,7 +20589,9 @@ const Faq = () => {
|
|
|
20500
20589
|
continueChat
|
|
20501
20590
|
} = (0,use_seamly_resume_conversation_prompt/* default */.Z)();
|
|
20502
20591
|
const lastFaqEventPayload = (0,seamly_state_hooks.useSeamlyServiceData)('suggestion');
|
|
20503
|
-
const
|
|
20592
|
+
const {
|
|
20593
|
+
body: eventBody
|
|
20594
|
+
} = (0,translations_hooks.useTranslatedEventData)({
|
|
20504
20595
|
payload: lastFaqEventPayload
|
|
20505
20596
|
});
|
|
20506
20597
|
const faqs = (0,hooks_.useMemo)(() => {
|
|
@@ -20867,7 +20958,7 @@ function PreChatMessages() {
|
|
|
20867
20958
|
const {
|
|
20868
20959
|
isOpen
|
|
20869
20960
|
} = (0,visibility_hooks.useVisibility)();
|
|
20870
|
-
const isVisible = !(hasInterrupt || !
|
|
20961
|
+
const isVisible = !(hasInterrupt || !preChatEvents?.length || isOpen);
|
|
20871
20962
|
return isVisible && (0,jsx_runtime_.jsx)("ul", {
|
|
20872
20963
|
className: (0,css.className)('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
|
|
20873
20964
|
"aria-hidden": !isVisible,
|
|
@@ -21805,11 +21896,13 @@ const useSeamlyEventStream = (nextFn, filterFn) => {
|
|
|
21805
21896
|
"use strict";
|
|
21806
21897
|
__webpack_require__.r(__webpack_exports__);
|
|
21807
21898
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
21899
|
+
/* harmony export */ "selectEventIds": () => (/* binding */ selectEventIds),
|
|
21808
21900
|
/* harmony export */ "selectEvents": () => (/* binding */ selectEvents),
|
|
21809
21901
|
/* harmony export */ "selectEventsWithSuggestion": () => (/* binding */ selectEventsWithSuggestion),
|
|
21810
21902
|
/* harmony export */ "selectState": () => (/* binding */ selectState),
|
|
21811
21903
|
/* harmony export */ "useEntryTextLimit": () => (/* binding */ useEntryTextLimit),
|
|
21812
21904
|
/* harmony export */ "useEvents": () => (/* binding */ useEvents),
|
|
21905
|
+
/* harmony export */ "useEventsIds": () => (/* binding */ useEventsIds),
|
|
21813
21906
|
/* harmony export */ "useLastMessageEventId": () => (/* binding */ useLastMessageEventId),
|
|
21814
21907
|
/* harmony export */ "useLoadedImageEventIds": () => (/* binding */ useLoadedImageEventIds),
|
|
21815
21908
|
/* harmony export */ "useSeamlyCurrentAgent": () => (/* binding */ useSeamlyCurrentAgent),
|
|
@@ -21850,9 +21943,7 @@ const selectEventsWithSuggestion = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_
|
|
|
21850
21943
|
events,
|
|
21851
21944
|
serviceData
|
|
21852
21945
|
}, 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)) {
|
|
21946
|
+
if (hasUserResponded || config.layoutMode === 'inline' || !serviceData?.suggestion || !serviceData?.suggestion?.body.length) {
|
|
21856
21947
|
return events;
|
|
21857
21948
|
}
|
|
21858
21949
|
|
|
@@ -21863,12 +21954,10 @@ const selectEventsWithSuggestion = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_
|
|
|
21863
21954
|
return [...events, suggestionsEvent];
|
|
21864
21955
|
});
|
|
21865
21956
|
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
21957
|
const {
|
|
21869
21958
|
enabled,
|
|
21870
21959
|
threshold
|
|
21871
|
-
} =
|
|
21960
|
+
} = config?.messages?.timeIndicator ?? {};
|
|
21872
21961
|
|
|
21873
21962
|
if (!enabled) {
|
|
21874
21963
|
return events;
|
|
@@ -21894,6 +21983,10 @@ const selectEvents = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSele
|
|
|
21894
21983
|
return mappedEvents;
|
|
21895
21984
|
});
|
|
21896
21985
|
const useEvents = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(selectEvents);
|
|
21986
|
+
const selectEventIds = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSelector)(selectEvents, events => {
|
|
21987
|
+
return events.map(event => event.payload.id);
|
|
21988
|
+
});
|
|
21989
|
+
const useEventsIds = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(selectEventIds);
|
|
21897
21990
|
const useSeamlyIsLoading = () => useSeamlyStateContext().isLoading;
|
|
21898
21991
|
const useSeamlyHeaderData = () => useSeamlyStateContext().headerTitles;
|
|
21899
21992
|
const useSeamlyUnreadCount = () => useSeamlyStateContext().unreadEvents;
|
|
@@ -21902,10 +21995,8 @@ const useSkiplink = () => useSeamlyStateContext().skiplinkTargetId;
|
|
|
21902
21995
|
const useSeamlyParticipant = participantId => useSeamlyStateContext().participantInfo.participants[participantId];
|
|
21903
21996
|
const useSeamlyServiceInfo = () => useSeamlyStateContext().serviceInfo;
|
|
21904
21997
|
const selectLastMessageEventId = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSelector)(selectEvents, events => {
|
|
21905
|
-
var _filteredEvents;
|
|
21906
|
-
|
|
21907
21998
|
const filteredEvents = events.filter(event => event.type === 'message');
|
|
21908
|
-
return
|
|
21999
|
+
return filteredEvents[filteredEvents.length - 1]?.payload.id;
|
|
21909
22000
|
});
|
|
21910
22001
|
const useLastMessageEventId = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(selectLastMessageEventId);
|
|
21911
22002
|
const useSeamlyIsHistoryLoaded = () => useSeamlyStateContext().historyLoaded;
|
|
@@ -22907,7 +22998,7 @@ const validateFileSize = (fileList, maxSize) => {
|
|
|
22907
22998
|
|
|
22908
22999
|
return isValid;
|
|
22909
23000
|
};
|
|
22910
|
-
const fileListObjectIsNotEmpty = fileListObj => !!
|
|
23001
|
+
const fileListObjectIsNotEmpty = fileListObj => !!fileListObj?.length > 0;
|
|
22911
23002
|
/* eslint-disable no-control-regex */
|
|
22912
23003
|
|
|
22913
23004
|
const isEmailString = val => {
|