@seamly/web-ui 20.0.0-beta.4 → 20.0.0
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 +19 -30
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +0 -4
- package/build/dist/lib/index.js +147 -141
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +163 -157
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +123 -92
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +1 -2
- package/src/javascripts/api/index.js +19 -10
- package/src/javascripts/api/producer.js +5 -3
- package/src/javascripts/domains/app/actions.js +23 -1
- package/src/javascripts/domains/config/hooks.js +17 -0
- package/src/javascripts/domains/config/index.js +0 -1
- package/src/javascripts/domains/config/reducer.js +4 -0
- package/src/javascripts/domains/store/index.js +1 -5
- package/src/javascripts/lib/engine/index.js +2 -1
- package/src/javascripts/style-guide/components/app.js +8 -4
- package/src/javascripts/style-guide/components/static-core.js +19 -2
- package/src/javascripts/style-guide/components/view.js +16 -3
- package/src/javascripts/style-guide/states.js +42 -41
- package/src/javascripts/style-guide/style-guide-engine.js +14 -1
- package/src/javascripts/ui/components/conversation/event/event-participant.js +10 -7
- package/src/javascripts/ui/components/conversation/event/participant.js +3 -3
- package/src/javascripts/ui/components/layout/agent-info.js +7 -11
- package/src/javascripts/ui/components/layout/chat-frame.js +1 -1
- package/src/javascripts/ui/components/layout/pre-chat-messages.js +2 -8
- package/src/javascripts/ui/components/suggestions/index.js +0 -1
- package/src/javascripts/ui/components/suggestions/suggestions-list.js +1 -1
- package/src/javascripts/ui/components/view/inline-view.js +6 -1
- package/src/javascripts/ui/components/view/window-view/index.js +2 -2
- package/src/javascripts/ui/components/view/window-view/window-open-button.js +7 -7
- package/src/javascripts/ui/utils/seamly-utils.js +9 -2
- package/src/stylesheets/3-chat/_chat.scss +10 -25
- package/src/stylesheets/5-components/_chat-status.scss +1 -5
- package/src/stylesheets/5-components/_conversation.scss +1 -1
- package/src/stylesheets/5-components/_disclaimer.scss +1 -5
- package/src/stylesheets/5-components/_interrupt.scss +21 -2
- package/src/stylesheets/5-components/_message-body.scss +23 -1
- package/src/stylesheets/5-components/_message.scss +4 -0
- package/src/stylesheets/5-components/_options.scss +0 -8
- package/src/stylesheets/5-components/_pre-chat-messages.scss +22 -19
- package/src/stylesheets/5-components/_suggestions.scss +3 -9
- package/src/stylesheets/5-components/_unstarted.scss +20 -40
- package/src/stylesheets/7-deprecated/5-components/_message.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_modal.scss +1 -1
- package/src/stylesheets/style-guide.scss +1 -1
- package/src/javascripts/domains/config/middleware.js +0 -22
|
@@ -450,10 +450,6 @@
|
|
|
450
450
|
!*** ./node_modules/superagent/lib/response-base.js ***!
|
|
451
451
|
\******************************************************/
|
|
452
452
|
|
|
453
|
-
/*!******************************************************!*\
|
|
454
|
-
!*** ./src/javascripts/domains/config/middleware.js ***!
|
|
455
|
-
\******************************************************/
|
|
456
|
-
|
|
457
453
|
/*!******************************************************!*\
|
|
458
454
|
!*** ./src/javascripts/domains/interrupt/actions.js ***!
|
|
459
455
|
\******************************************************/
|
package/build/dist/lib/index.js
CHANGED
|
@@ -8170,6 +8170,59 @@ const useSelectorWithProps = function useSelectorWithProps(selector, props, inpu
|
|
|
8170
8170
|
function useConfig() {
|
|
8171
8171
|
return useSelector(selectConfig);
|
|
8172
8172
|
}
|
|
8173
|
+
function useParticipants() {
|
|
8174
|
+
const {
|
|
8175
|
+
agentParticipant,
|
|
8176
|
+
userParticipant
|
|
8177
|
+
} = useSelector(selectConfig);
|
|
8178
|
+
return {
|
|
8179
|
+
agent: agentParticipant,
|
|
8180
|
+
user: userParticipant
|
|
8181
|
+
};
|
|
8182
|
+
}
|
|
8183
|
+
function useStartChatIcon() {
|
|
8184
|
+
const {
|
|
8185
|
+
startChatIcon
|
|
8186
|
+
} = useSelector(selectConfig);
|
|
8187
|
+
return startChatIcon;
|
|
8188
|
+
}
|
|
8189
|
+
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
8190
|
+
const CSS_NAME = 'cvco';
|
|
8191
|
+
const apiVersion = '2';
|
|
8192
|
+
const userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
|
|
8193
|
+
// broadcasting to the screen reader. This is done to avoid verbosity.
|
|
8194
|
+
|
|
8195
|
+
const unreadScreenReaderWait = 2000;
|
|
8196
|
+
const newMessageScreenReaderWait = 1000;
|
|
8197
|
+
const screenReaderDebounceDelaySeconds = 10;
|
|
8198
|
+
const activitySendDelay = 15000;
|
|
8199
|
+
const maxCharacterWarningLimit = 50;
|
|
8200
|
+
const maxCharacterSrDebounceDelay = 300;
|
|
8201
|
+
const defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
|
|
8202
|
+
|
|
8203
|
+
const typingTimeout = 2000;
|
|
8204
|
+
const defaultConfig = {
|
|
8205
|
+
namespace: 'default',
|
|
8206
|
+
layoutMode: 'window',
|
|
8207
|
+
// "window", "inline" ("sidebar")
|
|
8208
|
+
messages: {
|
|
8209
|
+
agent: {
|
|
8210
|
+
showAvatar: false,
|
|
8211
|
+
// true, "inline"
|
|
8212
|
+
showName: false
|
|
8213
|
+
},
|
|
8214
|
+
user: {
|
|
8215
|
+
showAvatar: false,
|
|
8216
|
+
// true, "inline"
|
|
8217
|
+
showName: false
|
|
8218
|
+
},
|
|
8219
|
+
timeIndicator: {
|
|
8220
|
+
enabled: false,
|
|
8221
|
+
threshold: 3600000 // Default threshold is an hour in milliseconds
|
|
8222
|
+
|
|
8223
|
+
}
|
|
8224
|
+
}
|
|
8225
|
+
};
|
|
8173
8226
|
;// CONCATENATED MODULE: ./src/javascripts/ui/utils/general-utils.js
|
|
8174
8227
|
function general_utils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8175
8228
|
|
|
@@ -8544,9 +8597,19 @@ const participantReducer = (state, action) => {
|
|
|
8544
8597
|
};
|
|
8545
8598
|
|
|
8546
8599
|
case SET_PARTICIPANT:
|
|
8600
|
+
// TODO: a) Styleguide only! b) Should be removed after styleguide overhaul.
|
|
8601
|
+
if (!state) {
|
|
8602
|
+
return {
|
|
8603
|
+
participants: {},
|
|
8604
|
+
currentAgent: ''
|
|
8605
|
+
};
|
|
8606
|
+
}
|
|
8607
|
+
|
|
8547
8608
|
const {
|
|
8548
8609
|
participants
|
|
8549
|
-
} = state
|
|
8610
|
+
} = state || {
|
|
8611
|
+
participants: {}
|
|
8612
|
+
};
|
|
8550
8613
|
const {
|
|
8551
8614
|
id,
|
|
8552
8615
|
avatar,
|
|
@@ -9089,71 +9152,6 @@ const seamlyStateReducer = (state, action) => {
|
|
|
9089
9152
|
return state;
|
|
9090
9153
|
}
|
|
9091
9154
|
};
|
|
9092
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
function createMiddleware() {
|
|
9096
|
-
return ({
|
|
9097
|
-
dispatch
|
|
9098
|
-
}) => next => action => {
|
|
9099
|
-
var _action$config, _action$config$defaul;
|
|
9100
|
-
|
|
9101
|
-
const result = next(action);
|
|
9102
|
-
|
|
9103
|
-
switch (action.type) {
|
|
9104
|
-
case String(initialize):
|
|
9105
|
-
case String(update):
|
|
9106
|
-
if (action !== null && action !== void 0 && (_action$config = action.config) !== null && _action$config !== void 0 && (_action$config$defaul = _action$config.defaults) !== null && _action$config$defaul !== void 0 && _action$config$defaul.agentName) {
|
|
9107
|
-
var _action$config2, _action$config2$defau;
|
|
9108
|
-
|
|
9109
|
-
dispatch({
|
|
9110
|
-
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
9111
|
-
title: action === null || action === void 0 ? void 0 : (_action$config2 = action.config) === null || _action$config2 === void 0 ? void 0 : (_action$config2$defau = _action$config2.defaults) === null || _action$config2$defau === void 0 ? void 0 : _action$config2$defau.agentName
|
|
9112
|
-
});
|
|
9113
|
-
}
|
|
9114
|
-
|
|
9115
|
-
}
|
|
9116
|
-
|
|
9117
|
-
return result;
|
|
9118
|
-
};
|
|
9119
|
-
}
|
|
9120
|
-
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
9121
|
-
const CSS_NAME = 'cvco';
|
|
9122
|
-
const apiVersion = '2';
|
|
9123
|
-
const userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
|
|
9124
|
-
// broadcasting to the screen reader. This is done to avoid verbosity.
|
|
9125
|
-
|
|
9126
|
-
const unreadScreenReaderWait = 2000;
|
|
9127
|
-
const newMessageScreenReaderWait = 1000;
|
|
9128
|
-
const screenReaderDebounceDelaySeconds = 10;
|
|
9129
|
-
const activitySendDelay = 15000;
|
|
9130
|
-
const maxCharacterWarningLimit = 50;
|
|
9131
|
-
const maxCharacterSrDebounceDelay = 300;
|
|
9132
|
-
const defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
|
|
9133
|
-
|
|
9134
|
-
const typingTimeout = 2000;
|
|
9135
|
-
const defaultConfig = {
|
|
9136
|
-
namespace: 'default',
|
|
9137
|
-
layoutMode: 'window',
|
|
9138
|
-
// "window", "inline" ("sidebar")
|
|
9139
|
-
messages: {
|
|
9140
|
-
agent: {
|
|
9141
|
-
showAvatar: false,
|
|
9142
|
-
// true, "inline"
|
|
9143
|
-
showName: false
|
|
9144
|
-
},
|
|
9145
|
-
user: {
|
|
9146
|
-
showAvatar: false,
|
|
9147
|
-
// true, "inline"
|
|
9148
|
-
showName: false
|
|
9149
|
-
},
|
|
9150
|
-
timeIndicator: {
|
|
9151
|
-
enabled: false,
|
|
9152
|
-
threshold: 3600000 // Default threshold is an hour in milliseconds
|
|
9153
|
-
|
|
9154
|
-
}
|
|
9155
|
-
}
|
|
9156
|
-
};
|
|
9157
9155
|
;// CONCATENATED MODULE: ./src/javascripts/lib/mutex.js
|
|
9158
9156
|
function createMutex() {
|
|
9159
9157
|
let isRunning = false;
|
|
@@ -9570,7 +9568,10 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
9570
9568
|
const {
|
|
9571
9569
|
features,
|
|
9572
9570
|
defaultLocale,
|
|
9573
|
-
preChat
|
|
9571
|
+
preChat,
|
|
9572
|
+
agentParticipant,
|
|
9573
|
+
userParticipant,
|
|
9574
|
+
startChatIcon
|
|
9574
9575
|
} = await api.getConfig();
|
|
9575
9576
|
dispatch({
|
|
9576
9577
|
type: seamlyActions.SET_FEATURES,
|
|
@@ -9582,6 +9583,18 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
9582
9583
|
type: 'message',
|
|
9583
9584
|
payload
|
|
9584
9585
|
}))));
|
|
9586
|
+
dispatch(update({
|
|
9587
|
+
agentParticipant,
|
|
9588
|
+
userParticipant,
|
|
9589
|
+
startChatIcon
|
|
9590
|
+
}));
|
|
9591
|
+
|
|
9592
|
+
if (agentParticipant !== null && agentParticipant !== void 0 && agentParticipant.name) {
|
|
9593
|
+
dispatch({
|
|
9594
|
+
type: seamlyActions.SET_HEADER_TITLE,
|
|
9595
|
+
title: agentParticipant.name
|
|
9596
|
+
});
|
|
9597
|
+
}
|
|
9585
9598
|
} catch (e) {
|
|
9586
9599
|
throw new SeamlyUnavailableError();
|
|
9587
9600
|
}
|
|
@@ -9654,7 +9667,7 @@ const initialState = reducer_objectSpread(reducer_objectSpread({}, defaultConfig
|
|
|
9654
9667
|
preChatEvents: []
|
|
9655
9668
|
});
|
|
9656
9669
|
|
|
9657
|
-
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback'];
|
|
9670
|
+
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
|
|
9658
9671
|
|
|
9659
9672
|
const updateState = (state, {
|
|
9660
9673
|
config
|
|
@@ -9702,7 +9715,6 @@ const updateState = (state, {
|
|
|
9702
9715
|
|
|
9703
9716
|
|
|
9704
9717
|
|
|
9705
|
-
|
|
9706
9718
|
;// CONCATENATED MODULE: ./src/javascripts/lib/css.js
|
|
9707
9719
|
|
|
9708
9720
|
/**
|
|
@@ -10934,7 +10946,7 @@ class SeamlyUnauthorizedError extends SeamlyBaseError {
|
|
|
10934
10946
|
|
|
10935
10947
|
|
|
10936
10948
|
const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
|
|
10937
|
-
function
|
|
10949
|
+
function createMiddleware({
|
|
10938
10950
|
api
|
|
10939
10951
|
}) {
|
|
10940
10952
|
return () => next => action => {
|
|
@@ -11976,7 +11988,7 @@ function useTranslationsContainer() {
|
|
|
11976
11988
|
|
|
11977
11989
|
|
|
11978
11990
|
|
|
11979
|
-
function
|
|
11991
|
+
function middleware_createMiddleware() {
|
|
11980
11992
|
return ({
|
|
11981
11993
|
dispatch,
|
|
11982
11994
|
getState
|
|
@@ -13537,7 +13549,7 @@ const SuggestionsList = ({
|
|
|
13537
13549
|
className: givenClassName,
|
|
13538
13550
|
suggestions = [],
|
|
13539
13551
|
onClickSuggestion,
|
|
13540
|
-
hasIcon
|
|
13552
|
+
hasIcon = true
|
|
13541
13553
|
}) => {
|
|
13542
13554
|
return (0,jsx_runtime_namespaceObject.jsx)("ul", {
|
|
13543
13555
|
className: css_className('suggestions__list', givenClassName),
|
|
@@ -13697,7 +13709,6 @@ const Suggestions = ({
|
|
|
13697
13709
|
className: css_className('suggestions__heading'),
|
|
13698
13710
|
children: headingText
|
|
13699
13711
|
}), !!renderedSuggestions.length && (0,jsx_runtime_namespaceObject.jsx)(suggestions_list, {
|
|
13700
|
-
hasIcon: true,
|
|
13701
13712
|
suggestions: renderedSuggestions,
|
|
13702
13713
|
onClickSuggestion: handleClick
|
|
13703
13714
|
}), footerText && !isOpen && (0,jsx_runtime_namespaceObject.jsx)("p", {
|
|
@@ -14067,26 +14078,26 @@ const Event = ({
|
|
|
14067
14078
|
|
|
14068
14079
|
|
|
14069
14080
|
|
|
14081
|
+
|
|
14070
14082
|
const EventParticipant = ({
|
|
14071
14083
|
eventPayload
|
|
14072
14084
|
}) => {
|
|
14085
|
+
const {
|
|
14086
|
+
t
|
|
14087
|
+
} = useI18n();
|
|
14073
14088
|
const {
|
|
14074
14089
|
fromClient,
|
|
14075
14090
|
participant: participantId
|
|
14076
14091
|
} = eventPayload;
|
|
14077
14092
|
const participant = useSeamlyParticipant(participantId) || {};
|
|
14078
14093
|
const {
|
|
14079
|
-
messages
|
|
14080
|
-
defaults
|
|
14094
|
+
messages
|
|
14081
14095
|
} = useConfig();
|
|
14082
|
-
const participantName = participant && participant.name;
|
|
14096
|
+
const participantName = fromClient ? t('participants.user.name') : participant && participant.name;
|
|
14083
14097
|
const {
|
|
14084
14098
|
showAvatar,
|
|
14085
14099
|
showName
|
|
14086
14100
|
} = messages[fromClient ? 'user' : 'agent'] || {};
|
|
14087
|
-
const {
|
|
14088
|
-
userName
|
|
14089
|
-
} = defaults || {};
|
|
14090
14101
|
|
|
14091
14102
|
if (!showAvatar && !showName) {
|
|
14092
14103
|
return null;
|
|
@@ -14105,12 +14116,10 @@ const EventParticipant = ({
|
|
|
14105
14116
|
}));
|
|
14106
14117
|
}
|
|
14107
14118
|
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
if (showName && authorName) {
|
|
14119
|
+
if (showName) {
|
|
14111
14120
|
authorInfo.push((0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
14112
14121
|
className: css_className('message__author-name'),
|
|
14113
|
-
children:
|
|
14122
|
+
children: participantName
|
|
14114
14123
|
}));
|
|
14115
14124
|
}
|
|
14116
14125
|
|
|
@@ -19466,8 +19475,8 @@ const Participant = ({
|
|
|
19466
19475
|
event
|
|
19467
19476
|
}) => {
|
|
19468
19477
|
const {
|
|
19469
|
-
|
|
19470
|
-
} =
|
|
19478
|
+
agent
|
|
19479
|
+
} = useParticipants();
|
|
19471
19480
|
const {
|
|
19472
19481
|
participant
|
|
19473
19482
|
} = event.payload;
|
|
@@ -19480,7 +19489,7 @@ const Participant = ({
|
|
|
19480
19489
|
return null;
|
|
19481
19490
|
}
|
|
19482
19491
|
|
|
19483
|
-
const avatar = participant.avatar ||
|
|
19492
|
+
const avatar = participant.avatar || (agent === null || agent === void 0 ? void 0 : agent.avatar);
|
|
19484
19493
|
return (0,jsx_runtime_namespaceObject.jsx)(EventDivider, {
|
|
19485
19494
|
graphicSrc: avatar,
|
|
19486
19495
|
graphicType: participant.avatar ? 'avatar' : undefined,
|
|
@@ -21830,7 +21839,7 @@ function ChatFrame({
|
|
|
21830
21839
|
children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationsChatStatus, {}), (0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
21831
21840
|
className: css_className('chat__container'),
|
|
21832
21841
|
children: getContent()
|
|
21833
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
|
|
21842
|
+
}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
|
|
21834
21843
|
});
|
|
21835
21844
|
}
|
|
21836
21845
|
|
|
@@ -21863,7 +21872,6 @@ const AppView = () => {
|
|
|
21863
21872
|
|
|
21864
21873
|
|
|
21865
21874
|
|
|
21866
|
-
|
|
21867
21875
|
function PreChatMessages() {
|
|
21868
21876
|
const {
|
|
21869
21877
|
preChatEvents,
|
|
@@ -21876,19 +21884,15 @@ function PreChatMessages() {
|
|
|
21876
21884
|
isOpen
|
|
21877
21885
|
} = useVisibility();
|
|
21878
21886
|
const isVisible = !(hasInterrupt || !preChatEvents.length || isOpen);
|
|
21879
|
-
return (0,jsx_runtime_namespaceObject.jsx)(
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
children: (0,jsx_runtime_namespaceObject.jsx)("
|
|
21883
|
-
className: css_className('pre-chat-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
event: event
|
|
21889
|
-
})
|
|
21890
|
-
}, event.payload.id))
|
|
21891
|
-
})
|
|
21887
|
+
return isVisible && (0,jsx_runtime_namespaceObject.jsx)("ul", {
|
|
21888
|
+
className: css_className('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
|
|
21889
|
+
"aria-hidden": !isVisible,
|
|
21890
|
+
children: preChatEvents.map(event => (0,jsx_runtime_namespaceObject.jsx)("li", {
|
|
21891
|
+
className: css_className('pre-chat-messages__message'),
|
|
21892
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(PreChatMessageEvent, {
|
|
21893
|
+
event: event
|
|
21894
|
+
})
|
|
21895
|
+
}, event.payload.id))
|
|
21892
21896
|
});
|
|
21893
21897
|
}
|
|
21894
21898
|
function PreChatMessageEvent({
|
|
@@ -21941,7 +21945,7 @@ const InlineView = () => {
|
|
|
21941
21945
|
isActive: !isOpen,
|
|
21942
21946
|
transitionStartState: transitionStartStates.rendered,
|
|
21943
21947
|
children: (0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
21944
|
-
className: css_className('unstarted-wrapper'),
|
|
21948
|
+
className: css_className('unstarted-wrapper', 'unstarted-wrapper--inline'),
|
|
21945
21949
|
children: [(0,jsx_runtime_namespaceObject.jsx)(PreChatMessages, {}), (0,jsx_runtime_namespaceObject.jsx)(suggestions, {})]
|
|
21946
21950
|
})
|
|
21947
21951
|
}), (0,jsx_runtime_namespaceObject.jsx)(in_out_transition, {
|
|
@@ -21973,18 +21977,16 @@ const InlineView = () => {
|
|
|
21973
21977
|
|
|
21974
21978
|
|
|
21975
21979
|
const ButtonIcon = () => {
|
|
21980
|
+
const startChatIcon = useStartChatIcon();
|
|
21976
21981
|
const currentAgent = useSeamlyCurrentAgent();
|
|
21977
21982
|
const {
|
|
21978
21983
|
hasInterrupt
|
|
21979
21984
|
} = useInterrupt();
|
|
21980
|
-
const
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
return avatar || startChatIcon ? (0,jsx_runtime_namespaceObject.jsx)("img", {
|
|
21986
|
-
className: css_className(avatar ? 'avatar' : 'icon'),
|
|
21987
|
-
src: avatar || startChatIcon,
|
|
21985
|
+
const isActiveConversation = currentAgent && !hasInterrupt;
|
|
21986
|
+
const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
|
|
21987
|
+
return src ? (0,jsx_runtime_namespaceObject.jsx)("img", {
|
|
21988
|
+
className: css_className(isActiveConversation ? 'avatar' : 'icon'),
|
|
21989
|
+
src: src,
|
|
21988
21990
|
alt: ""
|
|
21989
21991
|
}) : (0,jsx_runtime_namespaceObject.jsx)(icon, {
|
|
21990
21992
|
name: "avatar",
|
|
@@ -22110,7 +22112,7 @@ const WindowView = () => {
|
|
|
22110
22112
|
transitionStartState: transitionStartStates.notRendered,
|
|
22111
22113
|
children: (0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
22112
22114
|
className: css_className('unstarted-wrapper', 'unstarted-wrapper--window', 'unstarted-wrapper--continue'),
|
|
22113
|
-
children: (0,jsx_runtime_namespaceObject.jsx)(
|
|
22115
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(event_text, {
|
|
22114
22116
|
event: continueChatEvent
|
|
22115
22117
|
})
|
|
22116
22118
|
})
|
|
@@ -24646,10 +24648,11 @@ function producer_defineProperty(obj, key, value) { if (key in obj) { Object.def
|
|
|
24646
24648
|
|
|
24647
24649
|
const log = debug_default()('seamly');
|
|
24648
24650
|
class ConversationProducer {
|
|
24649
|
-
constructor(url, channelName, accessToken) {
|
|
24651
|
+
constructor(url, channelName, channelTopic, accessToken) {
|
|
24650
24652
|
this.url = url;
|
|
24651
24653
|
this.accessToken = accessToken;
|
|
24652
24654
|
this.channelName = channelName;
|
|
24655
|
+
this.channelTopic = channelTopic;
|
|
24653
24656
|
this.connect();
|
|
24654
24657
|
this.socket.onError(err => {
|
|
24655
24658
|
log('[SOCKET][ERROR]', err);
|
|
@@ -24669,7 +24672,7 @@ class ConversationProducer {
|
|
|
24669
24672
|
});
|
|
24670
24673
|
this.channel.on('system', msg => {
|
|
24671
24674
|
switch (msg.type) {
|
|
24672
|
-
case '
|
|
24675
|
+
case 'attach_channel_succeeded':
|
|
24673
24676
|
this.emit({
|
|
24674
24677
|
type: 'connection',
|
|
24675
24678
|
connected: true,
|
|
@@ -24759,8 +24762,9 @@ class ConversationProducer {
|
|
|
24759
24762
|
})
|
|
24760
24763
|
});
|
|
24761
24764
|
this.socket.connect();
|
|
24762
|
-
this.channel = this.socket.channel(this.
|
|
24763
|
-
authorization: `Bearer ${this.accessToken}
|
|
24765
|
+
this.channel = this.socket.channel(this.channelTopic, {
|
|
24766
|
+
authorization: `Bearer ${this.accessToken}`,
|
|
24767
|
+
channelName: this.channelName
|
|
24764
24768
|
});
|
|
24765
24769
|
}
|
|
24766
24770
|
|
|
@@ -24936,7 +24940,8 @@ class API {
|
|
|
24936
24940
|
* @param {string} config.externalId Unique visitor identifier (optional)
|
|
24937
24941
|
* @param {boolean} config.sendEnvironment
|
|
24938
24942
|
* @param {string} namespace
|
|
24939
|
-
* @param {Object} [context={ variables: undefined, locale: undefined }]
|
|
24943
|
+
* @param {Object} [context={ channelName: undefined, variables: undefined, locale: undefined }]
|
|
24944
|
+
* @param {string} context.channelName
|
|
24940
24945
|
* @param {object} context.variables
|
|
24941
24946
|
* @param {string} context.locale
|
|
24942
24947
|
* @memberof API
|
|
@@ -24954,7 +24959,9 @@ class API {
|
|
|
24954
24959
|
};
|
|
24955
24960
|
this.config = {
|
|
24956
24961
|
sendEnvironment: config.sendEnvironment ?? true,
|
|
24957
|
-
context
|
|
24962
|
+
context: api_objectSpread(api_objectSpread({}, context), {}, {
|
|
24963
|
+
channelName: context.channelName || 'web'
|
|
24964
|
+
})
|
|
24958
24965
|
};
|
|
24959
24966
|
this.connected = false;
|
|
24960
24967
|
this.configReady = false;
|
|
@@ -24994,18 +25001,22 @@ class API {
|
|
|
24994
25001
|
return !!this.getConversationUrl();
|
|
24995
25002
|
}
|
|
24996
25003
|
|
|
24997
|
-
|
|
24998
|
-
|
|
25004
|
+
getChannelTopic() {
|
|
25005
|
+
// The `channelName` fallback is needed for seamless client upgrades.
|
|
25006
|
+
// TODO: Remove when all clients have been upgraded past v20.
|
|
25007
|
+
return this.store.get('channelTopic') || this.store.get('channelName');
|
|
24999
25008
|
}
|
|
25000
25009
|
|
|
25001
|
-
|
|
25002
|
-
this.store.set('
|
|
25010
|
+
setChannelTopic(topic) {
|
|
25011
|
+
this.store.set('channelTopic', topic);
|
|
25003
25012
|
}
|
|
25004
25013
|
|
|
25005
25014
|
clearStore() {
|
|
25006
25015
|
this.store.delete('accessToken');
|
|
25007
|
-
this.store.delete('conversationUrl');
|
|
25016
|
+
this.store.delete('conversationUrl'); // TODO: Remove `channelName` when all clients have been upgraded past v20.
|
|
25017
|
+
|
|
25008
25018
|
this.store.delete('channelName');
|
|
25019
|
+
this.store.delete('channelTopic');
|
|
25009
25020
|
}
|
|
25010
25021
|
|
|
25011
25022
|
getUrlPrefix(protocol) {
|
|
@@ -25059,9 +25070,9 @@ class API {
|
|
|
25059
25070
|
const initialState = api_objectSpread({}, conversation);
|
|
25060
25071
|
|
|
25061
25072
|
delete initialState.accessToken;
|
|
25062
|
-
delete initialState.
|
|
25073
|
+
delete initialState.channelTopic;
|
|
25063
25074
|
this.setAccessToken(conversation.accessToken);
|
|
25064
|
-
this.
|
|
25075
|
+
this.setChannelTopic(conversation.channelTopic);
|
|
25065
25076
|
this.updateUrls(body);
|
|
25066
25077
|
this.setConversationUrl(this.URLS.conversation);
|
|
25067
25078
|
return initialState;
|
|
@@ -25162,7 +25173,7 @@ class API {
|
|
|
25162
25173
|
conversationInitialState = await this.createConversation();
|
|
25163
25174
|
}
|
|
25164
25175
|
|
|
25165
|
-
this.conversationProducer = new ConversationProducer(`${this.getUrlPrefix('ws')}${this.URLS.socket}`, this.
|
|
25176
|
+
this.conversationProducer = new ConversationProducer(`${this.getUrlPrefix('ws')}${this.URLS.socket}`, this.config.context.channelName, this.getChannelTopic(), this.getAccessToken());
|
|
25166
25177
|
this.internalProducer.emit(xstream_default().create(this.conversationProducer)); // Send environment
|
|
25167
25178
|
|
|
25168
25179
|
if (this.config.sendEnvironment) {
|
|
@@ -25209,7 +25220,7 @@ class API {
|
|
|
25209
25220
|
body
|
|
25210
25221
|
}) => {
|
|
25211
25222
|
this.updateUrls(body);
|
|
25212
|
-
return omit(body.conversation, ['accessToken', '
|
|
25223
|
+
return omit(body.conversation, ['accessToken', 'channelTopic']);
|
|
25213
25224
|
}).catch(error => {
|
|
25214
25225
|
if (error.status === 401) {
|
|
25215
25226
|
throw new SeamlyUnauthorizedError(error);
|
|
@@ -25438,11 +25449,11 @@ function store_createStore({
|
|
|
25438
25449
|
api,
|
|
25439
25450
|
eventBus,
|
|
25440
25451
|
config
|
|
25441
|
-
}), createMiddleware(
|
|
25452
|
+
}), createMiddleware({
|
|
25442
25453
|
api
|
|
25443
25454
|
}), options_middleware_createMiddleware({
|
|
25444
25455
|
api
|
|
25445
|
-
}),
|
|
25456
|
+
}), middleware_createMiddleware()]
|
|
25446
25457
|
});
|
|
25447
25458
|
return store;
|
|
25448
25459
|
}
|
|
@@ -25478,8 +25489,8 @@ class Engine {
|
|
|
25478
25489
|
restConfig = engine_objectWithoutProperties(config, engine_excluded);
|
|
25479
25490
|
|
|
25480
25491
|
this.config = engine_objectSpread(engine_objectSpread({}, restConfig), {}, {
|
|
25481
|
-
|
|
25482
|
-
|
|
25492
|
+
namespace,
|
|
25493
|
+
showFaq: showFaq !== false
|
|
25483
25494
|
});
|
|
25484
25495
|
this.namespace = namespace;
|
|
25485
25496
|
this.parentElement = parentElement;
|
|
@@ -25773,13 +25784,8 @@ const AgentInfo = () => {
|
|
|
25773
25784
|
const {
|
|
25774
25785
|
hasInterrupt
|
|
25775
25786
|
} = useInterrupt();
|
|
25776
|
-
const
|
|
25777
|
-
|
|
25778
|
-
} = useConfig();
|
|
25779
|
-
const {
|
|
25780
|
-
startChatIcon
|
|
25781
|
-
} = defaults || {};
|
|
25782
|
-
const avatar = currentAgent && !hasInterrupt ? currentAgent.avatar : null;
|
|
25787
|
+
const startChatIcon = useStartChatIcon();
|
|
25788
|
+
const src = (currentAgent === null || currentAgent === void 0 ? void 0 : currentAgent.avatar) ?? startChatIcon;
|
|
25783
25789
|
const displaySubtitle = hasInterrupt ? '' : subTitle;
|
|
25784
25790
|
const classNames = ['message-count'];
|
|
25785
25791
|
|
|
@@ -25791,13 +25797,13 @@ const AgentInfo = () => {
|
|
|
25791
25797
|
classNames.push('message-count__empty');
|
|
25792
25798
|
}
|
|
25793
25799
|
|
|
25794
|
-
return (
|
|
25800
|
+
return (displaySubtitle || !isOpen) && (0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
25795
25801
|
className: css_className('agent-info'),
|
|
25796
25802
|
children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
25797
25803
|
className: css_className('agent-info__graphic'),
|
|
25798
|
-
children: [
|
|
25799
|
-
className: css_className(avatar ? 'avatar' : 'icon'),
|
|
25800
|
-
src:
|
|
25804
|
+
children: [src ? (0,jsx_runtime_namespaceObject.jsx)("img", {
|
|
25805
|
+
className: css_className(currentAgent !== null && currentAgent !== void 0 && currentAgent.avatar ? 'avatar' : 'icon'),
|
|
25806
|
+
src: src,
|
|
25801
25807
|
alt: ""
|
|
25802
25808
|
}) : (0,jsx_runtime_namespaceObject.jsx)(icon, {
|
|
25803
25809
|
name: "avatar",
|