@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
|
@@ -2684,7 +2684,9 @@ const seamly_unavailable_error_1 = __importDefault(__webpack_require__(60));
|
|
|
2684
2684
|
|
|
2685
2685
|
const actions_1 = __webpack_require__(915);
|
|
2686
2686
|
|
|
2687
|
-
const actions_2 = __webpack_require__(
|
|
2687
|
+
const actions_2 = __webpack_require__(59);
|
|
2688
|
+
|
|
2689
|
+
const actions_3 = __webpack_require__(234);
|
|
2688
2690
|
|
|
2689
2691
|
const seamly_utils_1 = __webpack_require__(740);
|
|
2690
2692
|
|
|
@@ -2693,7 +2695,8 @@ exports.initializeApp = (0, toolkit_1.createAsyncThunk)('initializeApp', (_, {
|
|
|
2693
2695
|
api,
|
|
2694
2696
|
config
|
|
2695
2697
|
},
|
|
2696
|
-
rejectWithValue
|
|
2698
|
+
rejectWithValue,
|
|
2699
|
+
dispatch
|
|
2697
2700
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2698
2701
|
var _a, _b, _c, _d;
|
|
2699
2702
|
|
|
@@ -2732,6 +2735,7 @@ exports.initializeApp = (0, toolkit_1.createAsyncThunk)('initializeApp', (_, {
|
|
|
2732
2735
|
});
|
|
2733
2736
|
}
|
|
2734
2737
|
|
|
2738
|
+
dispatch((0, actions_2.setLocale)(locale));
|
|
2735
2739
|
return {
|
|
2736
2740
|
initialState: undefined,
|
|
2737
2741
|
locale,
|
|
@@ -2769,7 +2773,7 @@ exports.resetApp = (0, toolkit_1.createAsyncThunk)('resetApp', (_, {
|
|
|
2769
2773
|
dispatch((0, actions_1.resetConfig)());
|
|
2770
2774
|
yield dispatch((0, actions_1.initializeConfig)());
|
|
2771
2775
|
yield dispatch((0, exports.initializeApp)());
|
|
2772
|
-
dispatch((0,
|
|
2776
|
+
dispatch((0, actions_3.initializeVisibility)());
|
|
2773
2777
|
}));
|
|
2774
2778
|
|
|
2775
2779
|
/***/ }),
|
|
@@ -3055,13 +3059,14 @@ exports.initialConfigState = Object.assign(Object.assign({}, config_1.defaultCon
|
|
|
3055
3059
|
connectWhenInView: true,
|
|
3056
3060
|
showDisclaimer: false,
|
|
3057
3061
|
showFaq: false,
|
|
3062
|
+
showSuggestions: true,
|
|
3058
3063
|
customComponents: {},
|
|
3059
3064
|
defaults: {
|
|
3060
3065
|
visible: null
|
|
3061
3066
|
},
|
|
3062
3067
|
preChatEvents: []
|
|
3063
3068
|
});
|
|
3064
|
-
const configKeys = ['hideOnNoUserResponse', 'connectWhenInView', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
|
|
3069
|
+
const configKeys = ['hideOnNoUserResponse', 'connectWhenInView', 'showDisclaimer', 'showFaq', 'showSuggestions', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
|
|
3065
3070
|
|
|
3066
3071
|
const updateState = (state, config) => {
|
|
3067
3072
|
const _a = (0, general_utils_1.pick)(config, configKeys),
|
|
@@ -3368,11 +3373,9 @@ exports.Yh = exports._B = exports.W_ = void 0;
|
|
|
3368
3373
|
|
|
3369
3374
|
const toolkit_1 = __webpack_require__(427);
|
|
3370
3375
|
|
|
3371
|
-
const actions_1 = __webpack_require__(
|
|
3376
|
+
const actions_1 = __webpack_require__(915);
|
|
3372
3377
|
|
|
3373
|
-
const actions_2 = __webpack_require__(
|
|
3374
|
-
|
|
3375
|
-
const actions_3 = __webpack_require__(59);
|
|
3378
|
+
const actions_2 = __webpack_require__(59);
|
|
3376
3379
|
|
|
3377
3380
|
const initialState = {
|
|
3378
3381
|
translations: {
|
|
@@ -3410,15 +3413,11 @@ exports.W_ = (0, toolkit_1.createSlice)({
|
|
|
3410
3413
|
},
|
|
3411
3414
|
extraReducers: builder => {
|
|
3412
3415
|
// Add reducers for additional action types here, and handle loading state as needed
|
|
3413
|
-
builder.addCase(
|
|
3416
|
+
builder.addCase(actions_1.initializeConfig.fulfilled, (state, {
|
|
3414
3417
|
payload
|
|
3415
3418
|
}) => {
|
|
3416
3419
|
state.initialLocale = payload.locale;
|
|
3417
|
-
}).addCase(
|
|
3418
|
-
payload
|
|
3419
|
-
}) => {
|
|
3420
|
-
state.locale = payload.locale;
|
|
3421
|
-
}).addCase(actions_3.setLocale.fulfilled, (state, {
|
|
3420
|
+
}).addCase(actions_2.setLocale.fulfilled, (state, {
|
|
3422
3421
|
payload
|
|
3423
3422
|
}) => {
|
|
3424
3423
|
if (!(payload === null || payload === void 0 ? void 0 : payload.translations)) {
|
|
@@ -3489,15 +3488,14 @@ exports.ZP = exports.EC.reducer;
|
|
|
3489
3488
|
/***/ 153:
|
|
3490
3489
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3491
3490
|
|
|
3492
|
-
var __webpack_unused_export__;
|
|
3493
3491
|
|
|
3494
3492
|
|
|
3495
3493
|
var _a;
|
|
3496
3494
|
|
|
3497
|
-
|
|
3495
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3498
3496
|
value: true
|
|
3499
|
-
});
|
|
3500
|
-
|
|
3497
|
+
}));
|
|
3498
|
+
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;
|
|
3501
3499
|
|
|
3502
3500
|
const toolkit_1 = __webpack_require__(427);
|
|
3503
3501
|
|
|
@@ -3516,7 +3514,7 @@ const isUnreadMessage = ({
|
|
|
3516
3514
|
payload
|
|
3517
3515
|
}) => type === seamly_utils_1.eventTypes.message && !payload.fromClient || type === seamly_utils_1.eventTypes.info && payload.type === seamly_utils_1.payloadTypes.text;
|
|
3518
3516
|
|
|
3519
|
-
exports.
|
|
3517
|
+
exports.isUnreadMessage = isUnreadMessage;
|
|
3520
3518
|
|
|
3521
3519
|
const orderHistory = events => {
|
|
3522
3520
|
return events.sort(({
|
|
@@ -3530,6 +3528,8 @@ const orderHistory = events => {
|
|
|
3530
3528
|
}) => occurredAtA - occurredAtB);
|
|
3531
3529
|
};
|
|
3532
3530
|
|
|
3531
|
+
exports.orderHistory = orderHistory;
|
|
3532
|
+
|
|
3533
3533
|
const mergeHistory = (stateEvents, historyEvents) => {
|
|
3534
3534
|
const newStateEvents = stateEvents.filter(stateEvent => // Deduplicate the event streams, giving events in historyEvents
|
|
3535
3535
|
// precedence so the server is able to push changes to events.
|
|
@@ -3540,10 +3540,10 @@ const mergeHistory = (stateEvents, historyEvents) => {
|
|
|
3540
3540
|
// these messages will be shown in the wrong order if not reversed. For
|
|
3541
3541
|
// the normal merging logic there is no added effect.
|
|
3542
3542
|
.reverse();
|
|
3543
|
-
return orderHistory([...newHistoryEvents, ...newStateEvents]);
|
|
3543
|
+
return (0, exports.orderHistory)([...newHistoryEvents, ...newStateEvents]);
|
|
3544
3544
|
};
|
|
3545
3545
|
|
|
3546
|
-
exports.
|
|
3546
|
+
exports.mergeHistory = mergeHistory;
|
|
3547
3547
|
|
|
3548
3548
|
const participantReducer = (participantInfo, action) => {
|
|
3549
3549
|
// TODO: a) Styleguide only! b) Should be removed after styleguide overhaul.
|
|
@@ -3611,7 +3611,7 @@ const calculateNewEntryMeta = (entryMeta, channelEvent) => {
|
|
|
3611
3611
|
});
|
|
3612
3612
|
};
|
|
3613
3613
|
|
|
3614
|
-
exports.
|
|
3614
|
+
exports.initialStoreState = {
|
|
3615
3615
|
events: [],
|
|
3616
3616
|
initialState: {
|
|
3617
3617
|
userResponded: false
|
|
@@ -3663,9 +3663,9 @@ exports.dH = {
|
|
|
3663
3663
|
},
|
|
3664
3664
|
seamlyContainerElement: null
|
|
3665
3665
|
};
|
|
3666
|
-
exports.
|
|
3666
|
+
exports.storeSlice = (0, toolkit_1.createSlice)({
|
|
3667
3667
|
name: 'store',
|
|
3668
|
-
initialState: exports.
|
|
3668
|
+
initialState: exports.initialStoreState,
|
|
3669
3669
|
reducers: {
|
|
3670
3670
|
addEvent: (state, action) => {
|
|
3671
3671
|
var _a, _b;
|
|
@@ -3690,7 +3690,7 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
3690
3690
|
});
|
|
3691
3691
|
}
|
|
3692
3692
|
|
|
3693
|
-
const incrementUnread = (0, exports.
|
|
3693
|
+
const incrementUnread = (0, exports.isUnreadMessage)(action.payload); // We check for duplicated and ignore them as in some error of the websocket
|
|
3694
3694
|
// a duplicate join can be active for a while until the server connection
|
|
3695
3695
|
// times out.
|
|
3696
3696
|
|
|
@@ -3729,7 +3729,8 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
3729
3729
|
} = payload;
|
|
3730
3730
|
|
|
3731
3731
|
if (matchedEvent) {
|
|
3732
|
-
state.events =
|
|
3732
|
+
state.events = (0, exports.orderHistory)( //@ts-ignore
|
|
3733
|
+
state.events.map(m => m.payload.id === matchedEvent.payload.id ? Object.assign(Object.assign({}, m), {
|
|
3733
3734
|
payload: Object.assign(Object.assign({}, m.payload), {
|
|
3734
3735
|
id,
|
|
3735
3736
|
occurredAt
|
|
@@ -3773,7 +3774,7 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
3773
3774
|
}) => {
|
|
3774
3775
|
var _a;
|
|
3775
3776
|
|
|
3776
|
-
const events = (0, exports.
|
|
3777
|
+
const events = (0, exports.mergeHistory)(state.events, history);
|
|
3777
3778
|
const mergedParticipants = Object.assign(Object.assign({}, state.participantInfo.participants), participants);
|
|
3778
3779
|
const lastParticipantEvent = events.slice().reverse().find(m => (m.type === 'message' || m.type === 'participant') && !m.payload.fromClient);
|
|
3779
3780
|
let lastParticipantId = null;
|
|
@@ -3789,9 +3790,11 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
3789
3790
|
}
|
|
3790
3791
|
|
|
3791
3792
|
const {
|
|
3792
|
-
entry
|
|
3793
|
-
uploads
|
|
3793
|
+
entry
|
|
3794
3794
|
} = activeServiceSettings;
|
|
3795
|
+
const {
|
|
3796
|
+
upload
|
|
3797
|
+
} = entry.options;
|
|
3795
3798
|
const historyNewEntryMeta = calculateNewEntryMeta(Object.assign(Object.assign(Object.assign({}, state.entryMeta), entry), {
|
|
3796
3799
|
active: entry.default || seamly_utils_1.payloadTypes.text,
|
|
3797
3800
|
options: Object.assign({}, entry && entry.options ? entry.options : {})
|
|
@@ -3799,14 +3802,14 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
3799
3802
|
let newFeatures = Object.assign({}, state.options.features);
|
|
3800
3803
|
const newFeaturesHasUpload = newFeatures.hasOwnProperty(seamly_utils_1.featureKeys.uploads); // Only set uploads if it was initialised by the account config.
|
|
3801
3804
|
|
|
3802
|
-
if (newFeaturesHasUpload && lastParticipantEvent.type === 'message') {
|
|
3805
|
+
if (newFeaturesHasUpload && (lastParticipantEvent === null || lastParticipantEvent === void 0 ? void 0 : lastParticipantEvent.type) === 'message') {
|
|
3803
3806
|
const {
|
|
3804
3807
|
payload: lastParticipantEventPayload
|
|
3805
3808
|
} = lastParticipantEvent;
|
|
3806
3809
|
const entryType = ((_a = lastParticipantEventPayload === null || lastParticipantEventPayload === void 0 ? void 0 : lastParticipantEventPayload.entry) === null || _a === void 0 ? void 0 : _a.type) || {};
|
|
3807
3810
|
newFeatures = Object.assign(Object.assign({}, newFeatures), {
|
|
3808
3811
|
uploads: {
|
|
3809
|
-
enabled: !!(
|
|
3812
|
+
enabled: !!(upload && upload.enabled),
|
|
3810
3813
|
enabledFromEntry: entryType === seamly_utils_1.entryTypes.upload
|
|
3811
3814
|
}
|
|
3812
3815
|
});
|
|
@@ -3823,7 +3826,7 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
3823
3826
|
state.serviceInfo = Object.assign(Object.assign({}, state.serviceInfo), {
|
|
3824
3827
|
activeServiceSessionId
|
|
3825
3828
|
});
|
|
3826
|
-
state.serviceData = serviceData
|
|
3829
|
+
state.serviceData = Object.assign(Object.assign({}, state.serviceData), serviceData);
|
|
3827
3830
|
state.options = Object.assign(Object.assign({}, state.options), {
|
|
3828
3831
|
features: newFeatures || {}
|
|
3829
3832
|
});
|
|
@@ -3894,8 +3897,8 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
3894
3897
|
setActiveService: (state, {
|
|
3895
3898
|
payload
|
|
3896
3899
|
}) => {
|
|
3897
|
-
if (state.serviceInfo.activeServiceSessionId !== payload
|
|
3898
|
-
state.serviceInfo.activeServiceSessionId = payload
|
|
3900
|
+
if (state.serviceInfo.activeServiceSessionId !== payload) {
|
|
3901
|
+
state.serviceInfo.activeServiceSessionId = payload;
|
|
3899
3902
|
}
|
|
3900
3903
|
},
|
|
3901
3904
|
setHeaderTitle: (state, {
|
|
@@ -3912,7 +3915,7 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
3912
3915
|
payload
|
|
3913
3916
|
}) => {
|
|
3914
3917
|
state.initialState = payload.initialState;
|
|
3915
|
-
state.unreadEvents = exports.
|
|
3918
|
+
state.unreadEvents = exports.initialStoreState.unreadEvents;
|
|
3916
3919
|
},
|
|
3917
3920
|
setServiceDataItem: (state, {
|
|
3918
3921
|
payload
|
|
@@ -4055,7 +4058,7 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
4055
4058
|
}
|
|
4056
4059
|
},
|
|
4057
4060
|
extraReducers: builder => {
|
|
4058
|
-
builder.addCase(actions_1.resetApp.pending, () => exports.
|
|
4061
|
+
builder.addCase(actions_1.resetApp.pending, () => exports.initialStoreState).addCase(actions_2.initializeConfig.fulfilled, (state, {
|
|
4059
4062
|
payload
|
|
4060
4063
|
}) => {
|
|
4061
4064
|
var _a;
|
|
@@ -4071,8 +4074,8 @@ exports.Zd = (0, toolkit_1.createSlice)({
|
|
|
4071
4074
|
});
|
|
4072
4075
|
}
|
|
4073
4076
|
});
|
|
4074
|
-
_a = exports.
|
|
4075
|
-
exports
|
|
4077
|
+
_a = exports.storeSlice.actions, exports.ackEvent = _a.ackEvent, exports.addEvent = _a.addEvent, exports.clearAllUploads = _a.clearAllUploads, exports.clearEvents = _a.clearEvents, exports.clearFeatures = _a.clearFeatures, exports.clearIdleDetachCountdown = _a.clearIdleDetachCountdown, exports.clearResumeConversationPrompt = _a.clearResumeConversationPrompt, exports.decrementIdleDetachCountdownCounter = _a.decrementIdleDetachCountdownCounter, exports.hideOption = _a.hideOption, exports.initIdleDetachCountdown = _a.initIdleDetachCountdown, exports.initResumeConversationPrompt = _a.initResumeConversationPrompt, exports.registerUpload = _a.registerUpload, exports.resetHistoryLoadedFlag = _a.resetHistoryLoadedFlag, exports.setActiveEntryType = _a.setActiveEntryType, exports.setActiveService = _a.setActiveService, exports.setBlockAutoEntrySwitch = _a.setBlockAutoEntrySwitch, exports.setEventsRead = _a.setEventsRead, exports.setFeatureEnabledState = _a.setFeatureEnabledState, exports.setFeatures = _a.setFeatures, exports.setHeaderSubTitle = _a.setHeaderSubTitle, exports.setHeaderTitle = _a.setHeaderTitle, exports.setHistory = _a.setHistory, exports.setInitialState = _a.setInitialState, exports.setIsLoading = _a.setIsLoading, exports.setLoadedImageEventIds = _a.setLoadedImageEventIds, exports.setParticipant = _a.setParticipant, exports.setSeamlyContainerElement = _a.setSeamlyContainerElement, exports.setServiceDataItem = _a.setServiceDataItem, exports.setServiceEntryMetadata = _a.setServiceEntryMetadata, exports.setUploadComplete = _a.setUploadComplete, exports.setUploadError = _a.setUploadError, exports.setUploadProgress = _a.setUploadProgress, exports.setUserEntryType = _a.setUserEntryType, exports.setUserSelectedOption = _a.setUserSelectedOption, exports.setUserSelectedOptions = _a.setUserSelectedOptions, exports.showOption = _a.showOption, exports.stopIdleDetachCountdownCounter = _a.stopIdleDetachCountdownCounter;
|
|
4078
|
+
exports["default"] = exports.storeSlice.reducer;
|
|
4076
4079
|
|
|
4077
4080
|
/***/ }),
|
|
4078
4081
|
|
|
@@ -4091,18 +4094,54 @@ __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export_
|
|
|
4091
4094
|
|
|
4092
4095
|
const toolkit_1 = __webpack_require__(427);
|
|
4093
4096
|
|
|
4094
|
-
const actions_1 = __webpack_require__(
|
|
4097
|
+
const actions_1 = __webpack_require__(915);
|
|
4095
4098
|
|
|
4096
|
-
const
|
|
4099
|
+
const slice_1 = __webpack_require__(153);
|
|
4097
4100
|
|
|
4098
4101
|
exports.Z6 = {
|
|
4099
4102
|
isActive: false,
|
|
4100
4103
|
currentLocale: undefined,
|
|
4101
4104
|
isAvailable: false,
|
|
4102
4105
|
languages: [],
|
|
4103
|
-
|
|
4104
|
-
|
|
4106
|
+
containerId: (0, toolkit_1.nanoid)(),
|
|
4107
|
+
translatedEventGroups: {}
|
|
4105
4108
|
};
|
|
4109
|
+
|
|
4110
|
+
const getLastGroupId = (events, id) => {
|
|
4111
|
+
const eventGroup = [...events].reduce((acc, {
|
|
4112
|
+
payload
|
|
4113
|
+
}, _index, arr) => {
|
|
4114
|
+
var _a;
|
|
4115
|
+
|
|
4116
|
+
if (acc[id]) {
|
|
4117
|
+
// Splice to break early (make the reducer think we are done)
|
|
4118
|
+
// This is needed to avoid events of other groups from being added to the array.
|
|
4119
|
+
// @ts-ignore
|
|
4120
|
+
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)) {
|
|
4121
|
+
arr.splice(0);
|
|
4122
|
+
return acc;
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
acc[id].push(payload.id);
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4128
|
+
if (payload.id === id) acc[id] = [];
|
|
4129
|
+
return acc;
|
|
4130
|
+
}, {});
|
|
4131
|
+
const [[groupId, eventIds]] = Object.entries(eventGroup);
|
|
4132
|
+
const lastGroupId = events //@ts-ignore
|
|
4133
|
+
.filter(event => {
|
|
4134
|
+
var _a;
|
|
4135
|
+
|
|
4136
|
+
return ((_a = event.payload) === null || _a === void 0 ? void 0 : _a.type) === 'divider';
|
|
4137
|
+
}).map(event => event.payload.id).at(-1);
|
|
4138
|
+
return {
|
|
4139
|
+
lastGroupId,
|
|
4140
|
+
groupId,
|
|
4141
|
+
eventIds
|
|
4142
|
+
};
|
|
4143
|
+
};
|
|
4144
|
+
|
|
4106
4145
|
exports.i$ = (0, toolkit_1.createSlice)({
|
|
4107
4146
|
name: 'translation',
|
|
4108
4147
|
initialState: exports.Z6,
|
|
@@ -4117,35 +4156,35 @@ exports.i$ = (0, toolkit_1.createSlice)({
|
|
|
4117
4156
|
state.isActive = false;
|
|
4118
4157
|
state.currentLocale = undefined;
|
|
4119
4158
|
},
|
|
4120
|
-
|
|
4121
|
-
payload
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
return;
|
|
4159
|
+
enableEventsTranslation: (state, {
|
|
4160
|
+
payload: {
|
|
4161
|
+
events,
|
|
4162
|
+
id
|
|
4125
4163
|
}
|
|
4126
|
-
|
|
4127
|
-
state.originalPayloadIds = state.originalPayloadIds.filter(id => id !== payload);
|
|
4128
|
-
},
|
|
4129
|
-
disableEvent: (state, {
|
|
4130
|
-
payload
|
|
4131
4164
|
}) => {
|
|
4132
|
-
|
|
4133
|
-
|
|
4165
|
+
delete state.translatedEventGroups[id];
|
|
4166
|
+
const {
|
|
4167
|
+
lastGroupId
|
|
4168
|
+
} = getLastGroupId(events, id);
|
|
4169
|
+
state.lastGroupId = lastGroupId;
|
|
4170
|
+
},
|
|
4171
|
+
disableEventsTranslation: (state, {
|
|
4172
|
+
payload: {
|
|
4173
|
+
events,
|
|
4174
|
+
id
|
|
4134
4175
|
}
|
|
4135
|
-
|
|
4136
|
-
|
|
4176
|
+
}) => {
|
|
4177
|
+
const {
|
|
4178
|
+
lastGroupId,
|
|
4179
|
+
groupId,
|
|
4180
|
+
eventIds
|
|
4181
|
+
} = getLastGroupId(events, id);
|
|
4182
|
+
state.lastGroupId = lastGroupId;
|
|
4183
|
+
state.translatedEventGroups[groupId] = eventIds;
|
|
4137
4184
|
}
|
|
4138
4185
|
},
|
|
4139
4186
|
extraReducers: builder => {
|
|
4140
|
-
builder.addCase(actions_1.
|
|
4141
|
-
payload
|
|
4142
|
-
}) => {
|
|
4143
|
-
var _a, _b;
|
|
4144
|
-
|
|
4145
|
-
if (!((_b = (_a = payload.config) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.translationLocale)) return;
|
|
4146
|
-
state.isActive = true;
|
|
4147
|
-
state.currentLocale = payload.locale;
|
|
4148
|
-
}).addCase(actions_2.initializeConfig.fulfilled, (state, {
|
|
4187
|
+
builder.addCase(actions_1.initializeConfig.fulfilled, (state, {
|
|
4149
4188
|
payload
|
|
4150
4189
|
}) => {
|
|
4151
4190
|
var _a;
|
|
@@ -4154,10 +4193,16 @@ exports.i$ = (0, toolkit_1.createSlice)({
|
|
|
4154
4193
|
if (!feature) return;
|
|
4155
4194
|
state.isAvailable = feature.enabled === true;
|
|
4156
4195
|
state.languages = feature.languages;
|
|
4196
|
+
}).addCase(slice_1.addEvent, (state, {
|
|
4197
|
+
payload
|
|
4198
|
+
}) => {
|
|
4199
|
+
if (state.translatedEventGroups[state.lastGroupId]) {
|
|
4200
|
+
state.translatedEventGroups[state.lastGroupId].push(payload.payload.id);
|
|
4201
|
+
}
|
|
4157
4202
|
});
|
|
4158
4203
|
}
|
|
4159
4204
|
});
|
|
4160
|
-
_a = exports.i$.actions, __webpack_unused_export__ = _a.enableTranslation, __webpack_unused_export__ = _a.disableTranslation, __webpack_unused_export__ = _a.
|
|
4205
|
+
_a = exports.i$.actions, __webpack_unused_export__ = _a.enableTranslation, __webpack_unused_export__ = _a.disableTranslation, __webpack_unused_export__ = _a.enableEventsTranslation, __webpack_unused_export__ = _a.disableEventsTranslation;
|
|
4161
4206
|
exports.ZP = exports.i$.reducer;
|
|
4162
4207
|
|
|
4163
4208
|
/***/ }),
|
|
@@ -4532,13 +4577,13 @@ class SeamlyBaseError extends Error {
|
|
|
4532
4577
|
|
|
4533
4578
|
this.originalError = originalError;
|
|
4534
4579
|
|
|
4535
|
-
if (originalError
|
|
4580
|
+
if (originalError?.payload) {
|
|
4536
4581
|
this.originalEvent = originalError;
|
|
4537
4582
|
this.originalError = originalError.payload.error;
|
|
4538
4583
|
this.message = `Event of type ${originalError.payload.type} encountered`;
|
|
4539
4584
|
}
|
|
4540
4585
|
|
|
4541
|
-
if (originalError
|
|
4586
|
+
if (originalError?.error) {
|
|
4542
4587
|
this.originalError = originalError.error;
|
|
4543
4588
|
}
|
|
4544
4589
|
}
|
|
@@ -4741,7 +4786,7 @@ const SeamlyStaticCore = ({
|
|
|
4741
4786
|
|
|
4742
4787
|
const newStore = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_11__.configureStore)({
|
|
4743
4788
|
reducer: {
|
|
4744
|
-
state: domains_store_slice__WEBPACK_IMPORTED_MODULE_6__
|
|
4789
|
+
state: domains_store_slice__WEBPACK_IMPORTED_MODULE_6__["default"],
|
|
4745
4790
|
app: domains_app_slice__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .ZP,
|
|
4746
4791
|
config: (domains_config_slice__WEBPACK_IMPORTED_MODULE_2___default()),
|
|
4747
4792
|
i18n: domains_i18n_slice__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP,
|
|
@@ -4779,7 +4824,7 @@ const SeamlyStaticCore = ({
|
|
|
4779
4824
|
newStore.dispatch((0,domains_i18n_slice__WEBPACK_IMPORTED_MODULE_4__/* .setInitialLocale */ ._B)('en-GB'));
|
|
4780
4825
|
newStore.dispatch((0,domains_i18n_slice__WEBPACK_IMPORTED_MODULE_4__/* .setTranslations */ .Yh)(translations));
|
|
4781
4826
|
participants.forEach(participant => {
|
|
4782
|
-
newStore.dispatch((0,domains_store_slice__WEBPACK_IMPORTED_MODULE_6__
|
|
4827
|
+
newStore.dispatch((0,domains_store_slice__WEBPACK_IMPORTED_MODULE_6__.setParticipant)({
|
|
4783
4828
|
participant,
|
|
4784
4829
|
fromClient: participant.id === 'user'
|
|
4785
4830
|
}));
|
|
@@ -4900,7 +4945,8 @@ const baseState = {
|
|
|
4900
4945
|
accountConfig: {},
|
|
4901
4946
|
hideOnNoUserResponse: false,
|
|
4902
4947
|
showFaq: false,
|
|
4903
|
-
showDisclaimer: false
|
|
4948
|
+
showDisclaimer: false,
|
|
4949
|
+
showSuggestions: true
|
|
4904
4950
|
},
|
|
4905
4951
|
initialState: {},
|
|
4906
4952
|
unreadEvents: 0,
|
|
@@ -5019,6 +5065,31 @@ const newTranslationDividerStart = {
|
|
|
5019
5065
|
type: 'divider'
|
|
5020
5066
|
}
|
|
5021
5067
|
};
|
|
5068
|
+
const newTranslationDividerStartTwo = {
|
|
5069
|
+
type: 'info',
|
|
5070
|
+
payload: {
|
|
5071
|
+
body: {
|
|
5072
|
+
language: 'Nederlands',
|
|
5073
|
+
subtype: 'new_translation',
|
|
5074
|
+
text: '[NL] Automatic translation to Dutch started. Please note that automatic translations may contain errors.',
|
|
5075
|
+
translationEnabled: true,
|
|
5076
|
+
translationLocale: 'nl'
|
|
5077
|
+
},
|
|
5078
|
+
fromClient: false,
|
|
5079
|
+
fromHistory: true,
|
|
5080
|
+
id: (0,web_ui_.randomId)(),
|
|
5081
|
+
occurredAt: 1625658300534259,
|
|
5082
|
+
participant: null,
|
|
5083
|
+
service: {
|
|
5084
|
+
meta: {},
|
|
5085
|
+
name: null,
|
|
5086
|
+
serviceSessionId: null
|
|
5087
|
+
},
|
|
5088
|
+
transactionId: null,
|
|
5089
|
+
translatedBody: null,
|
|
5090
|
+
type: 'divider'
|
|
5091
|
+
}
|
|
5092
|
+
};
|
|
5022
5093
|
const newTranslationDividerStop = {
|
|
5023
5094
|
type: 'info',
|
|
5024
5095
|
payload: {
|
|
@@ -5654,7 +5725,7 @@ const translationsSlice = {
|
|
|
5654
5725
|
currentLocale: undefined,
|
|
5655
5726
|
isAvailable: false,
|
|
5656
5727
|
languages: [],
|
|
5657
|
-
|
|
5728
|
+
translatedEventGroups: {},
|
|
5658
5729
|
containerId: (0,web_ui_.randomId)()
|
|
5659
5730
|
};
|
|
5660
5731
|
const suggestions = [{
|
|
@@ -6549,11 +6620,19 @@ const standardState = {
|
|
|
6549
6620
|
payload: states_objectSpread(states_objectSpread({}, choicePromptMessage.payload), {}, {
|
|
6550
6621
|
id: `${choicePromptMessage.payload.id}XXX`
|
|
6551
6622
|
})
|
|
6552
|
-
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider,
|
|
6623
|
+
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, newTranslationDividerStartTwo, newTranslationDividerStop, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage, newTranslationDividerStop].map(addTranslationData),
|
|
6553
6624
|
translations: states_objectSpread(states_objectSpread({}, translationsSlice), {}, {
|
|
6554
6625
|
currentLocale: 'nl',
|
|
6555
6626
|
isActive: true,
|
|
6556
6627
|
isAvailable: true,
|
|
6628
|
+
translatedEventGroups: {
|
|
6629
|
+
[newTranslationDividerStart.payload.id]: [infoMessage, shortTextMessage, states_objectSpread(states_objectSpread({}, choicePromptMessage), {}, {
|
|
6630
|
+
payload: states_objectSpread(states_objectSpread({}, choicePromptMessage.payload), {}, {
|
|
6631
|
+
id: `${choicePromptMessage.payload.id}XXX`
|
|
6632
|
+
})
|
|
6633
|
+
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider].map(p => p.payload.id),
|
|
6634
|
+
[newTranslationDividerStartTwo.payload.id]: [imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage].map(p => p.payload.id)
|
|
6635
|
+
},
|
|
6557
6636
|
languages: [{
|
|
6558
6637
|
locale: 'nl',
|
|
6559
6638
|
nativeName: 'Dutch'
|
|
@@ -7076,7 +7155,8 @@ const StyleGuideApp = ({
|
|
|
7076
7155
|
const bareState = mainState[feature][layoutMode];
|
|
7077
7156
|
const {
|
|
7078
7157
|
overrideMessages,
|
|
7079
|
-
showFaq
|
|
7158
|
+
showFaq,
|
|
7159
|
+
showSuggestions
|
|
7080
7160
|
} = bareState.config;
|
|
7081
7161
|
const agent = participants.find(participant => participant.id === 'agent');
|
|
7082
7162
|
|
|
@@ -7087,10 +7167,11 @@ const StyleGuideApp = ({
|
|
|
7087
7167
|
}, overrideMessages ? {
|
|
7088
7168
|
messages: overrideMessages
|
|
7089
7169
|
} : {}), {}, {
|
|
7090
|
-
showFaq
|
|
7170
|
+
showFaq,
|
|
7171
|
+
showSuggestions
|
|
7091
7172
|
}),
|
|
7092
7173
|
headerTitles: app_objectSpread(app_objectSpread({}, bareState.headerTitles), {}, {
|
|
7093
|
-
subTitle:
|
|
7174
|
+
subTitle: agent?.name || bareState.headerTitles.subTitle
|
|
7094
7175
|
})
|
|
7095
7176
|
});
|
|
7096
7177
|
|
|
@@ -7329,11 +7410,13 @@ function initializeStyleGuideExternalApi(appConfig, styleGuideConfig) {
|
|
|
7329
7410
|
|
|
7330
7411
|
__webpack_require__.r(__webpack_exports__);
|
|
7331
7412
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7413
|
+
/* harmony export */ "selectEventIds": () => (/* binding */ selectEventIds),
|
|
7332
7414
|
/* harmony export */ "selectEvents": () => (/* binding */ selectEvents),
|
|
7333
7415
|
/* harmony export */ "selectEventsWithSuggestion": () => (/* binding */ selectEventsWithSuggestion),
|
|
7334
7416
|
/* harmony export */ "selectState": () => (/* binding */ selectState),
|
|
7335
7417
|
/* harmony export */ "useEntryTextLimit": () => (/* binding */ useEntryTextLimit),
|
|
7336
7418
|
/* harmony export */ "useEvents": () => (/* binding */ useEvents),
|
|
7419
|
+
/* harmony export */ "useEventsIds": () => (/* binding */ useEventsIds),
|
|
7337
7420
|
/* harmony export */ "useLastMessageEventId": () => (/* binding */ useLastMessageEventId),
|
|
7338
7421
|
/* harmony export */ "useLoadedImageEventIds": () => (/* binding */ useLoadedImageEventIds),
|
|
7339
7422
|
/* harmony export */ "useSeamlyCurrentAgent": () => (/* binding */ useSeamlyCurrentAgent),
|
|
@@ -7374,9 +7457,7 @@ const selectEventsWithSuggestion = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_
|
|
|
7374
7457
|
events,
|
|
7375
7458
|
serviceData
|
|
7376
7459
|
}, config, hasUserResponded) => {
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
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)) {
|
|
7460
|
+
if (hasUserResponded || config.layoutMode === 'inline' || !serviceData?.suggestion || !serviceData?.suggestion?.body.length) {
|
|
7380
7461
|
return events;
|
|
7381
7462
|
}
|
|
7382
7463
|
|
|
@@ -7387,12 +7468,10 @@ const selectEventsWithSuggestion = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_
|
|
|
7387
7468
|
return [...events, suggestionsEvent];
|
|
7388
7469
|
});
|
|
7389
7470
|
const selectEvents = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSelector)(selectEventsWithSuggestion, domains_config_selectors__WEBPACK_IMPORTED_MODULE_0__.selectConfig, (events, config) => {
|
|
7390
|
-
var _config$messages;
|
|
7391
|
-
|
|
7392
7471
|
const {
|
|
7393
7472
|
enabled,
|
|
7394
7473
|
threshold
|
|
7395
|
-
} =
|
|
7474
|
+
} = config?.messages?.timeIndicator ?? {};
|
|
7396
7475
|
|
|
7397
7476
|
if (!enabled) {
|
|
7398
7477
|
return events;
|
|
@@ -7418,6 +7497,10 @@ const selectEvents = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSele
|
|
|
7418
7497
|
return mappedEvents;
|
|
7419
7498
|
});
|
|
7420
7499
|
const useEvents = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(selectEvents);
|
|
7500
|
+
const selectEventIds = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSelector)(selectEvents, events => {
|
|
7501
|
+
return events.map(event => event.payload.id);
|
|
7502
|
+
});
|
|
7503
|
+
const useEventsIds = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(selectEventIds);
|
|
7421
7504
|
const useSeamlyIsLoading = () => useSeamlyStateContext().isLoading;
|
|
7422
7505
|
const useSeamlyHeaderData = () => useSeamlyStateContext().headerTitles;
|
|
7423
7506
|
const useSeamlyUnreadCount = () => useSeamlyStateContext().unreadEvents;
|
|
@@ -7426,10 +7509,8 @@ const useSkiplink = () => useSeamlyStateContext().skiplinkTargetId;
|
|
|
7426
7509
|
const useSeamlyParticipant = participantId => useSeamlyStateContext().participantInfo.participants[participantId];
|
|
7427
7510
|
const useSeamlyServiceInfo = () => useSeamlyStateContext().serviceInfo;
|
|
7428
7511
|
const selectLastMessageEventId = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_5__.createSelector)(selectEvents, events => {
|
|
7429
|
-
var _filteredEvents;
|
|
7430
|
-
|
|
7431
7512
|
const filteredEvents = events.filter(event => event.type === 'message');
|
|
7432
|
-
return
|
|
7513
|
+
return filteredEvents[filteredEvents.length - 1]?.payload.id;
|
|
7433
7514
|
});
|
|
7434
7515
|
const useLastMessageEventId = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(selectLastMessageEventId);
|
|
7435
7516
|
const useSeamlyIsHistoryLoaded = () => useSeamlyStateContext().historyLoaded;
|