@seamly/web-ui 20.0.0-beta.1 → 20.0.0-beta.4

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 (76) hide show
  1. package/build/dist/lib/components.js +1 -1
  2. package/build/dist/lib/components.min.js +1 -1
  3. package/build/dist/lib/deprecated-view.css +1 -0
  4. package/build/dist/lib/deprecated-view.js +1 -0
  5. package/build/dist/lib/index.debug.js +102 -57
  6. package/build/dist/lib/index.debug.min.js +1 -1
  7. package/build/dist/lib/index.debug.min.js.LICENSE.txt +28 -12
  8. package/build/dist/lib/index.js +14773 -13925
  9. package/build/dist/lib/index.min.js +1 -1
  10. package/build/dist/lib/index.min.js.LICENSE.txt +5 -0
  11. package/build/dist/lib/standalone.js +19922 -19625
  12. package/build/dist/lib/standalone.min.js +1 -1
  13. package/build/dist/lib/style-guide.js +5071 -10746
  14. package/build/dist/lib/style-guide.min.js +1 -2
  15. package/build/dist/lib/styles-default-implementation.css +1 -0
  16. package/build/dist/lib/styles-default-implementation.js +1 -0
  17. package/build/dist/lib/styles.css +1 -1
  18. package/package.json +8 -7
  19. package/src/.DS_Store +0 -0
  20. package/src/javascripts/domains/translations/components/options-button.js +1 -1
  21. package/src/javascripts/index.js +5 -2
  22. package/src/javascripts/lib/parse-body.js +1 -1
  23. package/src/javascripts/package/components.js +1 -1
  24. package/src/javascripts/style-guide/components/app.js +3 -3
  25. package/src/javascripts/style-guide/components/static-core.js +1 -1
  26. package/src/javascripts/style-guide/states.js +326 -69
  27. package/src/javascripts/ui/components/app-options/index.js +9 -3
  28. package/src/javascripts/ui/components/conversation/conversation.js +1 -1
  29. package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +3 -1
  30. package/src/javascripts/ui/components/conversation/event/conversation-suggestions.js +12 -3
  31. package/src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js +35 -0
  32. package/src/javascripts/ui/components/conversation/event/participant.js +5 -2
  33. package/src/javascripts/ui/components/conversation/event/splash.js +2 -1
  34. package/src/javascripts/ui/components/conversation/event/text.js +2 -1
  35. package/src/javascripts/ui/components/entry/{toggle-button.js → deprecated-toggle-button.js} +0 -0
  36. package/src/javascripts/ui/components/entry/entry-container.js +1 -1
  37. package/src/javascripts/ui/components/faq/faq.js +162 -0
  38. package/src/javascripts/ui/components/layout/chat-frame.js +1 -1
  39. package/src/javascripts/ui/components/layout/chat.js +62 -0
  40. package/src/javascripts/ui/components/layout/{app-frame.js → deprecated-app-frame.js} +10 -24
  41. package/src/javascripts/ui/components/layout/header.js +1 -1
  42. package/src/javascripts/ui/components/options/options-button.js +2 -2
  43. package/src/javascripts/ui/components/suggestions/index.js +2 -2
  44. package/src/javascripts/ui/components/view/app-view.js +3 -3
  45. package/src/javascripts/ui/components/view/deprecated-view.js +6 -4
  46. package/src/javascripts/ui/components/view/index.js +61 -5
  47. package/src/javascripts/ui/components/view/inline-view.js +9 -3
  48. package/src/javascripts/ui/components/view/window-view/index.js +3 -3
  49. package/src/stylesheets/1-settings/_config.scss +6 -6
  50. package/src/stylesheets/{3-app/_app.scss → 3-chat/_chat.scss} +27 -25
  51. package/src/stylesheets/5-components/_conversation.scss +2 -2
  52. package/src/stylesheets/5-components/_disclaimer.scss +1 -1
  53. package/src/stylesheets/5-components/_error.scss +20 -10
  54. package/src/stylesheets/5-components/_message-count.scss +1 -0
  55. package/src/stylesheets/5-components/_modal.scss +2 -2
  56. package/src/stylesheets/5-components/_options.scss +8 -8
  57. package/src/stylesheets/5-components/_pre-chat-messages.scss +6 -2
  58. package/src/stylesheets/5-components/_suggestions.scss +12 -6
  59. package/src/stylesheets/5-components/_unstarted.scss +14 -8
  60. package/src/stylesheets/6-default-implementation/_hover.scss +153 -0
  61. package/src/stylesheets/{6-webui-only → 6-default-implementation}/_scrollbar.scss +1 -1
  62. package/src/stylesheets/7-deprecated/3-app/_app.scss +8 -8
  63. package/src/stylesheets/7-deprecated/5-components/_error.scss +19 -9
  64. package/src/stylesheets/7-deprecated/5-components/_input.scss +1 -1
  65. package/src/stylesheets/7-deprecated/5-components/_options.scss +8 -10
  66. package/src/stylesheets/styles-default-implementation.scss +3 -0
  67. package/src/stylesheets/styles.scss +8 -9
  68. package/webpack/config.common.js +7 -1
  69. package/webpack/config.package.js +9 -1
  70. package/webpack/config.test.js +1 -0
  71. package/webpack/defaults.js +3 -6
  72. package/CHANGELOG.md +0 -625
  73. package/build/dist/lib/style-guide.min.js.LICENSE.txt +0 -9
  74. package/src/javascripts/ui/components/layout/modal-wrapper.js +0 -0
  75. package/src/stylesheets/6-webui-only/_hover.scss +0 -151
  76. package/src/stylesheets/styles-webui-only.scss +0 -3
@@ -65,7 +65,7 @@ const participantInfo = {
65
65
  'e65fa8dc-97ab-4711-8fec-82bae6461aa2': {
66
66
  avatar,
67
67
  id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
68
- introduction: "You're now talking to Mrs. Bot gimme a minit",
68
+ introduction: "You're now talking to {{name}} gimme a minit",
69
69
  name: 'Mrs. Bot',
70
70
  service: {
71
71
  expose: { map: {}, version: 2 },
@@ -77,7 +77,7 @@ const participantInfo = {
77
77
  },
78
78
  'e65fa8dc-97ab-4711-8fec-82bae6461aa3': {
79
79
  id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa3',
80
- introduction: "You're now talking to Mrs. Bot gimme a minit",
80
+ introduction: "You're now talking to {{name}} gimme a minit",
81
81
  name: 'Mrs. Bot',
82
82
  service: {
83
83
  expose: { map: {}, version: 2 },
@@ -173,6 +173,7 @@ const infoMessage = {
173
173
  body: {
174
174
  text: 'This is a system generated info message',
175
175
  type: 'text',
176
+ variables: {},
176
177
  },
177
178
  fromClient: false,
178
179
  id: randomId(),
@@ -215,7 +216,7 @@ const participantMessage = {
215
216
  participant: {
216
217
  avatar,
217
218
  id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
218
- introduction: "You're now talking to Mrs. Bot gimme a minit",
219
+ introduction: "You're now talking to {{name}} gimme a minit",
219
220
  name: 'Mrs. Bot',
220
221
  service: {
221
222
  expose: { map: {}, version: 2 },
@@ -239,7 +240,7 @@ const participantMessageDefaultIcon = {
239
240
  messageStatus: 'received',
240
241
  participant: {
241
242
  id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa3',
242
- introduction: "You're now talking to Mrs. Bot gimme a minit",
243
+ introduction: "You're now talking to {{name}} gimme a minit",
243
244
  name: 'Mrs. Bot',
244
245
  service: {
245
246
  expose: { map: {}, version: 2 },
@@ -261,6 +262,7 @@ const getCustomMessage = ({ type, data, text }) => ({
261
262
  type,
262
263
  text,
263
264
  data,
265
+ variables: {},
264
266
  },
265
267
  participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
266
268
  service: {
@@ -284,6 +286,7 @@ const shortTextMessage = {
284
286
  body: {
285
287
  text: 'What do you want to do?',
286
288
  type: 'text',
289
+ variables: {},
287
290
  },
288
291
  fromClient: false,
289
292
  fromHistory: true,
@@ -345,6 +348,7 @@ const longTextMessage = {
345
348
  body: {
346
349
  text: 'What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am. What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am. What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am.',
347
350
  type: 'text',
351
+ variables: {},
348
352
  },
349
353
  fromClient: false,
350
354
  fromHistory: true,
@@ -368,6 +372,7 @@ const textMessageBoldItalicUnderline = {
368
372
  body: {
369
373
  text: 'Bubble with **bold** *italic* <u>underline</u>',
370
374
  type: 'text',
375
+ variables: {},
371
376
  },
372
377
  fromClient: false,
373
378
  fromHistory: true,
@@ -389,8 +394,24 @@ const textMessageWithLinks = {
389
394
  type: 'message',
390
395
  payload: {
391
396
  body: {
392
- text: '<a href="https://google.com" data-link-id="1">Link in same window</a> and <a href="https://google.com" data-link-id="2" target="_blank">link in new window</a> embedded in text',
397
+ text: '{{link_1}} and {{link_2}} embedded in text',
393
398
  type: 'text',
399
+ variables: {
400
+ link_1: {
401
+ id: '1',
402
+ name: 'Link in same window',
403
+ newTab: false,
404
+ type: 'link',
405
+ url: 'https://google.com',
406
+ },
407
+ link_2: {
408
+ id: '2',
409
+ name: 'link in new window',
410
+ newTab: true,
411
+ type: 'link',
412
+ url: 'https://google.com',
413
+ },
414
+ },
394
415
  },
395
416
  fromClient: false,
396
417
  fromHistory: true,
@@ -412,8 +433,17 @@ const textMessageWithLongLink = {
412
433
  type: 'message',
413
434
  payload: {
414
435
  body: {
415
- text: 'Here is a long link <a href="https://google.com" data-link-id="1">click me click me please click me yoohoooo please please click me here I am click me now what are you waiting for click me now now now now now click meeeeeeeeeeeeee</a> embedded in text',
436
+ text: 'Here is a long link {{link_1}} embedded in text',
416
437
  type: 'text',
438
+ variables: {
439
+ link_1: {
440
+ id: '1',
441
+ name: 'click me click me please click me yoohoooo please please click me here I am click me now what are you waiting for click me now now now now now click meeeeeeeeeeeeee',
442
+ newTab: false,
443
+ type: 'link',
444
+ url: 'https://google.com',
445
+ },
446
+ },
417
447
  },
418
448
  fromClient: false,
419
449
  fromHistory: true,
@@ -437,6 +467,7 @@ const textMesageWithBullets = {
437
467
  body: {
438
468
  text: '<ul>\n<li>Bullets</li>\n<li>bullets</li>\n<li>bullets</li>\n</ul>\n',
439
469
  type: 'text',
470
+ variables: {},
440
471
  },
441
472
  fromClient: false,
442
473
  fromHistory: true,
@@ -591,6 +622,7 @@ const userMessage = {
591
622
  body: {
592
623
  text: 'This is what the user typed',
593
624
  type: 'text',
625
+ variables: {},
594
626
  },
595
627
  fromClient: true,
596
628
  fromHistory: true,
@@ -609,6 +641,7 @@ const userMessageLong = {
609
641
  body: {
610
642
  text: 'This is what the user typed. And sometimes the user has quite a lot to say and then we get longer lines that need to wrap well and not break the styling so here goes with just such a line right here!!',
611
643
  type: 'text',
644
+ variables: {},
612
645
  },
613
646
  fromClient: true,
614
647
  fromHistory: true,
@@ -752,6 +785,7 @@ const categoryKeys = {
752
785
  messages: 'messages',
753
786
  errors: 'errors',
754
787
  uploads: 'uploads',
788
+ faq: 'faq',
755
789
  features: 'features',
756
790
  options: 'options',
757
791
  suggestions: 'suggestions',
@@ -777,6 +811,10 @@ export const categories = {
777
811
  heading: 'File uploads',
778
812
  description: '',
779
813
  },
814
+ [categoryKeys.faq]: {
815
+ heading: 'FAQ',
816
+ description: '',
817
+ },
780
818
  [categoryKeys.features]: {
781
819
  heading: 'Other features',
782
820
  description: '',
@@ -858,6 +896,189 @@ const cardTopic = {
858
896
  },
859
897
  }
860
898
 
899
+ const faq = {
900
+ faqEmptyList: {
901
+ category: categoryKeys.faq,
902
+ headingText: 'Empty FAQ list',
903
+ description: '',
904
+ ...baseState,
905
+ config: {
906
+ ...baseState.config,
907
+ showFaq: true,
908
+ },
909
+ serviceData: {
910
+ suggestion: {
911
+ body: [],
912
+ },
913
+ },
914
+ },
915
+ faqList: {
916
+ category: categoryKeys.faq,
917
+ headingText: 'FAQ list',
918
+ description: '',
919
+ ...baseState,
920
+
921
+ config: {
922
+ ...baseState.config,
923
+ showFaq: true,
924
+ },
925
+ serviceData: {
926
+ suggestion: {
927
+ body: [
928
+ {
929
+ id: 1,
930
+ question: 'Lorem ipsum dolor sit amet',
931
+ categories: ['short'],
932
+ },
933
+ {
934
+ id: 2,
935
+ question:
936
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
937
+ categories: ['short'],
938
+ },
939
+ {
940
+ id: 3,
941
+ question:
942
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
943
+ categories: ['short'],
944
+ },
945
+ ],
946
+ },
947
+ },
948
+ },
949
+ faqListLong: {
950
+ category: categoryKeys.faq,
951
+ headingText: 'Long FAQ list',
952
+ description: '',
953
+ ...baseState,
954
+ config: {
955
+ ...baseState.config,
956
+ showFaq: true,
957
+ },
958
+ serviceData: {
959
+ suggestion: {
960
+ body: [
961
+ {
962
+ id: 1,
963
+ question: 'Lorem ipsum dolor sit amet',
964
+ categories: ['long'],
965
+ },
966
+ {
967
+ id: 2,
968
+ question:
969
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
970
+ categories: ['long'],
971
+ },
972
+ {
973
+ id: 3,
974
+ question:
975
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
976
+ categories: ['long'],
977
+ },
978
+ {
979
+ id: 4,
980
+ question:
981
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
982
+ categories: ['long'],
983
+ },
984
+ {
985
+ id: 5,
986
+ question: 'Lorem ipsum dolor sit amet',
987
+ categories: ['long'],
988
+ },
989
+ {
990
+ id: 6,
991
+ question:
992
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
993
+ categories: ['long'],
994
+ },
995
+ {
996
+ id: 7,
997
+ question:
998
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
999
+ categories: ['long'],
1000
+ },
1001
+ {
1002
+ id: 8,
1003
+ question:
1004
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
1005
+ categories: ['long'],
1006
+ },
1007
+ {
1008
+ id: 9,
1009
+ question: 'Lorem ipsum dolor sit amet',
1010
+ categories: ['long'],
1011
+ },
1012
+ {
1013
+ id: 10,
1014
+ question:
1015
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
1016
+ categories: ['long'],
1017
+ },
1018
+ {
1019
+ id: 11,
1020
+ question:
1021
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
1022
+ categories: ['long'],
1023
+ },
1024
+ {
1025
+ id: 12,
1026
+ question:
1027
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
1028
+ categories: ['long'],
1029
+ },
1030
+ {
1031
+ id: 13,
1032
+ question: 'Lorem ipsum dolor sit amet',
1033
+ categories: ['long'],
1034
+ },
1035
+ {
1036
+ id: 14,
1037
+ question:
1038
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
1039
+ categories: ['long'],
1040
+ },
1041
+ {
1042
+ id: 15,
1043
+ question:
1044
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
1045
+ categories: ['long'],
1046
+ },
1047
+ {
1048
+ id: 16,
1049
+ question:
1050
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
1051
+ categories: ['long'],
1052
+ },
1053
+ {
1054
+ id: 17,
1055
+ question: 'Lorem ipsum dolor sit amet',
1056
+ categories: ['long'],
1057
+ },
1058
+ {
1059
+ id: 18,
1060
+ question:
1061
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
1062
+ categories: ['long'],
1063
+ },
1064
+ {
1065
+ id: 19,
1066
+ question:
1067
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
1068
+ categories: ['long'],
1069
+ },
1070
+ {
1071
+ id: 20,
1072
+ question:
1073
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
1074
+ categories: ['long'],
1075
+ },
1076
+ ],
1077
+ },
1078
+ },
1079
+ },
1080
+ }
1081
+
861
1082
  const standardState = {
862
1083
  base: {
863
1084
  category: categoryKeys.unstarted,
@@ -876,7 +1097,6 @@ const standardState = {
876
1097
  activeServiceSessionId: '3942159e-9878-469e-9120-f44fd6be0f35',
877
1098
  },
878
1099
  events: [
879
- splashMessage,
880
1100
  participantMessage,
881
1101
  infoMessage,
882
1102
  shortTextMessage,
@@ -994,6 +1214,7 @@ const standardState = {
994
1214
  body: {
995
1215
  text: 'Long ago when a dialog started',
996
1216
  type: 'text',
1217
+ variables: {},
997
1218
  },
998
1219
  },
999
1220
  },
@@ -1055,6 +1276,7 @@ const standardState = {
1055
1276
  body: {
1056
1277
  text: 'Long ago when a dialog started',
1057
1278
  type: 'text',
1279
+ variables: {},
1058
1280
  },
1059
1281
  },
1060
1282
  },
@@ -1067,6 +1289,7 @@ const standardState = {
1067
1289
  body: {
1068
1290
  text: 'Above me should be a time indicator showing the full date',
1069
1291
  type: 'text',
1292
+ variables: {},
1070
1293
  },
1071
1294
  },
1072
1295
  },
@@ -1079,6 +1302,7 @@ const standardState = {
1079
1302
  body: {
1080
1303
  text: 'Another message',
1081
1304
  type: 'text',
1305
+ variables: {},
1082
1306
  },
1083
1307
  },
1084
1308
  },
@@ -1091,6 +1315,7 @@ const standardState = {
1091
1315
  body: {
1092
1316
  text: 'And another message',
1093
1317
  type: 'text',
1318
+ variables: {},
1094
1319
  },
1095
1320
  },
1096
1321
  },
@@ -1103,6 +1328,7 @@ const standardState = {
1103
1328
  body: {
1104
1329
  text: 'Above me should be a time indicator showing "yesterday"',
1105
1330
  type: 'text',
1331
+ variables: {},
1106
1332
  },
1107
1333
  },
1108
1334
  },
@@ -1115,6 +1341,7 @@ const standardState = {
1115
1341
  body: {
1116
1342
  text: 'Another message',
1117
1343
  type: 'text',
1344
+ variables: {},
1118
1345
  },
1119
1346
  },
1120
1347
  },
@@ -1127,6 +1354,7 @@ const standardState = {
1127
1354
  body: {
1128
1355
  text: 'And another message',
1129
1356
  type: 'text',
1357
+ variables: {},
1130
1358
  },
1131
1359
  },
1132
1360
  },
@@ -1139,6 +1367,7 @@ const standardState = {
1139
1367
  body: {
1140
1368
  text: 'Above me should be a time indicator showing me the dialog continues today',
1141
1369
  type: 'text',
1370
+ variables: {},
1142
1371
  },
1143
1372
  },
1144
1373
  },
@@ -1179,21 +1408,6 @@ const standardState = {
1179
1408
  },
1180
1409
  ],
1181
1410
  },
1182
- suggestionsMessage: {
1183
- category: categoryKeys.messages,
1184
- headingText: 'Suggestions message',
1185
- description: '',
1186
- ...baseState,
1187
- events: [
1188
- {
1189
- type: 'service_data',
1190
- payload: {
1191
- type: 'suggestion',
1192
- body: suggestions,
1193
- },
1194
- },
1195
- ],
1196
- },
1197
1411
  errorWithAction: {
1198
1412
  // Important: This cannot pick up the language files so the text is hard set here.
1199
1413
  category: categoryKeys.errors,
@@ -1639,9 +1853,87 @@ const inlineInterface = {
1639
1853
  },
1640
1854
  }
1641
1855
 
1642
- const buildStandardState = (layoutModes, customComponentEventBodies = []) => {
1856
+ const standardWindowStates = {
1857
+ minimizedWindow: {
1858
+ category: categoryKeys.minimizedWindow,
1859
+ headingText: 'Unstarted minimized',
1860
+ description: '',
1861
+ window: {
1862
+ ...baseState,
1863
+ config: { ...baseState.config, layoutMode: 'window' },
1864
+ visibility: {
1865
+ ...baseState.visibility,
1866
+ visibility: visibilityStates.minimized,
1867
+ },
1868
+ },
1869
+ },
1870
+ minimizedWindowStarted: {
1871
+ category: categoryKeys.minimizedWindow,
1872
+ headingText: 'Started minimized',
1873
+ description: '',
1874
+ window: {
1875
+ ...baseState,
1876
+ config: { ...baseState.config, layoutMode: 'window' },
1877
+ visibility: {
1878
+ ...baseState.visibility,
1879
+ visibility: visibilityStates.minimized,
1880
+ },
1881
+ participantInfo,
1882
+ headerTitles,
1883
+ },
1884
+ },
1885
+ minimizedWindowStartedUnread: {
1886
+ category: categoryKeys.minimizedWindow,
1887
+ headingText: 'Minimized with unread messages',
1888
+ description: '',
1889
+ window: {
1890
+ ...baseState,
1891
+ config: { ...baseState.config, layoutMode: 'window' },
1892
+ visibility: {
1893
+ ...baseState.visibility,
1894
+ visibility: visibilityStates.minimized,
1895
+ },
1896
+ participantInfo,
1897
+ headerTitles,
1898
+ unreadEvents: 12,
1899
+ },
1900
+ },
1901
+ }
1902
+
1903
+ const newInterface = {
1904
+ suggestionsMessage: {
1905
+ category: categoryKeys.messages,
1906
+ headingText: 'Suggestions message',
1907
+ description: '',
1908
+ ...baseState,
1909
+ events: [
1910
+ {
1911
+ type: 'service_data',
1912
+ payload: {
1913
+ type: 'suggestion',
1914
+ body: suggestions,
1915
+ },
1916
+ },
1917
+ ],
1918
+ },
1919
+ }
1920
+
1921
+ const buildStandardState = (
1922
+ layoutModes,
1923
+ customComponentEventBodies = [],
1924
+ isNewInterface,
1925
+ ) => {
1643
1926
  const intermediateState = {
1644
- ...standardState,
1927
+ ...(isNewInterface
1928
+ ? {
1929
+ ...standardState,
1930
+ fullConversation: {
1931
+ ...standardState.fullConversation,
1932
+ events: [splashMessage, ...standardState.fullConversation.events],
1933
+ },
1934
+ }
1935
+ : standardState),
1936
+ ...(isNewInterface ? newInterface : faq),
1645
1937
  ...customComponentEventBodies.reduce((acc, eventBody) => {
1646
1938
  const { key, headingText, description, body } = eventBody
1647
1939
  return {
@@ -1678,54 +1970,19 @@ const buildStandardState = (layoutModes, customComponentEventBodies = []) => {
1678
1970
  }, {})
1679
1971
  }
1680
1972
 
1681
- export const getStateObj = (layoutModes, customComponentEventBodies) => ({
1973
+ export const getDeprecatedStateObj = (
1974
+ layoutModes,
1975
+ customComponentEventBodies,
1976
+ ) => ({
1682
1977
  ...buildStandardState(layoutModes, customComponentEventBodies),
1978
+ ...(layoutModes.indexOf('window') !== -1 ? standardWindowStates : {}),
1979
+ })
1980
+
1981
+ export const getStateObj = (layoutModes, customComponentEventBodies) => ({
1982
+ ...buildStandardState(layoutModes, customComponentEventBodies, true),
1683
1983
  ...(layoutModes.indexOf('window') !== -1
1684
1984
  ? {
1685
- minimizedWindow: {
1686
- category: categoryKeys.minimizedWindow,
1687
- headingText: 'Unstarted minimized',
1688
- description: '',
1689
- window: {
1690
- ...baseState,
1691
- config: { ...baseState.config, layoutMode: 'window' },
1692
- visibility: {
1693
- ...baseState.visibility,
1694
- visibility: visibilityStates.minimized,
1695
- },
1696
- },
1697
- },
1698
- minimizedWindowStarted: {
1699
- category: categoryKeys.minimizedWindow,
1700
- headingText: 'Started minimized',
1701
- description: '',
1702
- window: {
1703
- ...baseState,
1704
- config: { ...baseState.config, layoutMode: 'window' },
1705
- visibility: {
1706
- ...baseState.visibility,
1707
- visibility: visibilityStates.minimized,
1708
- },
1709
- participantInfo,
1710
- headerTitles,
1711
- },
1712
- },
1713
- minimizedWindowStartedUnread: {
1714
- category: categoryKeys.minimizedWindow,
1715
- headingText: 'Minimized with unread messages',
1716
- description: '',
1717
- window: {
1718
- ...baseState,
1719
- config: { ...baseState.config, layoutMode: 'window' },
1720
- visibility: {
1721
- ...baseState.visibility,
1722
- visibility: visibilityStates.minimized,
1723
- },
1724
- participantInfo,
1725
- headerTitles,
1726
- unreadEvents: 12,
1727
- },
1728
- },
1985
+ ...standardWindowStates,
1729
1986
  minimizedWindowPrechat: {
1730
1987
  category: categoryKeys.minimizedWindow,
1731
1988
  headingText: 'Minimized with pre-chat messages',
@@ -17,17 +17,23 @@ export default function AppOptions() {
17
17
  }
18
18
 
19
19
  return (
20
- <div className={className('app__options')}>
20
+ <div className={className('chat__options')}>
21
21
  {isTranslationsAvailable && (
22
22
  <div
23
- className={className('app__options-item', 'app__options-item--left')}
23
+ className={className(
24
+ 'chat__options-item',
25
+ 'chat__options-item--left',
26
+ )}
24
27
  >
25
28
  <TranslationsOptionsButton />
26
29
  </div>
27
30
  )}
28
31
  {allowOptionSelection && (
29
32
  <div
30
- className={className('app__options-item', 'app__options-item--right')}
33
+ className={className(
34
+ 'chat__options-item',
35
+ 'chat__options-item--right',
36
+ )}
31
37
  >
32
38
  <OptionsButton />
33
39
  </div>
@@ -72,7 +72,7 @@ const Conversation = () => {
72
72
  {t('skiplinkText')}
73
73
  </a>
74
74
  )}
75
- <div className={className('app__body')} ref={appBodyContainer}>
75
+ <div className={className('chat__body')} ref={appBodyContainer}>
76
76
  <div className={className('conversation__container')}>
77
77
  <PrivacyDisclaimer />
78
78
  <ol className={className('conversation')}>
@@ -1,11 +1,13 @@
1
1
  import MessageContainer from '../../message-container'
2
2
  import CarouselComponent from '../carousel-component'
3
+ import { useTranslatedEventData } from '../../../../../domains/translations'
3
4
  import CarouselMessageSlide from './components/slide'
4
5
 
5
6
  const getItemKey = (item, idx, prefix = '') => `${prefix}${item.title}:${idx}`
6
7
  const getItemLabel = (item) => item.title
7
8
  const CarouselMessage = ({ event }) => {
8
- const slides = event.payload.body.cards
9
+ const [body] = useTranslatedEventData(event)
10
+ const slides = body.cards
9
11
 
10
12
  return (
11
13
  <MessageContainer event={event} modifiers={'type-carousel'}>
@@ -1,4 +1,4 @@
1
- import { useCallback } from 'preact/hooks'
1
+ import { useCallback, useState } from 'preact/hooks'
2
2
  import { className } from '../../../../lib/css'
3
3
  import { actionTypes } from '../../../utils/seamly-utils'
4
4
  import { useI18n } from '../../../../domains/i18n'
@@ -6,6 +6,7 @@ import { useTranslatedEventData } from '../../../../domains/translations'
6
6
  import MessageContainer from '../message-container'
7
7
  import { useSeamlyCommands } from '../../../hooks/seamly-hooks'
8
8
  import SuggestionsList from '../../suggestions/suggestions-list'
9
+ import { useConfig } from '../../../../domains/config'
9
10
 
10
11
  export const useSuggestions = (event) => {
11
12
  const { payload } = event
@@ -18,6 +19,8 @@ export const useSuggestions = (event) => {
18
19
  }
19
20
 
20
21
  const ConversationSuggestions = ({ event, ...props }) => {
22
+ const { userResponded } = useConfig()
23
+ const [isExpanded, setIsExpanded] = useState(true)
21
24
  const { t } = useI18n()
22
25
  const headingText = t('suggestions.headingText')
23
26
  const footerText = t('suggestions.footerText')
@@ -26,6 +29,8 @@ const ConversationSuggestions = ({ event, ...props }) => {
26
29
  const handleClick = useCallback(
27
30
  ({ id, question }) => {
28
31
  // @todo Refactor to 'suggestionclick'
32
+ setIsExpanded(false)
33
+
29
34
  sendAction({
30
35
  type: actionTypes.custom,
31
36
  originMessage: payload.id,
@@ -40,13 +45,17 @@ const ConversationSuggestions = ({ event, ...props }) => {
40
45
 
41
46
  addMessageBubble(question)
42
47
  },
43
- [payload, sendAction, addMessageBubble],
48
+ [payload, sendAction, addMessageBubble, setIsExpanded],
44
49
  )
45
50
 
51
+ if (!isExpanded || userResponded) {
52
+ return null
53
+ }
54
+
46
55
  return (
47
56
  <div className={className('suggestions', 'suggestions--conversation')}>
48
57
  {headingText && (
49
- <h2 className={className('suggestions__heading')}>{headingText}</h2>
58
+ <p className={className('suggestions__heading')}>{headingText}</p>
50
59
  )}
51
60
  <MessageContainer
52
61
  type="suggestions"