@seamly/web-ui 20.0.0-beta.6 → 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 +11 -22
- 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 +109 -106
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +125 -122
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +105 -91
- package/build/dist/lib/style-guide.min.js +1 -1
- package/package.json +1 -2
- 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/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 +23 -41
- package/src/javascripts/style-guide/style-guide-engine.js +13 -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/view/window-view/window-open-button.js +7 -7
- package/src/javascripts/ui/utils/seamly-utils.js +9 -2
- 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
|
|
@@ -14066,26 +14078,26 @@ const Event = ({
|
|
|
14066
14078
|
|
|
14067
14079
|
|
|
14068
14080
|
|
|
14081
|
+
|
|
14069
14082
|
const EventParticipant = ({
|
|
14070
14083
|
eventPayload
|
|
14071
14084
|
}) => {
|
|
14085
|
+
const {
|
|
14086
|
+
t
|
|
14087
|
+
} = useI18n();
|
|
14072
14088
|
const {
|
|
14073
14089
|
fromClient,
|
|
14074
14090
|
participant: participantId
|
|
14075
14091
|
} = eventPayload;
|
|
14076
14092
|
const participant = useSeamlyParticipant(participantId) || {};
|
|
14077
14093
|
const {
|
|
14078
|
-
messages
|
|
14079
|
-
defaults
|
|
14094
|
+
messages
|
|
14080
14095
|
} = useConfig();
|
|
14081
|
-
const participantName = participant && participant.name;
|
|
14096
|
+
const participantName = fromClient ? t('participants.user.name') : participant && participant.name;
|
|
14082
14097
|
const {
|
|
14083
14098
|
showAvatar,
|
|
14084
14099
|
showName
|
|
14085
14100
|
} = messages[fromClient ? 'user' : 'agent'] || {};
|
|
14086
|
-
const {
|
|
14087
|
-
userName
|
|
14088
|
-
} = defaults || {};
|
|
14089
14101
|
|
|
14090
14102
|
if (!showAvatar && !showName) {
|
|
14091
14103
|
return null;
|
|
@@ -14104,12 +14116,10 @@ const EventParticipant = ({
|
|
|
14104
14116
|
}));
|
|
14105
14117
|
}
|
|
14106
14118
|
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
if (showName && authorName) {
|
|
14119
|
+
if (showName) {
|
|
14110
14120
|
authorInfo.push((0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
14111
14121
|
className: css_className('message__author-name'),
|
|
14112
|
-
children:
|
|
14122
|
+
children: participantName
|
|
14113
14123
|
}));
|
|
14114
14124
|
}
|
|
14115
14125
|
|
|
@@ -19465,8 +19475,8 @@ const Participant = ({
|
|
|
19465
19475
|
event
|
|
19466
19476
|
}) => {
|
|
19467
19477
|
const {
|
|
19468
|
-
|
|
19469
|
-
} =
|
|
19478
|
+
agent
|
|
19479
|
+
} = useParticipants();
|
|
19470
19480
|
const {
|
|
19471
19481
|
participant
|
|
19472
19482
|
} = event.payload;
|
|
@@ -19479,7 +19489,7 @@ const Participant = ({
|
|
|
19479
19489
|
return null;
|
|
19480
19490
|
}
|
|
19481
19491
|
|
|
19482
|
-
const avatar = participant.avatar ||
|
|
19492
|
+
const avatar = participant.avatar || (agent === null || agent === void 0 ? void 0 : agent.avatar);
|
|
19483
19493
|
return (0,jsx_runtime_namespaceObject.jsx)(EventDivider, {
|
|
19484
19494
|
graphicSrc: avatar,
|
|
19485
19495
|
graphicType: participant.avatar ? 'avatar' : undefined,
|
|
@@ -21829,7 +21839,7 @@ function ChatFrame({
|
|
|
21829
21839
|
children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationsChatStatus, {}), (0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
21830
21840
|
className: css_className('chat__container'),
|
|
21831
21841
|
children: getContent()
|
|
21832
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
|
|
21842
|
+
}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
|
|
21833
21843
|
});
|
|
21834
21844
|
}
|
|
21835
21845
|
|
|
@@ -21967,18 +21977,16 @@ const InlineView = () => {
|
|
|
21967
21977
|
|
|
21968
21978
|
|
|
21969
21979
|
const ButtonIcon = () => {
|
|
21980
|
+
const startChatIcon = useStartChatIcon();
|
|
21970
21981
|
const currentAgent = useSeamlyCurrentAgent();
|
|
21971
21982
|
const {
|
|
21972
21983
|
hasInterrupt
|
|
21973
21984
|
} = useInterrupt();
|
|
21974
|
-
const
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
return avatar || startChatIcon ? (0,jsx_runtime_namespaceObject.jsx)("img", {
|
|
21980
|
-
className: css_className(avatar ? 'avatar' : 'icon'),
|
|
21981
|
-
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,
|
|
21982
21990
|
alt: ""
|
|
21983
21991
|
}) : (0,jsx_runtime_namespaceObject.jsx)(icon, {
|
|
21984
21992
|
name: "avatar",
|
|
@@ -25441,11 +25449,11 @@ function store_createStore({
|
|
|
25441
25449
|
api,
|
|
25442
25450
|
eventBus,
|
|
25443
25451
|
config
|
|
25444
|
-
}), createMiddleware(
|
|
25452
|
+
}), createMiddleware({
|
|
25445
25453
|
api
|
|
25446
25454
|
}), options_middleware_createMiddleware({
|
|
25447
25455
|
api
|
|
25448
|
-
}),
|
|
25456
|
+
}), middleware_createMiddleware()]
|
|
25449
25457
|
});
|
|
25450
25458
|
return store;
|
|
25451
25459
|
}
|
|
@@ -25776,13 +25784,8 @@ const AgentInfo = () => {
|
|
|
25776
25784
|
const {
|
|
25777
25785
|
hasInterrupt
|
|
25778
25786
|
} = useInterrupt();
|
|
25779
|
-
const
|
|
25780
|
-
|
|
25781
|
-
} = useConfig();
|
|
25782
|
-
const {
|
|
25783
|
-
startChatIcon
|
|
25784
|
-
} = defaults || {};
|
|
25785
|
-
const avatar = currentAgent && !hasInterrupt ? currentAgent.avatar : null;
|
|
25787
|
+
const startChatIcon = useStartChatIcon();
|
|
25788
|
+
const src = (currentAgent === null || currentAgent === void 0 ? void 0 : currentAgent.avatar) ?? startChatIcon;
|
|
25786
25789
|
const displaySubtitle = hasInterrupt ? '' : subTitle;
|
|
25787
25790
|
const classNames = ['message-count'];
|
|
25788
25791
|
|
|
@@ -25794,13 +25797,13 @@ const AgentInfo = () => {
|
|
|
25794
25797
|
classNames.push('message-count__empty');
|
|
25795
25798
|
}
|
|
25796
25799
|
|
|
25797
|
-
return (
|
|
25800
|
+
return (displaySubtitle || !isOpen) && (0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
25798
25801
|
className: css_className('agent-info'),
|
|
25799
25802
|
children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
25800
25803
|
className: css_className('agent-info__graphic'),
|
|
25801
|
-
children: [
|
|
25802
|
-
className: css_className(avatar ? 'avatar' : 'icon'),
|
|
25803
|
-
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,
|
|
25804
25807
|
alt: ""
|
|
25805
25808
|
}) : (0,jsx_runtime_namespaceObject.jsx)(icon, {
|
|
25806
25809
|
name: "avatar",
|