@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
@@ -447,9 +447,19 @@ const participantReducer = (state, action) => {
447
447
  };
448
448
 
449
449
  case SET_PARTICIPANT:
450
+ // TODO: a) Styleguide only! b) Should be removed after styleguide overhaul.
451
+ if (!state) {
452
+ return {
453
+ participants: {},
454
+ currentAgent: ''
455
+ };
456
+ }
457
+
450
458
  const {
451
459
  participants
452
- } = state;
460
+ } = state || {
461
+ participants: {}
462
+ };
453
463
  const {
454
464
  id,
455
465
  avatar,
@@ -1521,6 +1531,22 @@ const hooks_useSelectorWithProps = function useSelectorWithProps(selector, props
1521
1531
  function hooks_useConfig() {
1522
1532
  return useSelector(Selectors.selectConfig);
1523
1533
  }
1534
+ function useParticipants() {
1535
+ const {
1536
+ agentParticipant,
1537
+ userParticipant
1538
+ } = useSelector(Selectors.selectConfig);
1539
+ return {
1540
+ agent: agentParticipant,
1541
+ user: userParticipant
1542
+ };
1543
+ }
1544
+ function useStartChatIcon() {
1545
+ const {
1546
+ startChatIcon
1547
+ } = useSelector(Selectors.selectConfig);
1548
+ return startChatIcon;
1549
+ }
1524
1550
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
1525
1551
  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
1552
 
@@ -1814,7 +1840,10 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
1814
1840
  const {
1815
1841
  features,
1816
1842
  defaultLocale,
1817
- preChat
1843
+ preChat,
1844
+ agentParticipant,
1845
+ userParticipant,
1846
+ startChatIcon
1818
1847
  } = await api.getConfig();
1819
1848
  dispatch({
1820
1849
  type: seamly_utils_seamlyActions.SET_FEATURES,
@@ -1826,6 +1855,18 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
1826
1855
  type: 'message',
1827
1856
  payload
1828
1857
  }))));
1858
+ dispatch(update({
1859
+ agentParticipant,
1860
+ userParticipant,
1861
+ startChatIcon
1862
+ }));
1863
+
1864
+ if (agentParticipant !== null && agentParticipant !== void 0 && agentParticipant.name) {
1865
+ dispatch({
1866
+ type: seamly_utils_seamlyActions.SET_HEADER_TITLE,
1867
+ title: agentParticipant.name
1868
+ });
1869
+ }
1829
1870
  } catch (e) {
1830
1871
  throw new SeamlyUnavailableError();
1831
1872
  }
@@ -2406,34 +2447,6 @@ const seamly_api_hooks_useSeamlyHasConversation = () => {
2406
2447
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-dispatch.js
2407
2448
 
2408
2449
  /* 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
2450
  ;// CONCATENATED MODULE: ./src/javascripts/config.js
2438
2451
  const CSS_NAME = 'cvco';
2439
2452
  const apiVersion = '2';
@@ -2499,7 +2512,7 @@ const config_reducer_initialState = config_reducer_objectSpread(config_reducer_o
2499
2512
  preChatEvents: []
2500
2513
  });
2501
2514
 
2502
- const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback'];
2515
+ const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback', 'agentParticipant', 'userParticipant', 'startChatIcon'];
2503
2516
 
2504
2517
  const updateState = (state, {
2505
2518
  config
@@ -2547,7 +2560,6 @@ const updateState = (state, {
2547
2560
 
2548
2561
 
2549
2562
 
2550
-
2551
2563
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
2552
2564
 
2553
2565
  const useSeamlyAppContainerClassNames = () => {
@@ -3726,7 +3738,7 @@ class SeamlyUnauthorizedError extends SeamlyBaseError {
3726
3738
 
3727
3739
 
3728
3740
  const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
3729
- function middleware_createMiddleware({
3741
+ function createMiddleware({
3730
3742
  api
3731
3743
  }) {
3732
3744
  return () => next => action => {
@@ -4700,7 +4712,7 @@ function hooks_useTranslationsContainer() {
4700
4712
 
4701
4713
 
4702
4714
 
4703
- function translations_middleware_createMiddleware() {
4715
+ function middleware_createMiddleware() {
4704
4716
  return ({
4705
4717
  dispatch,
4706
4718
  getState
@@ -5842,6 +5854,10 @@ function static_core_objectWithoutPropertiesLoose(source, excluded) { if (source
5842
5854
 
5843
5855
 
5844
5856
 
5857
+
5858
+ const {
5859
+ SET_PARTICIPANT: static_core_SET_PARTICIPANT
5860
+ } = seamly_utils_seamlyActions;
5845
5861
  const bareApi = {
5846
5862
  send: () => {},
5847
5863
  reset: () => {
@@ -5857,6 +5873,7 @@ const bareApi = {
5857
5873
  const SeamlyTestCore = ({
5858
5874
  state,
5859
5875
  translations,
5876
+ participants = [],
5860
5877
  children
5861
5878
  }) => {
5862
5879
  const liveMsgRef = (0,hooks_namespaceObject.useRef)(() => {});
@@ -5902,8 +5919,15 @@ const SeamlyTestCore = ({
5902
5919
  }
5903
5920
 
5904
5921
  newStore.dispatch(setLocale.fulfilled('en-GB', translations));
5922
+ participants.forEach(participant => {
5923
+ newStore.dispatch({
5924
+ type: static_core_SET_PARTICIPANT,
5925
+ participant,
5926
+ fromClient: participant.id === 'user'
5927
+ });
5928
+ });
5905
5929
  return newStore;
5906
- }, [state, translations]);
5930
+ }, [state, translations, participants]);
5907
5931
  return state && (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.StoreProvider, {
5908
5932
  store: store,
5909
5933
  children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.SeamlyEventBusContext.Provider, {
@@ -5931,7 +5955,8 @@ const SeamlyTestCore = ({
5931
5955
  const StyleGuideView = ({
5932
5956
  state,
5933
5957
  customComponents = {},
5934
- translations
5958
+ translations,
5959
+ participants
5935
5960
  }) => {
5936
5961
  const [renderView, setRenderView] = (0,hooks_namespaceObject.useState)(true);
5937
5962
  const {
@@ -5960,10 +5985,12 @@ const StyleGuideView = ({
5960
5985
  return CustomView ? (0,jsx_runtime_namespaceObject.jsx)(static_core, {
5961
5986
  state: state,
5962
5987
  translations: translations,
5988
+ participants: participants,
5963
5989
  children: (0,jsx_runtime_namespaceObject.jsx)(CustomView, {})
5964
5990
  }) : (0,jsx_runtime_namespaceObject.jsx)(static_core, {
5965
5991
  state: state,
5966
5992
  translations: translations,
5993
+ participants: participants,
5967
5994
  children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.View, {})
5968
5995
  });
5969
5996
  };
@@ -6094,26 +6121,8 @@ const baseState = {
6094
6121
  const avatar = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMzIgMzIiPjxkZWZzLz48cGF0aCBmaWxsPSIjNEE0OEMxIiBkPSJNMCAwSDMyVjMySDB6Ii8+PHBhdGggZmlsbD0iI0ZGRiIgZD0iTTExLjE3NSwxMi4yMjJjMC0zLjc5MywyLjE2LTUuNTY1LDQuODI1LTUuNTY1YzIuNjY0LDAsNC44MjYsMS43NzIsNC44MjYsNS41NjUJYzAsMy43OTQtMi4xNjIsNi45MDQtNC44MjYsNi45MDRDMTMuMzM1LDE5LjEyNiwxMS4xNzUsMTYuMDE2LDExLjE3NSwxMi4yMjJ6IE0yNi42NjYsMjMuMDg0Yy0wLjgzNC0xLjU4My00LjIxNi0yLjYyNS01Ljg0MS0yLjY2NwlzLTMuNTM0LDMtNC44MjUsM2MtMS4yOTMsMC0zLjIwMS0zLjA0Mi00LjgyNS0zYy0xLjYyNSwwLjA0Mi01LjAwOCwxLjA4NC01Ljg0MSwyLjY2N0M0LjAwNSwyNS42MDYsNC41ODMsMzIsNC41ODMsMzJIMTZoMTEuNDE2CUMyNy40MTYsMzIsMjcuOTk0LDI1LjYwNiwyNi42NjYsMjMuMDg0eiIvPjwvc3ZnPg==';
6095
6122
  const participantInfo = {
6096
6123
  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',
6124
+ agent: {
6125
+ id: 'agent',
6117
6126
  service: {
6118
6127
  expose: {
6119
6128
  map: {},
@@ -6125,11 +6134,8 @@ const participantInfo = {
6125
6134
  settings: {}
6126
6135
  }
6127
6136
  },
6128
- 'seamly-client-participant': {
6129
- avatar,
6130
- id: 'seamly-client-participant',
6131
- introduction: null,
6132
- name: 'User',
6137
+ user: {
6138
+ id: 'user',
6133
6139
  service: {
6134
6140
  expose: {
6135
6141
  map: {},
@@ -6142,7 +6148,7 @@ const participantInfo = {
6142
6148
  }
6143
6149
  }
6144
6150
  },
6145
- currentAgent: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2'
6151
+ currentAgent: 'agent'
6146
6152
  };
6147
6153
  const newTopicDivider = {
6148
6154
  type: 'info',
@@ -6266,7 +6272,7 @@ const participantMessage = {
6266
6272
  messageStatus: 'received',
6267
6273
  participant: {
6268
6274
  avatar,
6269
- id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6275
+ id: 'agent',
6270
6276
  introduction: "You're now talking to {{name}} gimme a minit",
6271
6277
  name: 'Mrs. Bot',
6272
6278
  service: {
@@ -6292,7 +6298,7 @@ const participantMessageDefaultIcon = {
6292
6298
  id: (0,web_ui_namespaceObject.randomId)(),
6293
6299
  messageStatus: 'received',
6294
6300
  participant: {
6295
- id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa3',
6301
+ id: 'user',
6296
6302
  introduction: "You're now talking to {{name}} gimme a minit",
6297
6303
  name: 'Mrs. Bot',
6298
6304
  service: {
@@ -6324,7 +6330,7 @@ const getCustomMessage = ({
6324
6330
  data,
6325
6331
  variables: {}
6326
6332
  },
6327
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6333
+ participant: 'agent',
6328
6334
  service: {
6329
6335
  meta: {
6330
6336
  additions: {}
@@ -6354,7 +6360,7 @@ const shortTextMessage = {
6354
6360
  fromHistory: true,
6355
6361
  id: (0,web_ui_namespaceObject.randomId)(),
6356
6362
  messageStatus: 'read',
6357
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6363
+ participant: 'agent',
6358
6364
  service: {
6359
6365
  meta: {
6360
6366
  additions: {}
@@ -6393,7 +6399,7 @@ const ctaMessage = {
6393
6399
  fromHistory: true,
6394
6400
  id: 'f5351010-0def-452d-818f-ca22ac61792z',
6395
6401
  messageStatus: 'read',
6396
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6402
+ participant: 'agent',
6397
6403
  service: {
6398
6404
  meta: {
6399
6405
  additions: {
@@ -6419,7 +6425,7 @@ const longTextMessage = {
6419
6425
  fromHistory: true,
6420
6426
  id: (0,web_ui_namespaceObject.randomId)(),
6421
6427
  messageStatus: 'read',
6422
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6428
+ participant: 'agent',
6423
6429
  service: {
6424
6430
  meta: {
6425
6431
  additions: {}
@@ -6444,7 +6450,7 @@ const textMessageBoldItalicUnderline = {
6444
6450
  fromHistory: true,
6445
6451
  id: (0,web_ui_namespaceObject.randomId)(),
6446
6452
  messageStatus: 'read',
6447
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6453
+ participant: 'agent',
6448
6454
  service: {
6449
6455
  meta: {
6450
6456
  additions: {
@@ -6486,7 +6492,7 @@ const textMessageWithLinks = {
6486
6492
  fromHistory: true,
6487
6493
  id: (0,web_ui_namespaceObject.randomId)(),
6488
6494
  messageStatus: 'read',
6489
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6495
+ participant: 'agent',
6490
6496
  service: {
6491
6497
  meta: {
6492
6498
  additions: {
@@ -6521,7 +6527,7 @@ const textMessageWithLongLink = {
6521
6527
  fromHistory: true,
6522
6528
  id: 'a964e54e-ea98-46ff-a952-979a47f162c0',
6523
6529
  messageStatus: 'read',
6524
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6530
+ participant: 'agent',
6525
6531
  service: {
6526
6532
  meta: {
6527
6533
  additions: {
@@ -6548,7 +6554,7 @@ const textMesageWithBullets = {
6548
6554
  fromHistory: true,
6549
6555
  id: 'f5351010-0def-452d-818f-ca22ac61792a',
6550
6556
  messageStatus: 'read',
6551
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6557
+ participant: 'agent',
6552
6558
  service: {
6553
6559
  meta: {
6554
6560
  additions: {
@@ -6576,7 +6582,7 @@ const imageMessage = {
6576
6582
  fromHistory: true,
6577
6583
  id: 'b44ef42c-880c-43ff-b067-499e7f2e81f7',
6578
6584
  messageStatus: 'read',
6579
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6585
+ participant: 'agent',
6580
6586
  service: {
6581
6587
  meta: {
6582
6588
  additions: {
@@ -6604,7 +6610,7 @@ const imageMessageWithLightbox = {
6604
6610
  fromHistory: true,
6605
6611
  id: 'b44ef42c-880c-43ff-b067-499e7f2e81f8',
6606
6612
  messageStatus: 'read',
6607
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6613
+ participant: 'agent',
6608
6614
  service: {
6609
6615
  meta: {
6610
6616
  additions: {
@@ -6632,7 +6638,7 @@ const videoMessage = {
6632
6638
  fromHistory: true,
6633
6639
  id: (0,web_ui_namespaceObject.randomId)(),
6634
6640
  messageStatus: 'read',
6635
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6641
+ participant: 'agent',
6636
6642
  service: {
6637
6643
  meta: {
6638
6644
  additions: {
@@ -6685,7 +6691,7 @@ const choicePromptMessage = {
6685
6691
  fromHistory: true,
6686
6692
  id: (0,web_ui_namespaceObject.randomId)(),
6687
6693
  messageStatus: 'read',
6688
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6694
+ participant: 'agent',
6689
6695
  service: {
6690
6696
  meta: {
6691
6697
  additions: {}
@@ -6710,7 +6716,7 @@ const userMessage = {
6710
6716
  fromHistory: true,
6711
6717
  id: (0,web_ui_namespaceObject.randomId)(),
6712
6718
  messageStatus: 'read',
6713
- participant: 'seamly-client-participant',
6719
+ participant: 'user',
6714
6720
  transactionId: '1cdefea9-7437-4672-bcf8-2c75dc99244c',
6715
6721
  transactionLast: null,
6716
6722
  type: 'text'
@@ -6728,7 +6734,7 @@ const userMessageLong = {
6728
6734
  fromHistory: true,
6729
6735
  id: (0,web_ui_namespaceObject.randomId)(),
6730
6736
  messageStatus: 'read',
6731
- participant: 'seamly-client-participant',
6737
+ participant: 'user',
6732
6738
  transactionId: '1cdefea9-7437-4672-bcf8-2c75dc99244c',
6733
6739
  transactionLast: null,
6734
6740
  type: 'text'
@@ -6749,7 +6755,7 @@ const fileDownloadAgentMessage = {
6749
6755
  type: 'message',
6750
6756
  payload: states_objectSpread(states_objectSpread({}, fileDownloadPayload), {}, {
6751
6757
  fromClient: false,
6752
- participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
6758
+ participant: 'agent',
6753
6759
  id: (0,web_ui_namespaceObject.randomId)()
6754
6760
  })
6755
6761
  };
@@ -6765,7 +6771,7 @@ const fileDownloadUserMessage = {
6765
6771
  type: 'message',
6766
6772
  payload: states_objectSpread(states_objectSpread({}, fileDownloadPayload), {}, {
6767
6773
  fromClient: true,
6768
- participant: 'seamly-client-participant',
6774
+ participant: 'user',
6769
6775
  id: (0,web_ui_namespaceObject.randomId)()
6770
6776
  })
6771
6777
  };
@@ -8071,7 +8077,8 @@ const StyleGuideApp = ({
8071
8077
  config,
8072
8078
  styleGuideConfig,
8073
8079
  translations,
8074
- headingLevel = 2
8080
+ headingLevel = 2,
8081
+ participants
8075
8082
  }) => {
8076
8083
  const [staticState, setStaticState] = (0,hooks_namespaceObject.useState)(null);
8077
8084
  const [selectedStateDescription, setSelectedStateDescription] = (0,hooks_namespaceObject.useState)('');
@@ -8098,9 +8105,6 @@ const StyleGuideApp = ({
8098
8105
  }
8099
8106
  }, [setStaticState, stateUpdateCallback]);
8100
8107
  const getState = (0,hooks_namespaceObject.useCallback)((layoutMode, feature) => {
8101
- const {
8102
- defaults
8103
- } = config;
8104
8108
  const {
8105
8109
  headingText
8106
8110
  } = mainState[feature];
@@ -8110,9 +8114,7 @@ const StyleGuideApp = ({
8110
8114
  overrideMessages,
8111
8115
  showFaq
8112
8116
  } = bareState.config;
8113
- const {
8114
- agentName
8115
- } = defaults || {};
8117
+ const agent = participants.find(participant => participant.id === 'agent');
8116
8118
 
8117
8119
  const updatedState = app_objectSpread(app_objectSpread({}, bareState), {}, {
8118
8120
  config: app_objectSpread(app_objectSpread(app_objectSpread(app_objectSpread({}, bareState.config), config), {}, {
@@ -8123,12 +8125,12 @@ const StyleGuideApp = ({
8123
8125
  showFaq
8124
8126
  }),
8125
8127
  headerTitles: app_objectSpread(app_objectSpread({}, bareState.headerTitles), {}, {
8126
- subTitle: agentName || bareState.headerTitles.subTitle
8128
+ subTitle: (agent === null || agent === void 0 ? void 0 : agent.name) || bareState.headerTitles.subTitle
8127
8129
  })
8128
8130
  });
8129
8131
 
8130
8132
  return updatedState;
8131
- }, [mainState, config]);
8133
+ }, [mainState, participants, config]);
8132
8134
  (0,hooks_namespaceObject.useEffect)(() => {
8133
8135
  // As the modal focus trap disables clicking on elements outside the modal container,
8134
8136
  // we need to hide the modal manually on clicking the overlay as the internal
@@ -8206,7 +8208,8 @@ const StyleGuideApp = ({
8206
8208
  children: showStyleGuide && (0,jsx_runtime_namespaceObject.jsx)(view, {
8207
8209
  customComponents: styleGuideConfig.customComponents,
8208
8210
  translations: translations,
8209
- state: staticState
8211
+ state: staticState,
8212
+ participants: participants
8210
8213
  })
8211
8214
  })]
8212
8215
  }), (0,jsx_runtime_namespaceObject.jsx)("aside", {
@@ -8267,6 +8270,16 @@ class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
8267
8270
  translations: `/client/${this.config.api.key}/translations/{version}/{locale}.json`
8268
8271
  };
8269
8272
  const translations = await api.getTranslations(this.config.context.locale || 'en-GB');
8273
+ const {
8274
+ agentParticipant,
8275
+ userParticipant
8276
+ } = await api.getConfig();
8277
+ const participants = [style_guide_engine_objectSpread({
8278
+ id: 'user'
8279
+ }, userParticipant), style_guide_engine_objectSpread({
8280
+ id: 'agent',
8281
+ introduction: 'I am {{name}}'
8282
+ }, agentParticipant)];
8270
8283
 
8271
8284
  const renderConfig = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config), {}, {
8272
8285
  customComponents: Object.keys(restComponents).length ? restComponents : undefined
@@ -8275,7 +8288,8 @@ class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
8275
8288
  (0,external_preact_namespaceObject.render)((0,jsx_runtime_namespaceObject.jsx)(app, {
8276
8289
  config: renderConfig,
8277
8290
  styleGuideConfig: this.styleGuideConfig,
8278
- translations: translations
8291
+ translations: translations,
8292
+ participants: participants
8279
8293
  }), this.parentElement);
8280
8294
  }
8281
8295