@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.
Files changed (27) hide show
  1. package/build/dist/lib/index.debug.js +11 -22
  2. package/build/dist/lib/index.debug.min.js +1 -1
  3. package/build/dist/lib/index.debug.min.js.LICENSE.txt +0 -4
  4. package/build/dist/lib/index.js +109 -106
  5. package/build/dist/lib/index.min.js +1 -1
  6. package/build/dist/lib/standalone.js +125 -122
  7. package/build/dist/lib/standalone.min.js +1 -1
  8. package/build/dist/lib/style-guide.js +105 -91
  9. package/build/dist/lib/style-guide.min.js +1 -1
  10. package/package.json +1 -2
  11. package/src/javascripts/domains/app/actions.js +23 -1
  12. package/src/javascripts/domains/config/hooks.js +17 -0
  13. package/src/javascripts/domains/config/index.js +0 -1
  14. package/src/javascripts/domains/config/reducer.js +4 -0
  15. package/src/javascripts/domains/store/index.js +1 -5
  16. package/src/javascripts/style-guide/components/app.js +8 -4
  17. package/src/javascripts/style-guide/components/static-core.js +19 -2
  18. package/src/javascripts/style-guide/components/view.js +16 -3
  19. package/src/javascripts/style-guide/states.js +23 -41
  20. package/src/javascripts/style-guide/style-guide-engine.js +13 -1
  21. package/src/javascripts/ui/components/conversation/event/event-participant.js +10 -7
  22. package/src/javascripts/ui/components/conversation/event/participant.js +3 -3
  23. package/src/javascripts/ui/components/layout/agent-info.js +7 -11
  24. package/src/javascripts/ui/components/layout/chat-frame.js +1 -1
  25. package/src/javascripts/ui/components/view/window-view/window-open-button.js +7 -7
  26. package/src/javascripts/ui/utils/seamly-utils.js +9 -2
  27. package/src/javascripts/domains/config/middleware.js +0 -22
@@ -3164,7 +3164,7 @@ module.exports = entryVirtual('Array').map;
3164
3164
  /***/ 2999:
3165
3165
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
3166
3166
 
3167
- __webpack_require__(9407);
3167
+ __webpack_require__(1876);
3168
3168
  var entryVirtual = __webpack_require__(5703);
3169
3169
 
3170
3170
  module.exports = entryVirtual('Array').reduce;
@@ -3172,7 +3172,7 @@ module.exports = entryVirtual('Array').reduce;
3172
3172
 
3173
3173
  /***/ }),
3174
3174
 
3175
- /***/ 1876:
3175
+ /***/ 5573:
3176
3176
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
3177
3177
 
3178
3178
  __webpack_require__(1490);
@@ -3426,7 +3426,7 @@ module.exports = function (it) {
3426
3426
  /***/ 1060:
3427
3427
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
3428
3428
 
3429
- var reverse = __webpack_require__(1876);
3429
+ var reverse = __webpack_require__(5573);
3430
3430
 
3431
3431
  var ArrayPrototype = Array.prototype;
3432
3432
 
@@ -7850,7 +7850,7 @@ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
7850
7850
 
7851
7851
  /***/ }),
7852
7852
 
7853
- /***/ 9407:
7853
+ /***/ 1876:
7854
7854
  /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
7855
7855
 
7856
7856
  "use strict";
@@ -15833,24 +15833,68 @@ const useSelectorWithProps = function useSelectorWithProps(selector, props, inpu
15833
15833
  function useConfig() {
15834
15834
  return useSelector(selectConfig);
15835
15835
  }
15836
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/sort.js
15837
- var sort = __webpack_require__(7302);
15838
- var sort_default = /*#__PURE__*/__webpack_require__.n(sort);
15839
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/reverse.js
15840
- var reverse = __webpack_require__(7093);
15841
- var reverse_default = /*#__PURE__*/__webpack_require__.n(reverse);
15842
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/find.js
15843
- var find = __webpack_require__(4473);
15844
- var find_default = /*#__PURE__*/__webpack_require__.n(find);
15845
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js
15846
- var instance_index_of = __webpack_require__(1643);
15847
- var instance_index_of_default = /*#__PURE__*/__webpack_require__.n(instance_index_of);
15836
+ function useParticipants() {
15837
+ const {
15838
+ agentParticipant,
15839
+ userParticipant
15840
+ } = useSelector(selectConfig);
15841
+ return {
15842
+ agent: agentParticipant,
15843
+ user: userParticipant
15844
+ };
15845
+ }
15846
+ function useStartChatIcon() {
15847
+ const {
15848
+ startChatIcon
15849
+ } = useSelector(selectConfig);
15850
+ return startChatIcon;
15851
+ }
15852
+ ;// CONCATENATED MODULE: ./src/javascripts/config.js
15853
+ const CSS_NAME = 'cvco';
15854
+ const apiVersion = '2';
15855
+ const userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
15856
+ // broadcasting to the screen reader. This is done to avoid verbosity.
15857
+
15858
+ const unreadScreenReaderWait = 2000;
15859
+ const newMessageScreenReaderWait = 1000;
15860
+ const screenReaderDebounceDelaySeconds = 10;
15861
+ const activitySendDelay = 15000;
15862
+ const maxCharacterWarningLimit = 50;
15863
+ const maxCharacterSrDebounceDelay = 300;
15864
+ const defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
15865
+
15866
+ const typingTimeout = 2000;
15867
+ const defaultConfig = {
15868
+ namespace: 'default',
15869
+ layoutMode: 'window',
15870
+ // "window", "inline" ("sidebar")
15871
+ messages: {
15872
+ agent: {
15873
+ showAvatar: false,
15874
+ // true, "inline"
15875
+ showName: false
15876
+ },
15877
+ user: {
15878
+ showAvatar: false,
15879
+ // true, "inline"
15880
+ showName: false
15881
+ },
15882
+ timeIndicator: {
15883
+ enabled: false,
15884
+ threshold: 3600000 // Default threshold is an hour in milliseconds
15885
+
15886
+ }
15887
+ }
15888
+ };
15848
15889
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/set-timeout.js
15849
15890
  var set_timeout = __webpack_require__(3032);
15850
15891
  var set_timeout_default = /*#__PURE__*/__webpack_require__.n(set_timeout);
15851
15892
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/parse-float.js
15852
15893
  var parse_float = __webpack_require__(1238);
15853
15894
  var parse_float_default = /*#__PURE__*/__webpack_require__.n(parse_float);
15895
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js
15896
+ var instance_index_of = __webpack_require__(1643);
15897
+ var instance_index_of_default = /*#__PURE__*/__webpack_require__.n(instance_index_of);
15854
15898
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/reduce.js
15855
15899
  var reduce = __webpack_require__(2366);
15856
15900
  var reduce_default = /*#__PURE__*/__webpack_require__.n(reduce);
@@ -16068,6 +16112,15 @@ const omit = (obj, keys) => {
16068
16112
  return accum;
16069
16113
  }, {});
16070
16114
  };
16115
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/sort.js
16116
+ var sort = __webpack_require__(7302);
16117
+ var sort_default = /*#__PURE__*/__webpack_require__.n(sort);
16118
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/reverse.js
16119
+ var reverse = __webpack_require__(7093);
16120
+ var reverse_default = /*#__PURE__*/__webpack_require__.n(reverse);
16121
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/find.js
16122
+ var find = __webpack_require__(4473);
16123
+ var find_default = /*#__PURE__*/__webpack_require__.n(find);
16071
16124
  ;// CONCATENATED MODULE: ./src/javascripts/ui/utils/seamly-utils.js
16072
16125
 
16073
16126
 
@@ -16273,9 +16326,19 @@ const participantReducer = (state, action) => {
16273
16326
  };
16274
16327
 
16275
16328
  case SET_PARTICIPANT:
16329
+ // TODO: a) Styleguide only! b) Should be removed after styleguide overhaul.
16330
+ if (!state) {
16331
+ return {
16332
+ participants: {},
16333
+ currentAgent: ''
16334
+ };
16335
+ }
16336
+
16276
16337
  const {
16277
16338
  participants
16278
- } = state;
16339
+ } = state || {
16340
+ participants: {}
16341
+ };
16279
16342
  const {
16280
16343
  id,
16281
16344
  avatar,
@@ -16824,71 +16887,6 @@ const seamlyStateReducer = (state, action) => {
16824
16887
  return state;
16825
16888
  }
16826
16889
  };
16827
- ;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
16828
-
16829
-
16830
- function createMiddleware() {
16831
- return ({
16832
- dispatch
16833
- }) => next => action => {
16834
- var _action$config, _action$config$defaul;
16835
-
16836
- const result = next(action);
16837
-
16838
- switch (action.type) {
16839
- case String(initialize):
16840
- case String(update):
16841
- 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) {
16842
- var _action$config2, _action$config2$defau;
16843
-
16844
- dispatch({
16845
- type: seamlyActions.SET_HEADER_SUB_TITLE,
16846
- 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
16847
- });
16848
- }
16849
-
16850
- }
16851
-
16852
- return result;
16853
- };
16854
- }
16855
- ;// CONCATENATED MODULE: ./src/javascripts/config.js
16856
- const CSS_NAME = 'cvco';
16857
- const apiVersion = '2';
16858
- const userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
16859
- // broadcasting to the screen reader. This is done to avoid verbosity.
16860
-
16861
- const unreadScreenReaderWait = 2000;
16862
- const newMessageScreenReaderWait = 1000;
16863
- const screenReaderDebounceDelaySeconds = 10;
16864
- const activitySendDelay = 15000;
16865
- const maxCharacterWarningLimit = 50;
16866
- const maxCharacterSrDebounceDelay = 300;
16867
- const defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
16868
-
16869
- const typingTimeout = 2000;
16870
- const defaultConfig = {
16871
- namespace: 'default',
16872
- layoutMode: 'window',
16873
- // "window", "inline" ("sidebar")
16874
- messages: {
16875
- agent: {
16876
- showAvatar: false,
16877
- // true, "inline"
16878
- showName: false
16879
- },
16880
- user: {
16881
- showAvatar: false,
16882
- // true, "inline"
16883
- showName: false
16884
- },
16885
- timeIndicator: {
16886
- enabled: false,
16887
- threshold: 3600000 // Default threshold is an hour in milliseconds
16888
-
16889
- }
16890
- }
16891
- };
16892
16890
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/promise.js
16893
16891
  var promise = __webpack_require__(3476);
16894
16892
  var promise_default = /*#__PURE__*/__webpack_require__.n(promise);
@@ -17334,7 +17332,10 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
17334
17332
  const {
17335
17333
  features,
17336
17334
  defaultLocale,
17337
- preChat
17335
+ preChat,
17336
+ agentParticipant,
17337
+ userParticipant,
17338
+ startChatIcon
17338
17339
  } = await api.getConfig();
17339
17340
  dispatch({
17340
17341
  type: seamlyActions.SET_FEATURES,
@@ -17346,6 +17347,18 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
17346
17347
  type: 'message',
17347
17348
  payload
17348
17349
  }))));
17350
+ dispatch(update({
17351
+ agentParticipant,
17352
+ userParticipant,
17353
+ startChatIcon
17354
+ }));
17355
+
17356
+ if (agentParticipant !== null && agentParticipant !== void 0 && agentParticipant.name) {
17357
+ dispatch({
17358
+ type: seamlyActions.SET_HEADER_TITLE,
17359
+ title: agentParticipant.name
17360
+ });
17361
+ }
17349
17362
  } catch (e) {
17350
17363
  throw new SeamlyUnavailableError();
17351
17364
  }
@@ -17422,7 +17435,7 @@ const initialState = reducer_objectSpread(reducer_objectSpread({}, defaultConfig
17422
17435
  preChatEvents: []
17423
17436
  });
17424
17437
 
17425
- const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback'];
17438
+ const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
17426
17439
 
17427
17440
  const updateState = (state, {
17428
17441
  config
@@ -17470,7 +17483,6 @@ const updateState = (state, {
17470
17483
 
17471
17484
 
17472
17485
 
17473
-
17474
17486
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/flat.js
17475
17487
  var flat = __webpack_require__(6423);
17476
17488
  var flat_default = /*#__PURE__*/__webpack_require__.n(flat);
@@ -18767,7 +18779,7 @@ class SeamlyUnauthorizedError extends SeamlyBaseError {
18767
18779
 
18768
18780
 
18769
18781
  const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
18770
- function middleware_createMiddleware({
18782
+ function createMiddleware({
18771
18783
  api
18772
18784
  }) {
18773
18785
  return () => next => action => {
@@ -19872,7 +19884,7 @@ function useTranslationsContainer() {
19872
19884
 
19873
19885
 
19874
19886
 
19875
- function translations_middleware_createMiddleware() {
19887
+ function middleware_createMiddleware() {
19876
19888
  return ({
19877
19889
  dispatch,
19878
19890
  getState
@@ -22072,26 +22084,26 @@ const Event = ({
22072
22084
 
22073
22085
 
22074
22086
 
22087
+
22075
22088
  const EventParticipant = ({
22076
22089
  eventPayload
22077
22090
  }) => {
22091
+ const {
22092
+ t
22093
+ } = useI18n();
22078
22094
  const {
22079
22095
  fromClient,
22080
22096
  participant: participantId
22081
22097
  } = eventPayload;
22082
22098
  const participant = useSeamlyParticipant(participantId) || {};
22083
22099
  const {
22084
- messages,
22085
- defaults
22100
+ messages
22086
22101
  } = useConfig();
22087
- const participantName = participant && participant.name;
22102
+ const participantName = fromClient ? t('participants.user.name') : participant && participant.name;
22088
22103
  const {
22089
22104
  showAvatar,
22090
22105
  showName
22091
22106
  } = messages[fromClient ? 'user' : 'agent'] || {};
22092
- const {
22093
- userName
22094
- } = defaults || {};
22095
22107
 
22096
22108
  if (!showAvatar && !showName) {
22097
22109
  return null;
@@ -22110,12 +22122,10 @@ const EventParticipant = ({
22110
22122
  }));
22111
22123
  }
22112
22124
 
22113
- const authorName = fromClient ? userName || participantName : participantName;
22114
-
22115
- if (showName && authorName) {
22125
+ if (showName) {
22116
22126
  authorInfo.push(jsxRuntime_module_e("span", {
22117
22127
  className: css_className('message__author-name'),
22118
- children: authorName
22128
+ children: participantName
22119
22129
  }));
22120
22130
  }
22121
22131
 
@@ -27522,8 +27532,8 @@ const Participant = ({
27522
27532
  event
27523
27533
  }) => {
27524
27534
  const {
27525
- agentIcon
27526
- } = useConfig().defaults || {};
27535
+ agent
27536
+ } = useParticipants();
27527
27537
  const {
27528
27538
  participant
27529
27539
  } = event.payload;
@@ -27536,7 +27546,7 @@ const Participant = ({
27536
27546
  return null;
27537
27547
  }
27538
27548
 
27539
- const avatar = participant.avatar || agentIcon;
27549
+ const avatar = participant.avatar || (agent === null || agent === void 0 ? void 0 : agent.avatar);
27540
27550
  return jsxRuntime_module_e(EventDivider, {
27541
27551
  graphicSrc: avatar,
27542
27552
  graphicType: participant.avatar ? 'avatar' : undefined,
@@ -30010,7 +30020,7 @@ function ChatFrame({
30010
30020
  children: [jsxRuntime_module_e(TranslationsChatStatus, {}), jsxRuntime_module_e("div", {
30011
30021
  className: css_className('chat__container'),
30012
30022
  children: getContent()
30013
- }), jsxRuntime_module_e(AppOptions, {})]
30023
+ }), isOpen && jsxRuntime_module_e(AppOptions, {})]
30014
30024
  });
30015
30025
  }
30016
30026
 
@@ -30157,18 +30167,16 @@ const InlineView = () => {
30157
30167
 
30158
30168
 
30159
30169
  const ButtonIcon = () => {
30170
+ const startChatIcon = useStartChatIcon();
30160
30171
  const currentAgent = useSeamlyCurrentAgent();
30161
30172
  const {
30162
30173
  hasInterrupt
30163
30174
  } = useInterrupt();
30164
- const {
30165
- defaults
30166
- } = useConfig();
30167
- const startChatIcon = defaults === null || defaults === void 0 ? void 0 : defaults.startChatIcon;
30168
- const avatar = currentAgent && !hasInterrupt ? currentAgent.avatar : undefined;
30169
- return avatar || startChatIcon ? jsxRuntime_module_e("img", {
30170
- className: css_className(avatar ? 'avatar' : 'icon'),
30171
- src: avatar || startChatIcon,
30175
+ const isActiveConversation = currentAgent && !hasInterrupt;
30176
+ const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
30177
+ return src ? jsxRuntime_module_e("img", {
30178
+ className: css_className(isActiveConversation ? 'avatar' : 'icon'),
30179
+ src: src,
30172
30180
  alt: ""
30173
30181
  }) : jsxRuntime_module_e(icon, {
30174
30182
  name: "avatar",
@@ -33810,11 +33818,11 @@ function store_createStore({
33810
33818
  api,
33811
33819
  eventBus,
33812
33820
  config
33813
- }), createMiddleware(), middleware_createMiddleware({
33821
+ }), createMiddleware({
33814
33822
  api
33815
33823
  }), options_middleware_createMiddleware({
33816
33824
  api
33817
- }), translations_middleware_createMiddleware()]
33825
+ }), middleware_createMiddleware()]
33818
33826
  });
33819
33827
  return store;
33820
33828
  }
@@ -34179,13 +34187,8 @@ const AgentInfo = () => {
34179
34187
  const {
34180
34188
  hasInterrupt
34181
34189
  } = useInterrupt();
34182
- const {
34183
- defaults
34184
- } = useConfig();
34185
- const {
34186
- startChatIcon
34187
- } = defaults || {};
34188
- const avatar = currentAgent && !hasInterrupt ? currentAgent.avatar : null;
34190
+ const startChatIcon = useStartChatIcon();
34191
+ const src = (currentAgent === null || currentAgent === void 0 ? void 0 : currentAgent.avatar) ?? startChatIcon;
34189
34192
  const displaySubtitle = hasInterrupt ? '' : subTitle;
34190
34193
  const classNames = ['message-count'];
34191
34194
 
@@ -34197,13 +34200,13 @@ const AgentInfo = () => {
34197
34200
  classNames.push('message-count__empty');
34198
34201
  }
34199
34202
 
34200
- return (avatar || displaySubtitle || !isOpen) && jsxRuntime_module_e("div", {
34203
+ return (displaySubtitle || !isOpen) && jsxRuntime_module_e("div", {
34201
34204
  className: css_className('agent-info'),
34202
34205
  children: [jsxRuntime_module_e("div", {
34203
34206
  className: css_className('agent-info__graphic'),
34204
- children: [avatar || startChatIcon ? jsxRuntime_module_e("img", {
34205
- className: css_className(avatar ? 'avatar' : 'icon'),
34206
- src: avatar || startChatIcon,
34207
+ children: [src ? jsxRuntime_module_e("img", {
34208
+ className: css_className(currentAgent !== null && currentAgent !== void 0 && currentAgent.avatar ? 'avatar' : 'icon'),
34209
+ src: src,
34207
34210
  alt: ""
34208
34211
  }) : jsxRuntime_module_e(icon, {
34209
34212
  name: "avatar",