@seamly/web-ui 20.0.0-beta.5 → 20.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/build/dist/lib/deprecated-view.css +1 -1
  2. package/build/dist/lib/index.debug.js +24 -24
  3. package/build/dist/lib/index.debug.min.js +1 -1
  4. package/build/dist/lib/index.debug.min.js.LICENSE.txt +4 -4
  5. package/build/dist/lib/index.js +26363 -0
  6. package/build/dist/lib/index.min.js +2 -0
  7. package/build/dist/lib/index.min.js.LICENSE.txt +14 -0
  8. package/build/dist/lib/standalone.js +34773 -0
  9. package/build/dist/lib/standalone.min.js +2 -0
  10. package/build/dist/lib/standalone.min.js.LICENSE.txt +4 -0
  11. package/build/dist/lib/style-guide.js +111 -94
  12. package/build/dist/lib/style-guide.min.js +1 -1
  13. package/build/dist/lib/styles-default-implementation.css +1 -1
  14. package/build/dist/lib/styles.css +1 -1
  15. package/package.json +1 -2
  16. package/src/javascripts/domains/app/actions.js +23 -1
  17. package/src/javascripts/domains/config/hooks.js +17 -0
  18. package/src/javascripts/domains/config/index.js +0 -1
  19. package/src/javascripts/domains/config/reducer.js +4 -0
  20. package/src/javascripts/domains/store/index.js +1 -5
  21. package/src/javascripts/style-guide/components/app.js +8 -4
  22. package/src/javascripts/style-guide/components/links.js +5 -5
  23. package/src/javascripts/style-guide/components/static-core.js +19 -2
  24. package/src/javascripts/style-guide/components/view.js +16 -3
  25. package/src/javascripts/style-guide/states.js +23 -41
  26. package/src/javascripts/style-guide/style-guide-engine.js +13 -1
  27. package/src/javascripts/style-guide.js +2 -0
  28. package/src/javascripts/ui/components/conversation/event/event-participant.js +10 -7
  29. package/src/javascripts/ui/components/conversation/event/participant.js +3 -3
  30. package/src/javascripts/ui/components/conversation/event/upload.js +13 -10
  31. package/src/javascripts/ui/components/layout/agent-info.js +7 -11
  32. package/src/javascripts/ui/components/layout/chat-frame.js +1 -1
  33. package/src/javascripts/ui/components/view/window-view/window-open-button.js +7 -7
  34. package/src/javascripts/ui/utils/seamly-utils.js +9 -2
  35. package/src/stylesheets/5-components/_message-body.scss +19 -12
  36. package/src/stylesheets/6-default-implementation/_hover.scss +19 -7
  37. package/src/stylesheets/7-deprecated/5-components/_message.scss +4 -3
  38. package/src/javascripts/domains/config/middleware.js +0 -22
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * focus-trap 6.7.1
3
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
4
+ */
@@ -39,6 +39,7 @@ __webpack_require__.r(__webpack_exports__);
39
39
 
40
40
  // EXPORTS
41
41
  __webpack_require__.d(__webpack_exports__, {
42
+ "SeamlyStaticCore": () => (/* reexport */ static_core),
42
43
  "default": () => (/* binding */ style_guide)
43
44
  });
44
45
 
@@ -447,9 +448,19 @@ const participantReducer = (state, action) => {
447
448
  };
448
449
 
449
450
  case SET_PARTICIPANT:
451
+ // TODO: a) Styleguide only! b) Should be removed after styleguide overhaul.
452
+ if (!state) {
453
+ return {
454
+ participants: {},
455
+ currentAgent: ''
456
+ };
457
+ }
458
+
450
459
  const {
451
460
  participants
452
- } = state;
461
+ } = state || {
462
+ participants: {}
463
+ };
453
464
  const {
454
465
  id,
455
466
  avatar,
@@ -1521,6 +1532,22 @@ const hooks_useSelectorWithProps = function useSelectorWithProps(selector, props
1521
1532
  function hooks_useConfig() {
1522
1533
  return useSelector(Selectors.selectConfig);
1523
1534
  }
1535
+ function useParticipants() {
1536
+ const {
1537
+ agentParticipant,
1538
+ userParticipant
1539
+ } = useSelector(Selectors.selectConfig);
1540
+ return {
1541
+ agent: agentParticipant,
1542
+ user: userParticipant
1543
+ };
1544
+ }
1545
+ function useStartChatIcon() {
1546
+ const {
1547
+ startChatIcon
1548
+ } = useSelector(Selectors.selectConfig);
1549
+ return startChatIcon;
1550
+ }
1524
1551
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
1525
1552
  function seamly_state_hooks_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; }
1526
1553
 
@@ -1814,7 +1841,10 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
1814
1841
  const {
1815
1842
  features,
1816
1843
  defaultLocale,
1817
- preChat
1844
+ preChat,
1845
+ agentParticipant,
1846
+ userParticipant,
1847
+ startChatIcon
1818
1848
  } = await api.getConfig();
1819
1849
  dispatch({
1820
1850
  type: seamly_utils_seamlyActions.SET_FEATURES,
@@ -1826,6 +1856,18 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
1826
1856
  type: 'message',
1827
1857
  payload
1828
1858
  }))));
1859
+ dispatch(update({
1860
+ agentParticipant,
1861
+ userParticipant,
1862
+ startChatIcon
1863
+ }));
1864
+
1865
+ if (agentParticipant !== null && agentParticipant !== void 0 && agentParticipant.name) {
1866
+ dispatch({
1867
+ type: seamly_utils_seamlyActions.SET_HEADER_TITLE,
1868
+ title: agentParticipant.name
1869
+ });
1870
+ }
1829
1871
  } catch (e) {
1830
1872
  throw new SeamlyUnavailableError();
1831
1873
  }
@@ -2406,34 +2448,6 @@ const seamly_api_hooks_useSeamlyHasConversation = () => {
2406
2448
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-dispatch.js
2407
2449
 
2408
2450
  /* harmony default export */ const use_seamly_dispatch = ((/* unused pure expression or super */ null && (useStoreDispatch)));
2409
- ;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
2410
-
2411
-
2412
- function createMiddleware() {
2413
- return ({
2414
- dispatch
2415
- }) => next => action => {
2416
- var _action$config, _action$config$defaul;
2417
-
2418
- const result = next(action);
2419
-
2420
- switch (action.type) {
2421
- case String(Actions.initialize):
2422
- case String(Actions.update):
2423
- 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) {
2424
- var _action$config2, _action$config2$defau;
2425
-
2426
- dispatch({
2427
- type: seamlyActions.SET_HEADER_SUB_TITLE,
2428
- 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
2429
- });
2430
- }
2431
-
2432
- }
2433
-
2434
- return result;
2435
- };
2436
- }
2437
2451
  ;// CONCATENATED MODULE: ./src/javascripts/config.js
2438
2452
  const CSS_NAME = 'cvco';
2439
2453
  const apiVersion = '2';
@@ -2499,7 +2513,7 @@ const config_reducer_initialState = config_reducer_objectSpread(config_reducer_o
2499
2513
  preChatEvents: []
2500
2514
  });
2501
2515
 
2502
- const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback'];
2516
+ const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
2503
2517
 
2504
2518
  const updateState = (state, {
2505
2519
  config
@@ -2547,7 +2561,6 @@ const updateState = (state, {
2547
2561
 
2548
2562
 
2549
2563
 
2550
-
2551
2564
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
2552
2565
 
2553
2566
  const useSeamlyAppContainerClassNames = () => {
@@ -3726,7 +3739,7 @@ class SeamlyUnauthorizedError extends SeamlyBaseError {
3726
3739
 
3727
3740
 
3728
3741
  const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
3729
- function middleware_createMiddleware({
3742
+ function createMiddleware({
3730
3743
  api
3731
3744
  }) {
3732
3745
  return () => next => action => {
@@ -4700,7 +4713,7 @@ function hooks_useTranslationsContainer() {
4700
4713
 
4701
4714
 
4702
4715
 
4703
- function translations_middleware_createMiddleware() {
4716
+ function middleware_createMiddleware() {
4704
4717
  return ({
4705
4718
  dispatch,
4706
4719
  getState
@@ -5842,6 +5855,10 @@ function static_core_objectWithoutPropertiesLoose(source, excluded) { if (source
5842
5855
 
5843
5856
 
5844
5857
 
5858
+
5859
+ const {
5860
+ SET_PARTICIPANT: static_core_SET_PARTICIPANT
5861
+ } = seamly_utils_seamlyActions;
5845
5862
  const bareApi = {
5846
5863
  send: () => {},
5847
5864
  reset: () => {
@@ -5857,6 +5874,7 @@ const bareApi = {
5857
5874
  const SeamlyTestCore = ({
5858
5875
  state,
5859
5876
  translations,
5877
+ participants = [],
5860
5878
  children
5861
5879
  }) => {
5862
5880
  const liveMsgRef = (0,hooks_namespaceObject.useRef)(() => {});
@@ -5902,8 +5920,15 @@ const SeamlyTestCore = ({
5902
5920
  }
5903
5921
 
5904
5922
  newStore.dispatch(setLocale.fulfilled('en-GB', translations));
5923
+ participants.forEach(participant => {
5924
+ newStore.dispatch({
5925
+ type: static_core_SET_PARTICIPANT,
5926
+ participant,
5927
+ fromClient: participant.id === 'user'
5928
+ });
5929
+ });
5905
5930
  return newStore;
5906
- }, [state, translations]);
5931
+ }, [state, translations, participants]);
5907
5932
  return state && (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.StoreProvider, {
5908
5933
  store: store,
5909
5934
  children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.SeamlyEventBusContext.Provider, {
@@ -5931,7 +5956,8 @@ const SeamlyTestCore = ({
5931
5956
  const StyleGuideView = ({
5932
5957
  state,
5933
5958
  customComponents = {},
5934
- translations
5959
+ translations,
5960
+ participants
5935
5961
  }) => {
5936
5962
  const [renderView, setRenderView] = (0,hooks_namespaceObject.useState)(true);
5937
5963
  const {
@@ -5960,10 +5986,12 @@ const StyleGuideView = ({
5960
5986
  return CustomView ? (0,jsx_runtime_namespaceObject.jsx)(static_core, {
5961
5987
  state: state,
5962
5988
  translations: translations,
5989
+ participants: participants,
5963
5990
  children: (0,jsx_runtime_namespaceObject.jsx)(CustomView, {})
5964
5991
  }) : (0,jsx_runtime_namespaceObject.jsx)(static_core, {
5965
5992
  state: state,
5966
5993
  translations: translations,
5994
+ participants: participants,
5967
5995
  children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.View, {})
5968
5996
  });
5969
5997
  };
@@ -6094,26 +6122,8 @@ const baseState = {
6094
6122
  const avatar = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMzIgMzIiPjxkZWZzLz48cGF0aCBmaWxsPSIjNEE0OEMxIiBkPSJNMCAwSDMyVjMySDB6Ii8+PHBhdGggZmlsbD0iI0ZGRiIgZD0iTTExLjE3NSwxMi4yMjJjMC0zLjc5MywyLjE2LTUuNTY1LDQuODI1LTUuNTY1YzIuNjY0LDAsNC44MjYsMS43NzIsNC44MjYsNS41NjUJYzAsMy43OTQtMi4xNjIsNi45MDQtNC44MjYsNi45MDRDMTMuMzM1LDE5LjEyNiwxMS4xNzUsMTYuMDE2LDExLjE3NSwxMi4yMjJ6IE0yNi42NjYsMjMuMDg0Yy0wLjgzNC0xLjU4My00LjIxNi0yLjYyNS01Ljg0MS0yLjY2NwlzLTMuNTM0LDMtNC44MjUsM2MtMS4yOTMsMC0zLjIwMS0zLjA0Mi00LjgyNS0zYy0xLjYyNSwwLjA0Mi01LjAwOCwxLjA4NC01Ljg0MSwyLjY2N0M0LjAwNSwyNS42MDYsNC41ODMsMzIsNC41ODMsMzJIMTZoMTEuNDE2CUMyNy40MTYsMzIsMjcuOTk0LDI1LjYwNiwyNi42NjYsMjMuMDg0eiIvPjwvc3ZnPg==';
6095
6123
  const participantInfo = {
6096
6124
  participants: {
6097
- 'e65fa8dc-97ab-4711-8fec-82bae6461aa2': {
6098
- avatar,
6099
- id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6100
- introduction: "You're now talking to {{name}} gimme a minit",
6101
- name: 'Mrs. Bot',
6102
- service: {
6103
- expose: {
6104
- map: {},
6105
- version: 2
6106
- },
6107
- meta: {},
6108
- name: null,
6109
- service_session_id: null,
6110
- settings: {}
6111
- }
6112
- },
6113
- 'e65fa8dc-97ab-4711-8fec-82bae6461aa3': {
6114
- id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa3',
6115
- introduction: "You're now talking to {{name}} gimme a minit",
6116
- name: 'Mrs. Bot',
6125
+ agent: {
6126
+ id: 'agent',
6117
6127
  service: {
6118
6128
  expose: {
6119
6129
  map: {},
@@ -6125,11 +6135,8 @@ const participantInfo = {
6125
6135
  settings: {}
6126
6136
  }
6127
6137
  },
6128
- 'seamly-client-participant': {
6129
- avatar,
6130
- id: 'seamly-client-participant',
6131
- introduction: null,
6132
- name: 'User',
6138
+ user: {
6139
+ id: 'user',
6133
6140
  service: {
6134
6141
  expose: {
6135
6142
  map: {},
@@ -6142,7 +6149,7 @@ const participantInfo = {
6142
6149
  }
6143
6150
  }
6144
6151
  },
6145
- currentAgent: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2'
6152
+ currentAgent: 'agent'
6146
6153
  };
6147
6154
  const newTopicDivider = {
6148
6155
  type: 'info',
@@ -6266,7 +6273,7 @@ const participantMessage = {
6266
6273
  messageStatus: 'received',
6267
6274
  participant: {
6268
6275
  avatar,
6269
- id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6276
+ id: 'agent',
6270
6277
  introduction: "You're now talking to {{name}} gimme a minit",
6271
6278
  name: 'Mrs. Bot',
6272
6279
  service: {
@@ -6292,7 +6299,7 @@ const participantMessageDefaultIcon = {
6292
6299
  id: (0,web_ui_namespaceObject.randomId)(),
6293
6300
  messageStatus: 'received',
6294
6301
  participant: {
6295
- id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa3',
6302
+ id: 'user',
6296
6303
  introduction: "You're now talking to {{name}} gimme a minit",
6297
6304
  name: 'Mrs. Bot',
6298
6305
  service: {
@@ -6324,7 +6331,7 @@ const getCustomMessage = ({
6324
6331
  data,
6325
6332
  variables: {}
6326
6333
  },
6327
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6334
+ participant: 'agent',
6328
6335
  service: {
6329
6336
  meta: {
6330
6337
  additions: {}
@@ -6354,7 +6361,7 @@ const shortTextMessage = {
6354
6361
  fromHistory: true,
6355
6362
  id: (0,web_ui_namespaceObject.randomId)(),
6356
6363
  messageStatus: 'read',
6357
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6364
+ participant: 'agent',
6358
6365
  service: {
6359
6366
  meta: {
6360
6367
  additions: {}
@@ -6393,7 +6400,7 @@ const ctaMessage = {
6393
6400
  fromHistory: true,
6394
6401
  id: 'f5351010-0def-452d-818f-ca22ac61792z',
6395
6402
  messageStatus: 'read',
6396
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6403
+ participant: 'agent',
6397
6404
  service: {
6398
6405
  meta: {
6399
6406
  additions: {
@@ -6419,7 +6426,7 @@ const longTextMessage = {
6419
6426
  fromHistory: true,
6420
6427
  id: (0,web_ui_namespaceObject.randomId)(),
6421
6428
  messageStatus: 'read',
6422
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6429
+ participant: 'agent',
6423
6430
  service: {
6424
6431
  meta: {
6425
6432
  additions: {}
@@ -6444,7 +6451,7 @@ const textMessageBoldItalicUnderline = {
6444
6451
  fromHistory: true,
6445
6452
  id: (0,web_ui_namespaceObject.randomId)(),
6446
6453
  messageStatus: 'read',
6447
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6454
+ participant: 'agent',
6448
6455
  service: {
6449
6456
  meta: {
6450
6457
  additions: {
@@ -6486,7 +6493,7 @@ const textMessageWithLinks = {
6486
6493
  fromHistory: true,
6487
6494
  id: (0,web_ui_namespaceObject.randomId)(),
6488
6495
  messageStatus: 'read',
6489
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6496
+ participant: 'agent',
6490
6497
  service: {
6491
6498
  meta: {
6492
6499
  additions: {
@@ -6521,7 +6528,7 @@ const textMessageWithLongLink = {
6521
6528
  fromHistory: true,
6522
6529
  id: 'a964e54e-ea98-46ff-a952-979a47f162c0',
6523
6530
  messageStatus: 'read',
6524
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6531
+ participant: 'agent',
6525
6532
  service: {
6526
6533
  meta: {
6527
6534
  additions: {
@@ -6548,7 +6555,7 @@ const textMesageWithBullets = {
6548
6555
  fromHistory: true,
6549
6556
  id: 'f5351010-0def-452d-818f-ca22ac61792a',
6550
6557
  messageStatus: 'read',
6551
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6558
+ participant: 'agent',
6552
6559
  service: {
6553
6560
  meta: {
6554
6561
  additions: {
@@ -6576,7 +6583,7 @@ const imageMessage = {
6576
6583
  fromHistory: true,
6577
6584
  id: 'b44ef42c-880c-43ff-b067-499e7f2e81f7',
6578
6585
  messageStatus: 'read',
6579
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6586
+ participant: 'agent',
6580
6587
  service: {
6581
6588
  meta: {
6582
6589
  additions: {
@@ -6604,7 +6611,7 @@ const imageMessageWithLightbox = {
6604
6611
  fromHistory: true,
6605
6612
  id: 'b44ef42c-880c-43ff-b067-499e7f2e81f8',
6606
6613
  messageStatus: 'read',
6607
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6614
+ participant: 'agent',
6608
6615
  service: {
6609
6616
  meta: {
6610
6617
  additions: {
@@ -6632,7 +6639,7 @@ const videoMessage = {
6632
6639
  fromHistory: true,
6633
6640
  id: (0,web_ui_namespaceObject.randomId)(),
6634
6641
  messageStatus: 'read',
6635
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6642
+ participant: 'agent',
6636
6643
  service: {
6637
6644
  meta: {
6638
6645
  additions: {
@@ -6685,7 +6692,7 @@ const choicePromptMessage = {
6685
6692
  fromHistory: true,
6686
6693
  id: (0,web_ui_namespaceObject.randomId)(),
6687
6694
  messageStatus: 'read',
6688
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6695
+ participant: 'agent',
6689
6696
  service: {
6690
6697
  meta: {
6691
6698
  additions: {}
@@ -6710,7 +6717,7 @@ const userMessage = {
6710
6717
  fromHistory: true,
6711
6718
  id: (0,web_ui_namespaceObject.randomId)(),
6712
6719
  messageStatus: 'read',
6713
- participant: 'seamly-client-participant',
6720
+ participant: 'user',
6714
6721
  transactionId: '1cdefea9-7437-4672-bcf8-2c75dc99244c',
6715
6722
  transactionLast: null,
6716
6723
  type: 'text'
@@ -6728,7 +6735,7 @@ const userMessageLong = {
6728
6735
  fromHistory: true,
6729
6736
  id: (0,web_ui_namespaceObject.randomId)(),
6730
6737
  messageStatus: 'read',
6731
- participant: 'seamly-client-participant',
6738
+ participant: 'user',
6732
6739
  transactionId: '1cdefea9-7437-4672-bcf8-2c75dc99244c',
6733
6740
  transactionLast: null,
6734
6741
  type: 'text'
@@ -6749,7 +6756,7 @@ const fileDownloadAgentMessage = {
6749
6756
  type: 'message',
6750
6757
  payload: states_objectSpread(states_objectSpread({}, fileDownloadPayload), {}, {
6751
6758
  fromClient: false,
6752
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6759
+ participant: 'agent',
6753
6760
  id: (0,web_ui_namespaceObject.randomId)()
6754
6761
  })
6755
6762
  };
@@ -6765,7 +6772,7 @@ const fileDownloadUserMessage = {
6765
6772
  type: 'message',
6766
6773
  payload: states_objectSpread(states_objectSpread({}, fileDownloadPayload), {}, {
6767
6774
  fromClient: true,
6768
- participant: 'seamly-client-participant',
6775
+ participant: 'user',
6769
6776
  id: (0,web_ui_namespaceObject.randomId)()
6770
6777
  })
6771
6778
  };
@@ -8027,9 +8034,10 @@ const StyleGuideLinks = ({
8027
8034
  e.preventDefault();
8028
8035
 
8029
8036
  if (layoutMode === 'inline') {
8030
- setTimeout(() => {
8031
- document.querySelector('section.cvco-app').scrollIntoView();
8032
- }, 300);
8037
+ window.scroll({
8038
+ top: document.querySelector('.cvco-app').offsetTop,
8039
+ behavior: 'smooth'
8040
+ });
8033
8041
  }
8034
8042
 
8035
8043
  onClickHandler({
@@ -8071,7 +8079,8 @@ const StyleGuideApp = ({
8071
8079
  config,
8072
8080
  styleGuideConfig,
8073
8081
  translations,
8074
- headingLevel = 2
8082
+ headingLevel = 2,
8083
+ participants
8075
8084
  }) => {
8076
8085
  const [staticState, setStaticState] = (0,hooks_namespaceObject.useState)(null);
8077
8086
  const [selectedStateDescription, setSelectedStateDescription] = (0,hooks_namespaceObject.useState)('');
@@ -8098,9 +8107,6 @@ const StyleGuideApp = ({
8098
8107
  }
8099
8108
  }, [setStaticState, stateUpdateCallback]);
8100
8109
  const getState = (0,hooks_namespaceObject.useCallback)((layoutMode, feature) => {
8101
- const {
8102
- defaults
8103
- } = config;
8104
8110
  const {
8105
8111
  headingText
8106
8112
  } = mainState[feature];
@@ -8110,9 +8116,7 @@ const StyleGuideApp = ({
8110
8116
  overrideMessages,
8111
8117
  showFaq
8112
8118
  } = bareState.config;
8113
- const {
8114
- agentName
8115
- } = defaults || {};
8119
+ const agent = participants.find(participant => participant.id === 'agent');
8116
8120
 
8117
8121
  const updatedState = app_objectSpread(app_objectSpread({}, bareState), {}, {
8118
8122
  config: app_objectSpread(app_objectSpread(app_objectSpread(app_objectSpread({}, bareState.config), config), {}, {
@@ -8123,12 +8127,12 @@ const StyleGuideApp = ({
8123
8127
  showFaq
8124
8128
  }),
8125
8129
  headerTitles: app_objectSpread(app_objectSpread({}, bareState.headerTitles), {}, {
8126
- subTitle: agentName || bareState.headerTitles.subTitle
8130
+ subTitle: (agent === null || agent === void 0 ? void 0 : agent.name) || bareState.headerTitles.subTitle
8127
8131
  })
8128
8132
  });
8129
8133
 
8130
8134
  return updatedState;
8131
- }, [mainState, config]);
8135
+ }, [mainState, participants, config]);
8132
8136
  (0,hooks_namespaceObject.useEffect)(() => {
8133
8137
  // As the modal focus trap disables clicking on elements outside the modal container,
8134
8138
  // we need to hide the modal manually on clicking the overlay as the internal
@@ -8206,7 +8210,8 @@ const StyleGuideApp = ({
8206
8210
  children: showStyleGuide && (0,jsx_runtime_namespaceObject.jsx)(view, {
8207
8211
  customComponents: styleGuideConfig.customComponents,
8208
8212
  translations: translations,
8209
- state: staticState
8213
+ state: staticState,
8214
+ participants: participants
8210
8215
  })
8211
8216
  })]
8212
8217
  }), (0,jsx_runtime_namespaceObject.jsx)("aside", {
@@ -8267,6 +8272,16 @@ class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
8267
8272
  translations: `/client/${this.config.api.key}/translations/{version}/{locale}.json`
8268
8273
  };
8269
8274
  const translations = await api.getTranslations(this.config.context.locale || 'en-GB');
8275
+ const {
8276
+ agentParticipant,
8277
+ userParticipant
8278
+ } = await api.getConfig();
8279
+ const participants = [style_guide_engine_objectSpread({
8280
+ id: 'user'
8281
+ }, userParticipant), style_guide_engine_objectSpread({
8282
+ id: 'agent',
8283
+ introduction: 'I am {{name}}'
8284
+ }, agentParticipant)];
8270
8285
 
8271
8286
  const renderConfig = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config), {}, {
8272
8287
  customComponents: Object.keys(restComponents).length ? restComponents : undefined
@@ -8275,7 +8290,8 @@ class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
8275
8290
  (0,external_preact_namespaceObject.render)((0,jsx_runtime_namespaceObject.jsx)(app, {
8276
8291
  config: renderConfig,
8277
8292
  styleGuideConfig: this.styleGuideConfig,
8278
- translations: translations
8293
+ translations: translations,
8294
+ participants: participants
8279
8295
  }), this.parentElement);
8280
8296
  }
8281
8297
 
@@ -8345,6 +8361,7 @@ function initializeStyleGuideExternalApi(appConfig, styleGuideConfig) {
8345
8361
  ;// CONCATENATED MODULE: ./src/javascripts/style-guide.js
8346
8362
 
8347
8363
  /* harmony default export */ const style_guide = (initializeStyleGuideExternalApi);
8364
+
8348
8365
  module.exports = __webpack_exports__;
8349
8366
  /******/ })()
8350
8367
  ;