@seamly/web-ui 18.2.0 → 19.0.0-beta.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 (194) hide show
  1. package/build/dist/lib/index.debug.js +598 -136
  2. package/build/dist/lib/index.debug.min.js +1 -1
  3. package/build/dist/lib/index.debug.min.js.LICENSE.txt +190 -22
  4. package/build/dist/lib/index.js +4745 -4468
  5. package/build/dist/lib/index.min.js +1 -1
  6. package/build/dist/lib/index.min.js.LICENSE.txt +1 -1
  7. package/build/dist/lib/standalone.js +4839 -4465
  8. package/build/dist/lib/standalone.min.js +1 -1
  9. package/build/dist/lib/standalone.min.js.LICENSE.txt +1 -1
  10. package/build/dist/lib/style-guide.js +1770 -980
  11. package/build/dist/lib/style-guide.min.js +1 -1
  12. package/build/dist/lib/styles.css +1 -1
  13. package/build/dist/lib/utils.js +0 -1
  14. package/build/dist/lib/utils.min.js +1 -1
  15. package/package.json +29 -29
  16. package/src/javascripts/api/index.js +33 -48
  17. package/src/javascripts/api/producer.js +9 -12
  18. package/src/javascripts/config.js +9 -11
  19. package/src/javascripts/domains/app/actions.js +43 -0
  20. package/src/javascripts/domains/app/hooks.js +6 -0
  21. package/src/javascripts/domains/app/index.js +6 -0
  22. package/src/javascripts/domains/app/reducer.js +16 -0
  23. package/src/javascripts/domains/app/selectors.js +8 -0
  24. package/src/javascripts/domains/app/utils.js +4 -0
  25. package/src/javascripts/domains/config/actions.js +4 -0
  26. package/src/javascripts/domains/config/hooks.js +6 -0
  27. package/src/javascripts/domains/config/index.js +8 -0
  28. package/src/javascripts/domains/config/middleware.js +22 -0
  29. package/src/javascripts/domains/config/reducer.js +63 -0
  30. package/src/javascripts/domains/config/selectors.js +23 -0
  31. package/src/javascripts/domains/config/utils.js +4 -0
  32. package/src/javascripts/domains/forms/actions.js +2 -4
  33. package/src/javascripts/domains/forms/hooks.js +10 -14
  34. package/src/javascripts/domains/forms/provider.js +4 -6
  35. package/src/javascripts/domains/forms/reducer.js +1 -2
  36. package/src/javascripts/domains/forms/selectors.js +4 -4
  37. package/src/javascripts/domains/forms/utils.js +5 -0
  38. package/src/javascripts/domains/i18n/actions.js +35 -0
  39. package/src/javascripts/domains/i18n/hooks.js +38 -0
  40. package/src/javascripts/domains/i18n/index.js +5 -80
  41. package/src/javascripts/domains/i18n/reducer.js +58 -0
  42. package/src/javascripts/domains/i18n/selectors.js +15 -0
  43. package/src/javascripts/domains/i18n/utils.js +9 -0
  44. package/src/javascripts/domains/interrupt/actions.js +4 -0
  45. package/src/javascripts/domains/interrupt/hooks.js +29 -0
  46. package/src/javascripts/domains/interrupt/index.js +9 -0
  47. package/src/javascripts/domains/interrupt/middleware.js +30 -0
  48. package/src/javascripts/domains/interrupt/reducer.js +21 -0
  49. package/src/javascripts/domains/interrupt/selectors.js +6 -0
  50. package/src/javascripts/domains/interrupt/utils.js +4 -0
  51. package/src/javascripts/domains/options/index.js +1 -0
  52. package/src/javascripts/domains/options/middleware.js +35 -0
  53. package/src/javascripts/domains/redux/create-redux-store.js +14 -6
  54. package/src/javascripts/domains/redux/hooks.js +3 -2
  55. package/src/javascripts/domains/redux/index.js +2 -1
  56. package/src/javascripts/domains/redux/provider.js +5 -0
  57. package/src/javascripts/domains/store/index.js +44 -0
  58. package/src/javascripts/{ui → domains}/store/state-reducer.js +4 -7
  59. package/src/javascripts/domains/translations/actions.js +4 -6
  60. package/src/javascripts/domains/translations/components/chat-status.js +7 -13
  61. package/src/javascripts/domains/translations/components/options-button.js +3 -3
  62. package/src/javascripts/domains/translations/components/options-dialog/form.js +12 -7
  63. package/src/javascripts/domains/translations/components/options-dialog/index.js +2 -5
  64. package/src/javascripts/domains/translations/hooks.js +1 -1
  65. package/src/javascripts/domains/translations/index.js +1 -0
  66. package/src/javascripts/domains/translations/middleware.js +43 -0
  67. package/src/javascripts/domains/translations/reducer.js +4 -11
  68. package/src/javascripts/domains/translations/selectors.js +3 -3
  69. package/src/javascripts/domains/translations/utils.js +4 -0
  70. package/src/javascripts/index.js +20 -5
  71. package/src/javascripts/lib/css.js +5 -5
  72. package/src/javascripts/lib/engine/index.js +39 -11
  73. package/src/javascripts/lib/external-api/index.js +6 -6
  74. package/src/javascripts/lib/mutex.js +30 -0
  75. package/src/javascripts/lib/parse-body.js +1 -1
  76. package/src/javascripts/lib/redux-helpers/index.js +25 -8
  77. package/src/javascripts/lib/split-url-params.js +2 -2
  78. package/src/javascripts/lib/store/providers/app-storage.js +1 -1
  79. package/src/javascripts/lib/store/providers/cookie-storage.js +1 -1
  80. package/src/javascripts/package/utils.js +0 -1
  81. package/src/javascripts/style-guide/components/app.js +12 -14
  82. package/src/javascripts/style-guide/components/links.js +6 -6
  83. package/src/javascripts/style-guide/components/static-core.js +32 -10
  84. package/src/javascripts/style-guide/state-helpers/index.js +1 -1
  85. package/src/javascripts/style-guide/states.js +29 -71
  86. package/src/javascripts/style-guide/style-guide-engine.js +13 -12
  87. package/src/javascripts/ui/components/chat-app.js +2 -2
  88. package/src/javascripts/ui/components/conversation/component-filter.js +2 -2
  89. package/src/javascripts/ui/components/conversation/conversation.js +2 -2
  90. package/src/javascripts/ui/components/conversation/event/card-component.js +24 -3
  91. package/src/javascripts/ui/components/conversation/event/carousel-component/components/pagination.js +2 -2
  92. package/src/javascripts/ui/components/conversation/event/carousel-component/index.js +4 -3
  93. package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js +2 -1
  94. package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +2 -2
  95. package/src/javascripts/ui/components/conversation/event/choice-prompt.js +5 -5
  96. package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +2 -2
  97. package/src/javascripts/ui/components/conversation/event/event-participant.js +3 -5
  98. package/src/javascripts/ui/components/conversation/event/hooks/use-event-link-click-handler.js +2 -2
  99. package/src/javascripts/ui/components/conversation/event/hooks/use-formatted-date.js +3 -3
  100. package/src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js +3 -3
  101. package/src/javascripts/ui/components/conversation/event/participant.js +2 -2
  102. package/src/javascripts/ui/components/conversation/event/upload.js +12 -27
  103. package/src/javascripts/ui/components/conversation/message-container.js +4 -6
  104. package/src/javascripts/ui/components/core/seamly-activity-monitor.js +4 -5
  105. package/src/javascripts/ui/components/core/seamly-core.js +6 -7
  106. package/src/javascripts/ui/components/core/seamly-event-subscriber.js +18 -17
  107. package/src/javascripts/ui/components/core/seamly-file-upload.js +5 -6
  108. package/src/javascripts/ui/components/core/seamly-idle-detach-counter.js +2 -6
  109. package/src/javascripts/ui/components/core/seamly-initializer.js +7 -60
  110. package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +10 -16
  111. package/src/javascripts/ui/components/core/seamly-live-region.js +1 -1
  112. package/src/javascripts/ui/components/core/seamly-new-notifications.js +5 -6
  113. package/src/javascripts/ui/components/core/seamly-read-state.js +8 -6
  114. package/src/javascripts/ui/components/entry/entry-container.js +7 -10
  115. package/src/javascripts/ui/components/entry/text-entry/hooks.js +6 -4
  116. package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +10 -3
  117. package/src/javascripts/ui/components/entry/toggle-button.js +24 -10
  118. package/src/javascripts/ui/components/entry/upload/file-upload-form.js +6 -3
  119. package/src/javascripts/ui/components/entry/upload/index.js +11 -13
  120. package/src/javascripts/ui/components/faq/faq.js +6 -6
  121. package/src/javascripts/ui/components/form-controls/error.js +22 -0
  122. package/src/javascripts/ui/components/form-controls/file-input.js +3 -9
  123. package/src/javascripts/ui/components/form-controls/select.js +1 -1
  124. package/src/javascripts/ui/components/form-controls/wrapper.js +2 -9
  125. package/src/javascripts/ui/components/layout/agent-info.js +4 -4
  126. package/src/javascripts/ui/components/layout/app-frame.js +15 -12
  127. package/src/javascripts/ui/components/layout/chat-frame.js +3 -5
  128. package/src/javascripts/ui/components/layout/header.js +4 -18
  129. package/src/javascripts/ui/components/layout/interrupt.js +6 -2
  130. package/src/javascripts/ui/components/layout/privacy-disclaimer.js +2 -2
  131. package/src/javascripts/ui/components/options/cobrowsing.js +3 -7
  132. package/src/javascripts/ui/components/options/options-button.js +9 -13
  133. package/src/javascripts/ui/components/options/options-frame.js +1 -1
  134. package/src/javascripts/ui/components/options/transcript/index.js +2 -2
  135. package/src/javascripts/ui/components/options/transcript/transcript-form.js +1 -1
  136. package/src/javascripts/ui/components/warnings/cobrowsing-active-frame.js +3 -6
  137. package/src/javascripts/ui/components/warnings/idle-detach-warning.js +2 -6
  138. package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +1 -1
  139. package/src/javascripts/ui/components/widgets/in-out-transition.js +2 -2
  140. package/src/javascripts/ui/components/widgets/lightbox.js +4 -4
  141. package/src/javascripts/ui/components/widgets/modal.js +3 -3
  142. package/src/javascripts/ui/components/widgets/upload-progress.js +3 -14
  143. package/src/javascripts/ui/hooks/component-helper-hooks.js +4 -15
  144. package/src/javascripts/ui/hooks/file-upload-hooks.js +3 -3
  145. package/src/javascripts/ui/hooks/focus-helper-hooks.js +4 -4
  146. package/src/javascripts/ui/hooks/live-region-hooks.js +2 -2
  147. package/src/javascripts/ui/hooks/seamly-api-hooks.js +0 -6
  148. package/src/javascripts/ui/hooks/seamly-entry-hooks.js +22 -25
  149. package/src/javascripts/ui/hooks/seamly-hooks.js +3 -10
  150. package/src/javascripts/ui/hooks/seamly-option-hooks.js +4 -4
  151. package/src/javascripts/ui/hooks/seamly-state-hooks.js +8 -16
  152. package/src/javascripts/ui/hooks/use-event-component-mapping.js +1 -1
  153. package/src/javascripts/ui/hooks/use-seamly-chat.js +1 -0
  154. package/src/javascripts/ui/hooks/use-seamly-commands.js +31 -54
  155. package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +3 -3
  156. package/src/javascripts/ui/hooks/use-seamly-stored-visibility.js +3 -3
  157. package/src/javascripts/ui/hooks/use-seamly-visibility.js +6 -8
  158. package/src/javascripts/ui/hooks/use-single-file-upload.js +4 -1
  159. package/src/javascripts/ui/hooks/utility-hooks.js +2 -2
  160. package/src/javascripts/ui/utils/form-utils.js +3 -3
  161. package/src/javascripts/ui/utils/general-utils.js +21 -22
  162. package/src/javascripts/ui/utils/seamly-utils.js +15 -83
  163. package/src/javascripts/ui/utils/validations.js +10 -7
  164. package/src/stylesheets/1-settings/_config.scss +2 -1
  165. package/src/stylesheets/3-app/_app.scss +3 -4
  166. package/src/stylesheets/5-components/_card.scss +0 -1
  167. package/src/stylesheets/5-components/_faq.scss +3 -8
  168. package/src/stylesheets/5-components/_message.scss +10 -0
  169. package/src/stylesheets/5-components/_modal.scss +3 -3
  170. package/src/stylesheets/5-components/_options.scss +3 -2
  171. package/webpack/config.common.js +3 -3
  172. package/webpack/config.package.js +4 -22
  173. package/webpack/config.site.js +8 -6
  174. package/webpack/defaults.js +0 -3
  175. package/CHANGELOG.md +0 -561
  176. package/build/dist/translations/de-informal.js +0 -275
  177. package/build/dist/translations/de-informal.min.js +0 -1
  178. package/build/dist/translations/en.js +0 -275
  179. package/build/dist/translations/en.min.js +0 -1
  180. package/build/dist/translations/es-informal.js +0 -281
  181. package/build/dist/translations/es-informal.min.js +0 -1
  182. package/build/dist/translations/nl-formal.js +0 -275
  183. package/build/dist/translations/nl-formal.min.js +0 -1
  184. package/build/dist/translations/nl-informal.js +0 -275
  185. package/build/dist/translations/nl-informal.min.js +0 -1
  186. package/src/javascripts/lib/i18n.js +0 -46
  187. package/src/javascripts/ui/components/core/seamly-api.js +0 -44
  188. package/src/javascripts/ui/hooks/use-seamly-interrupt.js +0 -62
  189. package/src/javascripts/ui/store/index.js +0 -37
  190. package/translations/de-informal.js +0 -237
  191. package/translations/en.js +0 -234
  192. package/translations/es-informal.js +0 -243
  193. package/translations/nl-formal.js +0 -230
  194. package/translations/nl-informal.js +0 -230
@@ -4,18 +4,6 @@
4
4
  /******/ var __webpack_require__ = {};
5
5
  /******/
6
6
  /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
7
  /******/ /* webpack/runtime/define property getters */
20
8
  /******/ (() => {
21
9
  /******/ // define getter functions for harmony exports
@@ -58,54 +46,12 @@ __webpack_require__.d(__webpack_exports__, {
58
46
  const web_ui_namespaceObject = require("@seamly/web-ui");
59
47
  ;// CONCATENATED MODULE: external "preact"
60
48
  const external_preact_namespaceObject = require("preact");
61
- ;// CONCATENATED MODULE: external "@seamly/web-ui/translations/en"
62
- const en_namespaceObject = require("@seamly/web-ui/translations/en");
63
- var en_default = /*#__PURE__*/__webpack_require__.n(en_namespaceObject);
64
49
  ;// CONCATENATED MODULE: external "preact/hooks"
65
50
  const hooks_namespaceObject = require("preact/hooks");
66
51
  ;// CONCATENATED MODULE: ./src/javascripts/lib/id.js
67
52
  function id_randomId() {
68
53
  return '_' + (Number(String(Math.random()).slice(2)) + Date.now() + Math.round(performance.now())).toString(36);
69
54
  }
70
- ;// CONCATENATED MODULE: ./src/javascripts/config.js
71
- const CSS_NAME = 'cvco';
72
- const apiVersion = '2';
73
- const layoutMode = 'window'; // "window", "inline" ("sidebar"), "modal"
74
-
75
- const config_appContainerClassNames = config => [`app--layout-${config.layoutMode}`, `namespace--${config.namespace}`];
76
- const typing = {
77
- timeout: 2000 // How long to wait before we decide the user isn't typing
78
-
79
- };
80
- const config_userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
81
- // broadcasting to the screen reader. This is done to avoid verbosity.
82
-
83
- const unreadScreenReaderWait = 2000;
84
- const newMessageScreenReaderWait = 1000;
85
- const config_screenReaderDebounceDelaySeconds = 10;
86
- const activitySendDelay = 15000;
87
- const maxCharacterWarningLimit = 50;
88
- const maxCharacterSrDebounceDelay = 300;
89
- const config_defaultTransitionTimeMs = 300;
90
- const config_defaultConfig = {
91
- messages: {
92
- agent: {
93
- showAvatar: false,
94
- // true, "inline"
95
- showName: false
96
- },
97
- user: {
98
- showAvatar: false,
99
- // true, "inline"
100
- showName: false
101
- },
102
- timeIndicator: {
103
- enabled: false,
104
- threshold: 3600000 // Default threshold is an hour in milliseconds
105
-
106
- }
107
- }
108
- };
109
55
  ;// CONCATENATED MODULE: ./src/javascripts/ui/utils/general-utils.js
110
56
  function 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; }
111
57
 
@@ -285,19 +231,15 @@ const getRelativeDate = (date, currentDate) => {
285
231
  return date;
286
232
  }
287
233
  };
288
- const flattenObject = (obj, prefix = '') => Object.keys(obj).reduce((acc, k) => {
289
- const pre = prefix.length ? `${prefix}.` : '';
290
- if (typeof obj[k] === 'object' && obj[k] !== null && Object.keys(obj[k]).length > 0) Object.assign(acc, flattenObject(obj[k], pre + k));else acc[pre + k] = obj[k];
291
- return acc;
234
+ const pick = (obj, keys) => keys.reduce((accum, key) => {
235
+ if (key in obj) accum[key] = obj[key];
236
+ return accum;
237
+ }, {});
238
+ const omit = (obj, keys) => Object.keys(obj).reduce((accum, key) => {
239
+ if (!keys.includes(key)) accum[key] = obj[key];
240
+ return accum;
292
241
  }, {});
293
242
  ;// CONCATENATED MODULE: ./src/javascripts/ui/utils/seamly-utils.js
294
- const _excluded = (/* unused pure expression or super */ null && (["messages", "typing"])),
295
- _excluded2 = (/* unused pure expression or super */ null && (["messages"]));
296
-
297
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
298
-
299
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
300
-
301
243
  function seamly_utils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
302
244
 
303
245
  function seamly_utils_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { seamly_utils_ownKeys(Object(source), true).forEach(function (key) { seamly_utils_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { seamly_utils_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -305,7 +247,6 @@ function seamly_utils_objectSpread(target) { for (var i = 1; i < arguments.lengt
305
247
  function seamly_utils_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
306
248
 
307
249
 
308
-
309
250
  const eventTypes = {
310
251
  info: 'info',
311
252
  message: 'message',
@@ -364,13 +305,13 @@ const dividerKeys = {
364
305
  new_topic: 'newTopic',
365
306
  new_translation: 'newTranslation'
366
307
  };
367
- const seamly_utils_featureKeys = {
308
+ const featureKeys = {
368
309
  cobrowsing: 'cobrowsing',
369
310
  sendTranscript: 'sendTranscript',
370
311
  typingPeekahead: 'typingPeekahead',
371
312
  uploads: 'uploads'
372
313
  };
373
- const seamlyActions = {
314
+ const seamly_utils_seamlyActions = {
374
315
  ADD_EVENT: 'ADD_EVENT',
375
316
  CLEAR_EVENTS: 'CLEAR_EVENTS',
376
317
  SET_HISTORY: 'SET_HISTORY',
@@ -381,12 +322,9 @@ const seamlyActions = {
381
322
  SET_PARTICIPANT: 'SET_PARTICIPANT',
382
323
  SET_HEADER_TITLE: 'SET_HEADER_TITLE',
383
324
  SET_HEADER_SUB_TITLE: 'SET_HEADER_SUB_TITLE',
384
- SET_INTERRUPT: ' SET_INTERRUPT',
385
- CLEAR_INTERRUPT: 'CLEAR_INTERRUPT',
386
325
  SET_VISIBILITY: 'SET_VISIBILITY',
387
326
  RESET_HISTORY_LOADED_FLAG: 'RESET_HISTORY_LOADED_FLAG',
388
327
  SET_ACTIVE_SERVICE: 'SET_ACTIVE_SERVICE',
389
- SET_SHOW_DISCLAIMER: 'SET_SHOW_DISCLAIMER',
390
328
  INIT_IDLE_DETACH_COUNTDOWN: 'INIT_IDLE_DETACH_COUNTDOWN',
391
329
  DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER: 'DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER',
392
330
  STOP_IDLE_DETACH_COUNTDOWN_COUNTER: 'STOP_IDLE_DETACH_COUNTDOWN_COUNTER',
@@ -394,7 +332,6 @@ const seamlyActions = {
394
332
  INIT_RESUME_CONVERSATION_PROMPT: 'INIT_RESUME_CONVERSATION_PROMPT',
395
333
  CLEAR_RESUME_CONVERSATION_PROMPT: 'CLEAR_RESUME_CONVERSATION_PROMPT',
396
334
  SET_SERVICE_DATA_ITEM: 'SET_SERVICE_DATA_ITEM',
397
- UPDATE_CONFIG: 'UPDATE_CONFIG',
398
335
  SET_FEATURES: 'SET_FEATURES',
399
336
  SET_FEATURE_ENABLED_STATE: 'SET_FEATURE_ENABLED_STATE',
400
337
  CLEAR_FEATURES: 'CLEAR_FEATURES',
@@ -433,12 +370,9 @@ const {
433
370
  SET_PARTICIPANT,
434
371
  SET_HEADER_TITLE,
435
372
  SET_HEADER_SUB_TITLE,
436
- SET_INTERRUPT,
437
- CLEAR_INTERRUPT,
438
373
  SET_VISIBILITY,
439
374
  RESET_HISTORY_LOADED_FLAG,
440
375
  SET_ACTIVE_SERVICE,
441
- SET_SHOW_DISCLAIMER,
442
376
  INIT_IDLE_DETACH_COUNTDOWN,
443
377
  DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER,
444
378
  STOP_IDLE_DETACH_COUNTDOWN_COUNTER,
@@ -446,7 +380,6 @@ const {
446
380
  INIT_RESUME_CONVERSATION_PROMPT,
447
381
  CLEAR_RESUME_CONVERSATION_PROMPT,
448
382
  SET_SERVICE_DATA_ITEM,
449
- UPDATE_CONFIG,
450
383
  SET_FEATURES,
451
384
  SET_FEATURE_ENABLED_STATE,
452
385
  CLEAR_FEATURES,
@@ -468,7 +401,7 @@ const {
468
401
  RESET_UPLOAD_STATE,
469
402
  RESET_ENTRY_STATE,
470
403
  SET_SEAMLY_CONTAINER_ELEMENT
471
- } = seamlyActions;
404
+ } = seamly_utils_seamlyActions;
472
405
  const isUnreadMessage = ({
473
406
  type,
474
407
  payload
@@ -554,25 +487,6 @@ const headerTitlesReducer = (state, action) => {
554
487
  }
555
488
  };
556
489
 
557
- const interruptReducer = (state, action) => {
558
- switch (action.type) {
559
- case SET_INTERRUPT:
560
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
561
- hasInterrupt: true,
562
- meta: seamly_utils_objectSpread({}, action.interrupt)
563
- });
564
-
565
- case CLEAR_INTERRUPT:
566
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
567
- hasInterrupt: false,
568
- meta: {}
569
- });
570
-
571
- default:
572
- return state;
573
- }
574
- };
575
-
576
490
  const calculateNewEntryMeta = (entryMeta, payload) => {
577
491
  const {
578
492
  entry
@@ -612,7 +526,7 @@ const seamlyStateReducer = (state, action) => {
612
526
  type: eventType,
613
527
  payload
614
528
  } = action.event;
615
- const accountHasUploads = state.options.features.hasOwnProperty(seamly_utils_featureKeys.uploads);
529
+ const accountHasUploads = state.options.features.hasOwnProperty(featureKeys.uploads);
616
530
  const newEntryMeta = calculateNewEntryMeta(state.entryMeta, payload);
617
531
 
618
532
  let newOptions = seamly_utils_objectSpread({}, state.options); // This enabled override of the service enabled value for uploads.
@@ -740,7 +654,7 @@ const seamlyStateReducer = (state, action) => {
740
654
  let newFeatures = seamly_utils_objectSpread({}, state.options.features); // Only set cobrowsing if it was initialised by the account config.
741
655
 
742
656
 
743
- if (newFeatures.hasOwnProperty(seamly_utils_featureKeys.cobrowsing)) {
657
+ if (newFeatures.hasOwnProperty(featureKeys.cobrowsing)) {
744
658
  newFeatures = seamly_utils_objectSpread(seamly_utils_objectSpread({}, newFeatures), {}, {
745
659
  cobrowsing: {
746
660
  enabled: !!(cobrowsing && cobrowsing.enabled)
@@ -748,7 +662,7 @@ const seamlyStateReducer = (state, action) => {
748
662
  });
749
663
  }
750
664
 
751
- const newFeaturesHasUpload = newFeatures.hasOwnProperty(seamly_utils_featureKeys.uploads); // Only set uploads if it was initialised by the account config.
665
+ const newFeaturesHasUpload = newFeatures.hasOwnProperty(featureKeys.uploads); // Only set uploads if it was initialised by the account config.
752
666
 
753
667
  if (newFeaturesHasUpload) {
754
668
  const {
@@ -892,22 +806,6 @@ const seamlyStateReducer = (state, action) => {
892
806
  headerTitles: headerTitlesReducer(state.headerTitles, action)
893
807
  });
894
808
 
895
- case SET_INTERRUPT:
896
- case CLEAR_INTERRUPT:
897
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
898
- interrupt: interruptReducer(state.interrupt, action)
899
- });
900
-
901
- case SET_SHOW_DISCLAIMER:
902
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
903
- showDisclaimer: action.showDisclaimer
904
- });
905
-
906
- case UPDATE_CONFIG:
907
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
908
- config: seamly_utils_objectSpread(seamly_utils_objectSpread({}, state.config), action.config)
909
- });
910
-
911
809
  case SET_INITIAL_STATE:
912
810
  return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
913
811
  initialState: action.initialState
@@ -1123,27 +1021,6 @@ const seamlyStateReducer = (state, action) => {
1123
1021
  return state;
1124
1022
  }
1125
1023
  };
1126
- const getSeamlyConfig = config => {
1127
- const {
1128
- messages: messagesConfig,
1129
- typing
1130
- } = config,
1131
- rest = _objectWithoutProperties(config, _excluded);
1132
-
1133
- const {
1134
- messages: defaultMessagesConfig
1135
- } = defaultConfig,
1136
- defaultRest = _objectWithoutProperties(defaultConfig, _excluded2);
1137
-
1138
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, defaultRest), {}, {
1139
- namespace: 'default',
1140
- visible: config.layoutMode && config.layoutMode === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized,
1141
- layoutMode: defaultLayoutmode,
1142
- appContainerClassNames,
1143
- messages: seamly_utils_objectSpread(seamly_utils_objectSpread({}, defaultMessagesConfig), messagesConfig),
1144
- typing: seamly_utils_objectSpread(seamly_utils_objectSpread({}, defaultTyping), typing)
1145
- }, rest);
1146
- };
1147
1024
  const seamly_utils_calculateVisibility = ({
1148
1025
  hasResponded,
1149
1026
  previousVisibility,
@@ -1166,14 +1043,12 @@ const seamly_utils_calculateVisibility = ({
1166
1043
  const baseVisibility = layoutMode === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized;
1167
1044
  return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
1168
1045
  };
1169
- ;// CONCATENATED MODULE: ./src/javascripts/ui/store/state-reducer.js
1046
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/store/state-reducer.js
1047
+ // Legacy state reducer. Do not add new features here but extract/create new reducers as needed
1170
1048
 
1171
1049
 
1172
1050
  const initialState = {
1173
1051
  events: [],
1174
- config: {
1175
- hideOnNoUserResponse: false
1176
- },
1177
1052
  initialState: {},
1178
1053
  unreadEvents: 0,
1179
1054
  isLoading: false,
@@ -1194,15 +1069,11 @@ const initialState = {
1194
1069
  title: null,
1195
1070
  subTitle: ''
1196
1071
  },
1197
- interrupt: {
1198
- hasInterrupt: false,
1199
- meta: {}
1200
- },
1201
1072
  historyLoaded: false,
1202
1073
  skiplinkTargetId: id_randomId(),
1203
1074
  optionsButtonId: id_randomId(),
1204
1075
  cobrowsingContainerId: id_randomId(),
1205
- showDisclaimer: false,
1076
+ headerCollapseButtonId: id_randomId(),
1206
1077
  serviceData: {},
1207
1078
  options: {
1208
1079
  features: {},
@@ -1267,11 +1138,16 @@ function createActions(baseType, ...args) {
1267
1138
  const create = prefixType(baseType, createAction, SLICE_DELIMITER);
1268
1139
  return handlers.map(handler => create(...handler));
1269
1140
  }
1270
- function createDomain(domain) {
1271
- return {
1272
- createAction: prefixType(domain, createAction, DOMAIN_DELIMITER),
1273
- createActions: prefixType(domain, createActions, DOMAIN_DELIMITER)
1141
+ function createThunk(type, thunkCreator) {
1142
+ const fn = (...args) => {
1143
+ const thunk = thunkCreator(...args);
1144
+ thunk.type = type;
1145
+ return thunk;
1274
1146
  };
1147
+
1148
+ fn.toString = () => type;
1149
+
1150
+ return fn;
1275
1151
  }
1276
1152
  function createReducer(domain, handlers = {}, defaultState) {
1277
1153
  const reducer = (state, action) => {
@@ -1288,12 +1164,44 @@ function createReducer(domain, handlers = {}, defaultState) {
1288
1164
 
1289
1165
  return reducer;
1290
1166
  }
1291
- ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/actions.js
1167
+ function createDomain(domain) {
1168
+ return {
1169
+ createAction: prefixType(domain, createAction, DOMAIN_DELIMITER),
1170
+ createActions: prefixType(domain, createActions, DOMAIN_DELIMITER),
1171
+ createThunk: prefixType(domain, createThunk, DOMAIN_DELIMITER),
1172
+ createReducer: (handlers, defaultState) => createReducer(domain, handlers, defaultState),
1173
+ selectState: state => state[domain]
1174
+ };
1175
+ }
1176
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/utils.js
1292
1177
 
1293
1178
  const {
1294
- createActions: actions_createActions
1179
+ createActions: utils_createActions,
1180
+ createReducer: utils_createReducer,
1181
+ selectState
1295
1182
  } = createDomain('forms');
1296
- const [registerForm, deregisterForm] = actions_createActions('form', {
1183
+ function utils_validate(values, schema = {}) {
1184
+ return Object.entries(schema).reduce((errors, [key, validations]) => {
1185
+ if (validations && !Array.isArray(validations)) {
1186
+ // eslint-disable-next-line no-param-reassign
1187
+ validations = [validations];
1188
+ }
1189
+
1190
+ for (let i = 0; i < ((_validations = validations) === null || _validations === void 0 ? void 0 : _validations.length) ?? 0; i++) {
1191
+ var _validations;
1192
+
1193
+ if (!validations[i].fn(values[key], validations[i].compareValue)) {
1194
+ errors[key] = validations[i].errorText;
1195
+ break;
1196
+ }
1197
+ }
1198
+
1199
+ return errors;
1200
+ }, {});
1201
+ }
1202
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/actions.js
1203
+
1204
+ const [registerForm, deregisterForm] = utils_createActions('form', {
1297
1205
  register: (formId, persistData) => ({
1298
1206
  formId,
1299
1207
  persistData
@@ -1302,7 +1210,7 @@ const [registerForm, deregisterForm] = actions_createActions('form', {
1302
1210
  formId
1303
1211
  })
1304
1212
  });
1305
- const [registerControl, deregisterControl, updateControlValue, updateControlTouched] = actions_createActions('control', {
1213
+ const [registerControl, deregisterControl, updateControlValue, updateControlTouched] = utils_createActions('control', {
1306
1214
  register: (formId, name) => ({
1307
1215
  formId,
1308
1216
  name
@@ -1456,121 +1364,11 @@ const arrayContentEquals = (a, b) => {
1456
1364
  return a.every((value, idx) => b[idx] === value);
1457
1365
  };
1458
1366
  const getPropSelector = (propName, orDefault) => (_, props) => props[propName] || orDefault;
1459
- ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/reducer.js
1460
- function reducer_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; }
1461
-
1462
- function reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reducer_ownKeys(Object(source), true).forEach(function (key) { reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1463
-
1464
- function reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1465
-
1466
-
1467
-
1468
- const reducer_initialState = {};
1469
- const initialFormState = {
1470
- controls: {}
1471
- };
1472
- const initialControlState = {
1473
- value: '',
1474
- touched: false
1475
- };
1476
-
1477
- function updateFormControl(state, formId, name, controlState) {
1478
- var _state$formId;
1479
-
1480
- const currentControlState = ((_state$formId = state[formId]) === null || _state$formId === void 0 ? void 0 : _state$formId.controls[name]) || initialControlState;
1481
- return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
1482
- [formId]: reducer_objectSpread(reducer_objectSpread({}, state[formId]), {}, {
1483
- controls: reducer_objectSpread(reducer_objectSpread({}, state[formId].controls), {}, {
1484
- [name]: reducer_objectSpread(reducer_objectSpread({}, currentControlState), controlState)
1485
- })
1486
- })
1487
- });
1488
- }
1489
-
1490
- /* harmony default export */ const reducer = (createReducer('form', {
1491
- // Form handlers
1492
- [registerForm]: (state, {
1493
- formId,
1494
- persistData
1495
- }) => {
1496
- var _state$formId2;
1497
-
1498
- const formState = persistData ? (_state$formId2 = state[formId]) !== null && _state$formId2 !== void 0 ? _state$formId2 : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
1499
- persistData
1500
- }) : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
1501
- persistData
1502
- });
1503
- return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
1504
- [formId]: formState
1505
- });
1506
- },
1507
- [deregisterForm]: (state, {
1508
- formId
1509
- }) => {
1510
- var _newState$formId;
1511
-
1512
- const newState = reducer_objectSpread({}, state);
1513
-
1514
- if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
1515
- delete newState[formId];
1516
- }
1517
-
1518
- return newState;
1519
- },
1520
- // Form control handlers
1521
- [registerControl]: (state, {
1522
- name,
1523
- formId
1524
- }) => {
1525
- return updateFormControl(state, formId, name);
1526
- },
1527
- [deregisterControl]: (state, {
1528
- formId,
1529
- name
1530
- }) => {
1531
- const form = state[formId];
1532
-
1533
- if (!form) {
1534
- return state;
1535
- }
1536
-
1537
- if (form.persistData) {
1538
- return state;
1539
- }
1540
-
1541
- const controls = reducer_objectSpread({}, form.controls);
1542
-
1543
- delete controls[name];
1544
- return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
1545
- [formId]: reducer_objectSpread(reducer_objectSpread({}, form), {}, {
1546
- controls
1547
- })
1548
- });
1549
- },
1550
- [updateControlValue]: (state, {
1551
- formId,
1552
- name,
1553
- value
1554
- }) => {
1555
- return updateFormControl(state, formId, name, {
1556
- value
1557
- });
1558
- },
1559
- [updateControlTouched]: (state, {
1560
- formId,
1561
- name,
1562
- touched
1563
- }) => {
1564
- return updateFormControl(state, formId, name, {
1565
- touched
1566
- });
1567
- }
1568
- }, reducer_initialState));
1569
1367
  ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/selectors.js
1570
1368
 
1571
1369
 
1572
1370
 
1573
- const getState = state => state[String(reducer)];
1371
+ const getState = selectState;
1574
1372
  const selectors_getFormById = createSelector(getState, getPropSelector('formId'), (forms, formId) => forms[formId]);
1575
1373
  const getFormControlsByFormId = createSelector(selectors_getFormById, form => (form === null || form === void 0 ? void 0 : form.controls) || {});
1576
1374
  const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId, controls => {
@@ -1600,6 +1398,20 @@ const {
1600
1398
  Provider: context_Provider,
1601
1399
  Consumer
1602
1400
  } = context_StoreContext;
1401
+ ;// CONCATENATED MODULE: external "preact/jsx-runtime"
1402
+ const jsx_runtime_namespaceObject = require("preact/jsx-runtime");
1403
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/redux/provider.js
1404
+
1405
+
1406
+ function StoreProvider({
1407
+ store,
1408
+ children
1409
+ }) {
1410
+ return _jsx(Provider, {
1411
+ value: store,
1412
+ children: children
1413
+ });
1414
+ }
1603
1415
  ;// CONCATENATED MODULE: ./src/javascripts/domains/redux/hooks.js
1604
1416
 
1605
1417
  // import { arrayContentEquals } from './utils'
@@ -1618,6 +1430,7 @@ function hooks_useSelector(selector, deps = []) {
1618
1430
  const valueRef = useRef(); // instead of accepting a stabilized selector, we stick to the signature
1619
1431
  // of useCallback, as that makes the exposed api much more dev-friendly
1620
1432
  // otherwise you'd have to stabilize selectors externally
1433
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1621
1434
 
1622
1435
  const selectorCb = useCallback(selector, deps); // we're keeping the selector in a ref to compare against
1623
1436
  // we need this both in the store subscription and for
@@ -1674,6 +1487,7 @@ const hooks_useSelectorWithProps = function useSelectorWithProps(selector, props
1674
1487
 
1675
1488
 
1676
1489
 
1490
+
1677
1491
  ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/context.js
1678
1492
 
1679
1493
  const context_FormContext = (0,external_preact_namespaceObject.createContext)({});
@@ -1761,10 +1575,8 @@ function hooks_useFormControl(name) {
1761
1575
  }), [isValid, error, touched]);
1762
1576
  return [field, meta];
1763
1577
  }
1764
- ;// CONCATENATED MODULE: external "preact/jsx-runtime"
1765
- const jsx_runtime_namespaceObject = require("preact/jsx-runtime");
1766
1578
  ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/provider.js
1767
- const provider_excluded = (/* unused pure expression or super */ null && (["children", "formId", "persistData", "onSubmit", "validationSchema"]));
1579
+ const _excluded = (/* unused pure expression or super */ null && (["children", "formId", "persistData", "onSubmit", "validationSchema"]));
1768
1580
 
1769
1581
  function provider_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; }
1770
1582
 
@@ -1772,9 +1584,9 @@ function provider_objectSpread(target) { for (var i = 1; i < arguments.length; i
1772
1584
 
1773
1585
  function provider_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1774
1586
 
1775
- function provider_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = provider_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1587
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1776
1588
 
1777
- function provider_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1589
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1778
1590
 
1779
1591
 
1780
1592
 
@@ -1791,7 +1603,7 @@ function provider_FormProvider(_ref) {
1791
1603
  onSubmit,
1792
1604
  validationSchema
1793
1605
  } = _ref,
1794
- props = provider_objectWithoutProperties(_ref, provider_excluded);
1606
+ props = _objectWithoutProperties(_ref, _excluded);
1795
1607
 
1796
1608
  const dispatch = useStoreDispatch();
1797
1609
  const values = useSelectorWithProps(getFormValuesByFormId, {
@@ -1868,119 +1680,149 @@ function provider_FormProvider(_ref) {
1868
1680
  children: children
1869
1681
  }));
1870
1682
  }
1871
- ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/index.js
1872
-
1873
-
1874
-
1683
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/reducer.js
1684
+ function reducer_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; }
1875
1685
 
1686
+ function reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reducer_ownKeys(Object(source), true).forEach(function (key) { reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1876
1687
 
1688
+ function reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1877
1689
 
1878
- ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
1879
1690
 
1880
- const {
1881
- createActions: translations_actions_createActions
1882
- } = createDomain('translations');
1883
- const [enable, disable] = translations_actions_createActions('translate', {
1884
- enable: locale => ({
1885
- locale
1886
- }),
1887
- disable: () => ({})
1888
- });
1889
- const [enableEvent, disableEvent] = translations_actions_createActions('event', {
1890
- enable: payloadId => ({
1891
- payloadId
1892
- }),
1893
- disable: payloadId => ({
1894
- payloadId
1895
- })
1896
- });
1897
- ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/reducer.js
1898
- function translations_reducer_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; }
1899
1691
 
1900
- function translations_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { translations_reducer_ownKeys(Object(source), true).forEach(function (key) { translations_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { translations_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1692
+ const reducer_initialState = {};
1693
+ const initialFormState = {
1694
+ controls: {}
1695
+ };
1696
+ const initialControlState = {
1697
+ value: '',
1698
+ touched: false
1699
+ };
1901
1700
 
1902
- function translations_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1701
+ function updateFormControl(state, formId, name, controlState) {
1702
+ var _state$formId;
1903
1703
 
1704
+ const currentControlState = ((_state$formId = state[formId]) === null || _state$formId === void 0 ? void 0 : _state$formId.controls[name]) || initialControlState;
1705
+ return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
1706
+ [formId]: reducer_objectSpread(reducer_objectSpread({}, state[formId]), {}, {
1707
+ controls: reducer_objectSpread(reducer_objectSpread({}, state[formId].controls), {}, {
1708
+ [name]: reducer_objectSpread(reducer_objectSpread({}, currentControlState), controlState)
1709
+ })
1710
+ })
1711
+ });
1712
+ }
1904
1713
 
1714
+ /* harmony default export */ const reducer = (utils_createReducer({
1715
+ // Form handlers
1716
+ [registerForm]: (state, {
1717
+ formId,
1718
+ persistData
1719
+ }) => {
1720
+ const formState = persistData ? state[formId] ?? reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
1721
+ persistData
1722
+ }) : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
1723
+ persistData
1724
+ });
1725
+ return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
1726
+ [formId]: formState
1727
+ });
1728
+ },
1729
+ [deregisterForm]: (state, {
1730
+ formId
1731
+ }) => {
1732
+ var _newState$formId;
1905
1733
 
1734
+ const newState = reducer_objectSpread({}, state);
1906
1735
 
1736
+ if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
1737
+ delete newState[formId];
1738
+ }
1907
1739
 
1908
- const translations_reducer_initialState = {
1909
- isActive: false,
1910
- currentLocale: undefined,
1911
- isAvailable: false,
1912
- languages: [],
1913
- originalPayloadIds: [],
1914
- containerId: id_randomId()
1915
- };
1916
- /* harmony default export */ const translations_reducer = (createReducer('translations', {
1917
- [seamlyActions.SET_FEATURES]: (state, action) => {
1918
- var _action$features;
1740
+ return newState;
1741
+ },
1742
+ // Form control handlers
1743
+ [registerControl]: (state, {
1744
+ name,
1745
+ formId
1746
+ }) => {
1747
+ return updateFormControl(state, formId, name);
1748
+ },
1749
+ [deregisterControl]: (state, {
1750
+ formId,
1751
+ name
1752
+ }) => {
1753
+ const form = state[formId];
1919
1754
 
1920
- const feature = action === null || action === void 0 ? void 0 : (_action$features = action.features) === null || _action$features === void 0 ? void 0 : _action$features.translation;
1755
+ if (!form) {
1756
+ return state;
1757
+ }
1921
1758
 
1922
- if (!feature) {
1759
+ if (form.persistData) {
1923
1760
  return state;
1924
1761
  }
1925
1762
 
1926
- return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
1927
- isAvailable: feature.enabled === true,
1928
- languages: feature.languages || []
1929
- });
1930
- },
1931
- [seamlyActions.SET_HISTORY]: (state, {
1932
- history
1933
- }) => {
1934
- var _history$translation, _history$translation2;
1763
+ const controls = reducer_objectSpread({}, form.controls);
1935
1764
 
1936
- return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
1937
- isActive: history === null || history === void 0 ? void 0 : (_history$translation = history.translation) === null || _history$translation === void 0 ? void 0 : _history$translation.enabled,
1938
- currentLocale: history === null || history === void 0 ? void 0 : (_history$translation2 = history.translation) === null || _history$translation2 === void 0 ? void 0 : _history$translation2.locale
1939
- });
1940
- },
1941
- [seamlyActions.CLEAR_FEATURES]: () => translations_reducer_initialState,
1942
- [enable]: (state, {
1943
- locale
1944
- }) => {
1945
- return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
1946
- isActive: true,
1947
- currentLocale: locale
1948
- });
1949
- },
1950
- [disable]: state => {
1951
- return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
1952
- isActive: false,
1953
- currentLocale: undefined
1765
+ delete controls[name];
1766
+ return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
1767
+ [formId]: reducer_objectSpread(reducer_objectSpread({}, form), {}, {
1768
+ controls
1769
+ })
1954
1770
  });
1955
1771
  },
1956
- [enableEvent]: (state, {
1957
- payloadId
1772
+ [updateControlValue]: (state, {
1773
+ formId,
1774
+ name,
1775
+ value
1958
1776
  }) => {
1959
- if (!state.originalPayloadIds.includes(payloadId)) {
1960
- return state;
1961
- }
1962
-
1963
- return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
1964
- originalPayloadIds: state.originalPayloadIds.filter(id => id !== payloadId)
1777
+ return updateFormControl(state, formId, name, {
1778
+ value
1965
1779
  });
1966
1780
  },
1967
- [disableEvent]: (state, {
1968
- payloadId
1781
+ [updateControlTouched]: (state, {
1782
+ formId,
1783
+ name,
1784
+ touched
1969
1785
  }) => {
1970
- if (state.originalPayloadIds.includes(payloadId)) {
1971
- return state;
1972
- }
1973
-
1974
- return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
1975
- originalPayloadIds: [...state.originalPayloadIds, payloadId]
1786
+ return updateFormControl(state, formId, name, {
1787
+ touched
1976
1788
  });
1977
1789
  }
1978
- }, translations_reducer_initialState));
1790
+ }, reducer_initialState));
1791
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/forms/index.js
1792
+
1793
+
1794
+
1795
+
1796
+
1797
+
1798
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
1799
+
1800
+ const {
1801
+ createActions: translations_utils_createActions,
1802
+ createReducer: translations_utils_createReducer,
1803
+ selectState: utils_selectState
1804
+ } = createDomain('translations');
1805
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
1806
+
1807
+ const [enable, disable] = translations_utils_createActions('translate', {
1808
+ enable: locale => ({
1809
+ locale
1810
+ }),
1811
+ disable: () => ({})
1812
+ });
1813
+ const [enableEvent, disableEvent] = translations_utils_createActions('event', {
1814
+ enable: payloadId => ({
1815
+ payloadId
1816
+ }),
1817
+ disable: payloadId => ({
1818
+ payloadId
1819
+ })
1820
+ });
1979
1821
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/selectors.js
1980
1822
 
1981
1823
 
1982
1824
 
1983
- const selectors_getState = state => state[String(translations_reducer)];
1825
+ const selectors_getState = utils_selectState;
1984
1826
  const getOriginalPayloadIds = createSelector(selectors_getState, state => state.originalPayloadIds);
1985
1827
  const getIsPayloadTranslated = createSelector(getOriginalPayloadIds, getPropSelector('payloadId'), (payloadIds, payloadId) => !payloadIds.includes(payloadId));
1986
1828
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-api-context.js
@@ -2010,12 +1852,186 @@ const seamly_api_hooks_useSeamlyHasConversation = () => {
2010
1852
  const url = useSeamlyConversationUrl();
2011
1853
  return !!url;
2012
1854
  };
2013
- const seamly_api_hooks_useSeamlyHasUserResponded = () => {
2014
- const {
2015
- get
2016
- } = seamly_api_hooks_useSeamlyObjectStore();
2017
- return get ? !!get('userResponded') : false;
1855
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/utils.js
1856
+
1857
+ const {
1858
+ createAction: utils_createAction,
1859
+ createThunk: utils_createThunk,
1860
+ createReducer: config_utils_createReducer,
1861
+ selectState: config_utils_selectState
1862
+ } = createDomain('config');
1863
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
1864
+
1865
+ const initialize = utils_createAction('initialize', config => ({
1866
+ config
1867
+ }));
1868
+ const update = utils_createAction('update', config => ({
1869
+ config
1870
+ }));
1871
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/selectors.js
1872
+ function selectors_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; }
1873
+
1874
+ function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { selectors_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1875
+
1876
+ function selectors_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1877
+
1878
+
1879
+
1880
+
1881
+ const selectConfig = createSelector(config_utils_selectState, config => {
1882
+ let newConfig = selectors_objectSpread({
1883
+ visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized,
1884
+ appContainerClassNames: config.appContainerClassNames || []
1885
+ }, config);
1886
+
1887
+ if (typeof newConfig.appContainerClassNames === 'function') {
1888
+ newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
1889
+ appContainerClassNames: newConfig.appContainerClassNames(newConfig)
1890
+ });
1891
+ }
1892
+
1893
+ return newConfig;
1894
+ });
1895
+
1896
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
1897
+
1898
+
1899
+ function hooks_useConfig() {
1900
+ return useSelector(Selectors.selectConfig);
1901
+ }
1902
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
1903
+
1904
+
1905
+ function createMiddleware() {
1906
+ return ({
1907
+ dispatch
1908
+ }) => next => action => {
1909
+ var _action$config, _action$config$defaul;
1910
+
1911
+ const result = next(action);
1912
+
1913
+ switch (action.type) {
1914
+ case String(Actions.initialize):
1915
+ case String(Actions.update):
1916
+ 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) {
1917
+ var _action$config2, _action$config2$defau;
1918
+
1919
+ dispatch({
1920
+ type: seamlyActions.SET_HEADER_SUB_TITLE,
1921
+ 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
1922
+ });
1923
+ }
1924
+
1925
+ }
1926
+
1927
+ return result;
1928
+ };
1929
+ }
1930
+ ;// CONCATENATED MODULE: ./src/javascripts/config.js
1931
+ const CSS_NAME = 'cvco';
1932
+ const apiVersion = '2';
1933
+ const config_userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
1934
+ // broadcasting to the screen reader. This is done to avoid verbosity.
1935
+
1936
+ const unreadScreenReaderWait = 2000;
1937
+ const newMessageScreenReaderWait = 1000;
1938
+ const config_screenReaderDebounceDelaySeconds = 10;
1939
+ const activitySendDelay = 15000;
1940
+ const maxCharacterWarningLimit = 50;
1941
+ const maxCharacterSrDebounceDelay = 300;
1942
+ const config_defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
1943
+
1944
+ const config_typingTimeout = 2000;
1945
+ const defaultConfig = {
1946
+ namespace: 'default',
1947
+ layoutMode: 'window',
1948
+ // "window", "inline" ("sidebar"), "modal"
1949
+ messages: {
1950
+ agent: {
1951
+ showAvatar: false,
1952
+ // true, "inline"
1953
+ showName: false
1954
+ },
1955
+ user: {
1956
+ showAvatar: false,
1957
+ // true, "inline"
1958
+ showName: false
1959
+ },
1960
+ timeIndicator: {
1961
+ enabled: false,
1962
+ threshold: 3600000 // Default threshold is an hour in milliseconds
1963
+
1964
+ }
1965
+ },
1966
+ appContainerClassNames: config => [`app--layout-${config.layoutMode}`, `namespace--${config.namespace}`]
1967
+ };
1968
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/reducer.js
1969
+ const reducer_excluded = ["messages"];
1970
+
1971
+ function reducer_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = reducer_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1972
+
1973
+ function reducer_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1974
+
1975
+ function config_reducer_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; }
1976
+
1977
+ function config_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { config_reducer_ownKeys(Object(source), true).forEach(function (key) { config_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { config_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1978
+
1979
+ function config_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1980
+
1981
+
1982
+
1983
+
1984
+
1985
+
1986
+ const config_reducer_initialState = config_reducer_objectSpread(config_reducer_objectSpread({}, defaultConfig), {}, {
1987
+ hideOnNoUserResponse: false,
1988
+ showDisclaimer: false,
1989
+ showFaq: false,
1990
+ customComponents: {},
1991
+ defaults: {}
1992
+ });
1993
+
1994
+ const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback'];
1995
+
1996
+ const updateState = (state, {
1997
+ config
1998
+ }) => {
1999
+ const _pick = pick(config, configKeys),
2000
+ {
2001
+ messages
2002
+ } = _pick,
2003
+ partialConfig = reducer_objectWithoutProperties(_pick, reducer_excluded);
2004
+
2005
+ let newState = state;
2006
+
2007
+ if (Object.keys(partialConfig).length > 0) {
2008
+ newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), partialConfig);
2009
+ }
2010
+
2011
+ if (messages) {
2012
+ newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), {}, {
2013
+ messages: config_reducer_objectSpread(config_reducer_objectSpread({}, newState.messages), messages)
2014
+ });
2015
+ }
2016
+
2017
+ return newState;
2018
2018
  };
2019
+
2020
+ /* harmony default export */ const config_reducer = (config_utils_createReducer({
2021
+ [initialize]: (state, action) => {
2022
+ return updateState(state, action);
2023
+ },
2024
+ [update]: (state, action) => {
2025
+ return updateState(state, action);
2026
+ }
2027
+ }, config_reducer_initialState));
2028
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
2029
+
2030
+
2031
+
2032
+
2033
+
2034
+
2019
2035
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
2020
2036
  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; }
2021
2037
 
@@ -2026,21 +2042,18 @@ function seamly_state_hooks_defineProperty(obj, key, value) { if (key in obj) {
2026
2042
 
2027
2043
 
2028
2044
 
2029
- const selectState = state => state.state;
2030
- const seamly_state_hooks_useSeamlyStateContext = () => useSelector(selectState);
2031
- const selectConfig = createSelector(selectState, ({
2032
- config
2033
- }) => config || {});
2034
- const seamly_state_hooks_useSeamlyConfig = () => useSelector(selectConfig);
2035
- const selectEvents = createSelector(selectState, selectConfig, ({
2045
+
2046
+ const seamly_state_hooks_selectState = state => state.state;
2047
+ const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
2048
+ const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
2036
2049
  events
2037
2050
  }, config) => {
2038
- var _config$messages$time, _config$messages;
2051
+ var _config$messages;
2039
2052
 
2040
2053
  const {
2041
2054
  enabled,
2042
2055
  threshold
2043
- } = (_config$messages$time = config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) !== null && _config$messages$time !== void 0 ? _config$messages$time : {};
2056
+ } = (config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) ?? {};
2044
2057
 
2045
2058
  if (!enabled) {
2046
2059
  return events;
@@ -2080,7 +2093,6 @@ const selectLastMessageEventId = createSelector(selectEvents, events => {
2080
2093
  });
2081
2094
  const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
2082
2095
  const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
2083
- const useSeamlyDisclaimerState = () => seamly_state_hooks_useSeamlyStateContext().showDisclaimer;
2084
2096
  const useSeamlyCurrentAgent = () => {
2085
2097
  const {
2086
2098
  participants,
@@ -2108,7 +2120,7 @@ const useEntryTextLimit = () => {
2108
2120
  const useSeamlyLayoutMode = () => {
2109
2121
  const {
2110
2122
  layoutMode
2111
- } = seamly_state_hooks_useSeamlyConfig();
2123
+ } = useConfig();
2112
2124
  return {
2113
2125
  isInline: layoutMode === 'inline',
2114
2126
  isModal: layoutMode === 'modal',
@@ -2127,7 +2139,7 @@ const useSeamlyLayoutMode = () => {
2127
2139
 
2128
2140
  const {
2129
2141
  SET_SEAMLY_CONTAINER_ELEMENT: focus_helper_hooks_SET_SEAMLY_CONTAINER_ELEMENT
2130
- } = seamlyActions;
2142
+ } = seamly_utils_seamlyActions;
2131
2143
 
2132
2144
  const focusWithRaf = el => {
2133
2145
  requestAnimationFrame(() => {
@@ -2173,23 +2185,9 @@ const useFocusIfSeamlyContainedFocus = () => {
2173
2185
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
2174
2186
 
2175
2187
 
2176
- const useSeamlyAppContainerClassNames = () => {
2177
- const config = useSeamlyConfig();
2178
- const {
2179
- appContainerClassNames
2180
- } = config;
2181
-
2182
- if (!appContainerClassNames) {
2183
- return [];
2184
- }
2185
-
2186
- switch (typeof config.appContainerClassNames) {
2187
- case 'function':
2188
- return config.appContainerClassNames(config);
2189
2188
 
2190
- default:
2191
- return config.appContainerClassNames;
2192
- }
2189
+ const useSeamlyAppContainerClassNames = () => {
2190
+ return useConfig().appContainerClassNames;
2193
2191
  };
2194
2192
  const useSeamlyMessageContainerClassNames = event => {
2195
2193
  const {
@@ -2217,308 +2215,858 @@ const useCobrowsingContainer = () => {
2217
2215
  focusContainer
2218
2216
  };
2219
2217
  };
2220
- ;// CONCATENATED MODULE: ./translations/en.js
2221
- // Please note: All texts containing the string 'srText' are short for
2222
- // Screen Reader Text. These texts are invisible on screen but broadcast
2223
- // to screen readers. Avoid undue verbosity, but ensure that a user who cannot
2224
- // see the screen will get both the message content as well as the context
2225
- // in which the message occurred if not already clear from the current
2226
- // position of the keyboard focus.
2227
- // Example: An error occurs in the chat window and this error has an 'srText'
2228
- // entry. Because the error could occur while the user is NOT chatting in the window,
2229
- // add context such as "Something went wrong with the chat session" as just saying
2230
- // "Something went wrong" would not be clear enough for users who cannot see the
2231
- // source of the error on screen.
2232
- /* harmony default export */ const en = ({
2233
- 'carousel.controls.next': 'Next',
2234
- 'carousel.controls.previous': 'Previous',
2235
- 'carousel.slide.label': ({
2236
- index,
2237
- total
2238
- }) => `${index} of ${total}`,
2239
- 'dateTime.srText': ({
2240
- date,
2241
- time
2242
- }) => `Messages starting ${date} at ${time}:`,
2243
- 'dateTime.today': 'Today',
2244
- 'dateTime.yesterday': 'Yesterday',
2245
- 'disclaimer.content': 'This chat session will be saved to help us improve our service delivery.',
2246
- 'disclaimer.title': 'Privacy disclaimer',
2247
- 'dividerKeys.newTopic': 'New topic started.',
2248
- 'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
2249
- 'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
2250
- 'errors.configError.title': 'Chat configuration error.',
2251
- 'errors.general.buttonText': 'Restart chat',
2252
- 'errors.general.message': 'Do you want to start a new chat session?',
2253
- 'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
2254
- 'errors.general.title': 'Something went wrong',
2255
- 'errors.seamlyOffline.message': 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
2256
- 'errors.seamlyOffline.srText': 'The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.',
2257
- 'errors.seamlyOffline.title': 'Connection issues',
2258
- 'faq.headingText': 'Suggested topics',
2259
- 'faq.srAvailableText': 'Suggested topics are available in the chat.',
2260
- 'faq.srUnavailableText': 'Suggested topics are no longer available in the chat.',
2261
- 'faq.srUpdatedText': 'There are new suggested topics in the chat.',
2262
- 'fileUpload.cancelButtonText': 'Cancel upload',
2263
- 'fileUpload.contentHint': size => `Select a file of maximum ${size}`,
2264
- 'fileUpload.errors.general': 'Something went wrong with the upload. Please cancel the upload and try again.',
2265
- 'fileUpload.errors.noFile': 'Please select a file to upload',
2266
- 'fileUpload.errors.tooLarge': 'The selected file is too large, please upload a smaller file',
2267
- 'fileUpload.errors.unavailable': 'Uploading files is no longer possible. Please cancel the upload and try again later.',
2268
- 'fileUpload.errors.virusFound': 'The selected file is unsafe, please upload a different file.',
2269
- 'fileUpload.errors.wrongType': 'The selected file type is not supported. Please cancel the upload and upload a different file.',
2270
- 'fileUpload.fileUnavailableText': 'This download link has expired',
2271
- 'fileUpload.labelText': 'Select file',
2272
- 'fileUpload.selectedText': fileName => {
2273
- if (fileName) {
2274
- return fileName;
2275
- } else {
2276
- return 'No file selected';
2277
- }
2278
- },
2279
- 'fileUpload.srAvailableText': 'File uploads are now available in the chat.',
2280
- 'fileUpload.srCompleteText': 'Upload complete.',
2281
- 'fileUpload.srFileDownloadText': fileName => `Download file ${fileName}.`,
2282
- 'fileUpload.srFileUnavailableText': fileName => `Download for ${fileName} has expired.`,
2283
- 'fileUpload.srFileUploadedText': fileName => `Uploaded file ${fileName}.`,
2284
- 'fileUpload.srProgressLabel': fileName => `${fileName} upload progress status`,
2285
- 'fileUpload.srStartedText': 'Upload started.',
2286
- 'fileUpload.srUnavailableText': 'File uploads in the chat are no longer available.',
2287
- 'fileUpload.toggleButtonText': 'Upload files',
2288
- 'fileUpload.uploadButtonText': 'Upload file',
2289
- 'header.collapseApp': 'collapse chat',
2290
- 'header.title': 'You\'re talking to',
2291
- 'idleDetachWarning.continueButton': 'Continue conversation',
2292
- 'idleDetachWarning.countdownText': 'Your conversation will automatically end in:',
2293
- 'idleDetachWarning.countdownTimer': ({
2294
- minutes,
2295
- seconds
2296
- }) => {
2297
- switch (minutes) {
2298
- case 1:
2299
- switch (seconds) {
2300
- case 1:
2301
- return '1 minute, 1 second';
2218
+ ;// CONCATENATED MODULE: ./src/javascripts/lib/mutex.js
2219
+ function createMutex() {
2220
+ let isRunning = false;
2221
+ const tasks = [];
2302
2222
 
2303
- case 0:
2304
- return '1 minute';
2305
-
2306
- default:
2307
- return `1 minute, ${seconds} seconds`;
2308
- }
2223
+ const next = async () => {
2224
+ if (!isRunning) {
2225
+ while (tasks.length) {
2226
+ const task = tasks.shift();
2227
+ isRunning = true; // eslint-disable-next-line no-await-in-loop
2309
2228
 
2310
- case 0:
2311
- switch (seconds) {
2312
- case 1:
2313
- return '1 second';
2229
+ await task().catch(() => {});
2230
+ isRunning = false;
2231
+ }
2232
+ }
2233
+ };
2314
2234
 
2315
- case 0:
2316
- default:
2317
- return `${seconds} seconds`;
2235
+ const runExclusively = async task => {
2236
+ const prms = new Promise((resolve, reject) => {
2237
+ tasks.push(async () => {
2238
+ try {
2239
+ resolve(await task());
2240
+ } catch (e) {
2241
+ reject(e);
2318
2242
  }
2243
+ });
2244
+ });
2245
+ next();
2246
+ return prms;
2247
+ };
2319
2248
 
2320
- default:
2321
- switch (seconds) {
2322
- case 1:
2323
- return `${minutes} minutes, 1 second`;
2249
+ return {
2250
+ next,
2251
+ runExclusively
2252
+ };
2253
+ }
2254
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/utils.js
2324
2255
 
2325
- case 0:
2326
- return `${minutes} minutes`;
2256
+ const {
2257
+ createAction: i18n_utils_createAction,
2258
+ createActions: i18n_utils_createActions,
2259
+ createThunk: i18n_utils_createThunk,
2260
+ createReducer: i18n_utils_createReducer,
2261
+ selectState: i18n_utils_selectState
2262
+ } = createDomain('i18n');
2263
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.js
2264
+
2265
+
2266
+ const selectTranslations = createSelector(i18n_utils_selectState, state => state.translations);
2267
+ const selectInitialLocale = createSelector(i18n_utils_selectState, state => state.initialLocale);
2268
+ const selectLocale = createSelector(i18n_utils_selectState, state => state.locale);
2269
+
2270
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/actions.js
2327
2271
 
2328
- default:
2329
- return `${minutes} minutes, ${seconds} seconds`;
2330
- }
2331
2272
 
2273
+
2274
+ const setInitialLocale = i18n_utils_createAction('setInitialLocale', locale => ({
2275
+ locale
2276
+ }));
2277
+ const [setLocaleStart, setLocaleResolve, setLocaleReject] = i18n_utils_createActions('setLocale', {
2278
+ start: locale => ({
2279
+ locale
2280
+ }),
2281
+ resolve: (locale, translations) => ({
2282
+ locale,
2283
+ translations
2284
+ }),
2285
+ reject: (locale, error) => ({
2286
+ locale,
2287
+ error
2288
+ })
2289
+ });
2290
+ const mutex = createMutex();
2291
+ const setLocale = i18n_utils_createThunk('setLocale', locale => async (dispatch, getState, {
2292
+ api
2293
+ }) => {
2294
+ await mutex.runExclusively(async () => {
2295
+ const currentLocale = selectLocale(getState());
2296
+
2297
+ if (currentLocale === locale) {
2298
+ return;
2332
2299
  }
2333
- },
2334
- 'idleDetachWarning.countdownTitle': 'Are you still there?',
2335
- 'idleDetachWarning.detachButton': 'End conversation',
2336
- 'idleDetachWarning.notifyTransferText': 'Your conversation is being ended.',
2337
- 'idleDetachWarning.srCountDownStoppedText': 'Automatic conversation ending prevented. Welcome back.',
2338
- 'info.cobrowsing.cobrowsingEnded': 'Screen sharing has ended',
2339
- 'info.cobrowsing.cobrowsingStarted': 'Screen sharing is now enabled. The agent can see the page you\'re currently on',
2340
- 'info.sendTranscript.accepted': ({
2341
- emailAddress
2342
- }) => `A transcript will be sent to ${emailAddress}`,
2343
- 'input.inputLabel': limit => {
2344
- if (limit) {
2345
- return `Your message (max. ${limit} characters)`;
2300
+
2301
+ dispatch(setLocaleStart(locale));
2302
+
2303
+ try {
2304
+ const translations = await api.getTranslations(locale);
2305
+ dispatch(setLocaleResolve(locale, translations));
2306
+ } catch (error) {
2307
+ dispatch(setLocaleReject(locale, error));
2346
2308
  }
2309
+ });
2310
+ });
2311
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
2312
+ function _arrayWithHoles(arr) {
2313
+ if (Array.isArray(arr)) return arr;
2314
+ }
2315
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
2316
+ function _iterableToArrayLimit(arr, i) {
2317
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2347
2318
 
2348
- return 'Your message';
2349
- },
2350
- 'input.inputPlaceholder': limit => {
2351
- if (limit) {
2352
- return `Your message (max. ${limit} characters)`;
2319
+ if (_i == null) return;
2320
+ var _arr = [];
2321
+ var _n = true;
2322
+ var _d = false;
2323
+
2324
+ var _s, _e;
2325
+
2326
+ try {
2327
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
2328
+ _arr.push(_s.value);
2329
+
2330
+ if (i && _arr.length === i) break;
2353
2331
  }
2332
+ } catch (err) {
2333
+ _d = true;
2334
+ _e = err;
2335
+ } finally {
2336
+ try {
2337
+ if (!_n && _i["return"] != null) _i["return"]();
2338
+ } finally {
2339
+ if (_d) throw _e;
2340
+ }
2341
+ }
2354
2342
 
2355
- return 'Your message';
2356
- },
2357
- 'input.sendMessage': 'Send',
2358
- 'input.srCharacterLimitText': limit => {
2359
- switch (limit) {
2360
- case 1:
2361
- return '1 character remaining.';
2362
-
2363
- case 0:
2364
- default:
2365
- return `${limit} characters remaining.`;
2343
+ return _arr;
2344
+ }
2345
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
2346
+ function _arrayLikeToArray(arr, len) {
2347
+ if (len == null || len > arr.length) len = arr.length;
2348
+
2349
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
2350
+ arr2[i] = arr[i];
2351
+ }
2352
+
2353
+ return arr2;
2354
+ }
2355
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
2356
+
2357
+ function _unsupportedIterableToArray(o, minLen) {
2358
+ if (!o) return;
2359
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
2360
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2361
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2362
+ if (n === "Map" || n === "Set") return Array.from(o);
2363
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
2364
+ }
2365
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
2366
+ function _nonIterableRest() {
2367
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2368
+ }
2369
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
2370
+
2371
+
2372
+
2373
+
2374
+ function _slicedToArray(arr, i) {
2375
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
2376
+ }
2377
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/classCallCheck.js
2378
+ function _classCallCheck(instance, Constructor) {
2379
+ if (!(instance instanceof Constructor)) {
2380
+ throw new TypeError("Cannot call a class as a function");
2381
+ }
2382
+ }
2383
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/createClass.js
2384
+ function _defineProperties(target, props) {
2385
+ for (var i = 0; i < props.length; i++) {
2386
+ var descriptor = props[i];
2387
+ descriptor.enumerable = descriptor.enumerable || false;
2388
+ descriptor.configurable = true;
2389
+ if ("value" in descriptor) descriptor.writable = true;
2390
+ Object.defineProperty(target, descriptor.key, descriptor);
2391
+ }
2392
+ }
2393
+
2394
+ function _createClass(Constructor, protoProps, staticProps) {
2395
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2396
+ if (staticProps) _defineProperties(Constructor, staticProps);
2397
+ return Constructor;
2398
+ }
2399
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/defineProperty.js
2400
+ function defineProperty_defineProperty(obj, key, value) {
2401
+ if (key in obj) {
2402
+ Object.defineProperty(obj, key, {
2403
+ value: value,
2404
+ enumerable: true,
2405
+ configurable: true,
2406
+ writable: true
2407
+ });
2408
+ } else {
2409
+ obj[key] = value;
2410
+ }
2411
+
2412
+ return obj;
2413
+ }
2414
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/array-utils/array-utils.es.js
2415
+ /*
2416
+ * Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)
2417
+ *
2418
+ * Licensed under the Apache License, Version 2.0 (the "License");
2419
+ * you may not use this file except in compliance with the License.
2420
+ * You may obtain a copy of the License at
2421
+ *
2422
+ * http://www.apache.org/licenses/LICENSE-2.0
2423
+ *
2424
+ * Unless required by applicable law or agreed to in writing, software
2425
+ * distributed under the License is distributed on an "AS IS" BASIS,
2426
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2427
+ * See the License for the specific language governing permissions and
2428
+ * limitations under the License.
2429
+ */
2430
+
2431
+ /**
2432
+ * Flattens an array of arrays of infinite depth into a single-dimension array.
2433
+ *
2434
+ * > This is now natively in JavaScript as the `flat` method on an Array
2435
+ * > instance. [Check MDN for which browsers have access to this feature](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat).
2436
+ * > If you can't use `flat`, then this method will do the job 🙂
2437
+ *
2438
+ * @param {Array} array
2439
+ * @return {Array} Flattened array.
2440
+ */
2441
+ function flatten(array) {
2442
+ return array.reduce(function (accumulator, value) {
2443
+ return accumulator.concat(Array.isArray(value) ? flatten(value) : value);
2444
+ }, []);
2445
+ }
2446
+ /**
2447
+ * Creates an array of numbers from the starting value (inclusive) to the end
2448
+ * (exclusive), with an optional step (the gap between values).
2449
+ *
2450
+ * @param {Number} start
2451
+ * The value to start at, the first item in the returned array.
2452
+ * @param {Number} end
2453
+ * The value to end with, the last item in the returned array.
2454
+ * @param {Number} [step=1]
2455
+ * The increment/gap between values, defaults to 1.
2456
+ * @return {Array} An array encompassing the given range.
2457
+ */
2458
+
2459
+ function range(start, end) {
2460
+ var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
2461
+ return Array.apply(0, Array(Math.ceil((end - start) / step))).map(function (empty, index) {
2462
+ return index * step + start;
2463
+ });
2464
+ }
2465
+ /**
2466
+ * Remove and return the first item from `array` that matches the predicate
2467
+ * function.
2468
+ *
2469
+ * @param {Array} array
2470
+ * @param {Function} predicate
2471
+ * Invoked with the array item.
2472
+ * @return {Object} The matching item, or `null` if no match was found.
2473
+ */
2474
+
2475
+ function remove(array, predicate) {
2476
+ return array.find(function (item, index) {
2477
+ if (predicate(item)) {
2478
+ array.splice(index, 1);
2479
+ return item;
2366
2480
  }
2367
- },
2368
- 'lightbox.closeLabel': 'Close',
2369
- 'lightbox.heading': 'Enlarged chat image',
2370
- 'message.choicePrompts.cancelChooseAgain': 'Cancel choice change',
2371
- 'message.choicePrompts.chooseAgain': 'Change your choice',
2372
- 'message.image.srTextEnlargeButtonLabel': ({
2373
- description
2374
- }) => `Enlarge ${description}`,
2375
- 'message.srNewEventCount': ({
2376
- newCount
2377
- }) => {
2378
- switch (newCount) {
2379
- case 1:
2380
- return `There is 1 new chat message.`;
2481
+ });
2482
+ }
2381
2483
 
2382
- case 0:
2383
- default:
2384
- return `There are ${newCount} new chat messages.`;
2484
+ //# sourceMappingURL=array-utils.es.js.map
2485
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/function-utils/function-utils.es.js
2486
+ /**
2487
+ * A higher-order function to apply [memoization](https://en.wikipedia.org/wiki/Memoization).
2488
+ *
2489
+ * If memoizing a recursive function, then memoize and define the function at
2490
+ * the same time so you can make a call to the memoized function, eg:
2491
+ *
2492
+ * ```javascript
2493
+ * const myFunction = memoize(() => myFunction());
2494
+ * ```
2495
+ *
2496
+ * @param {Function} func
2497
+ * @return {Function}
2498
+ */
2499
+ function memoize(func) {
2500
+ var cache = {};
2501
+ return function () {
2502
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2503
+ args[_key] = arguments[_key];
2385
2504
  }
2386
- },
2387
- 'message.srTextUnreadCount': ({
2388
- unreadCount
2389
- }) => {
2390
- switch (unreadCount) {
2391
- case 1:
2392
- return `There is 1 new unread chat message.`;
2393
2505
 
2394
- case 0:
2395
- default:
2396
- return `There are ${unreadCount} new unread chat messages.`;
2506
+ var key = args.length ? args.map(function (arg) {
2507
+ return arg === null ? 'null' : arg === undefined ? 'undefined' : typeof arg === 'function' ? arg.toString() : arg instanceof Date ? arg.toISOString() : JSON.stringify(arg);
2508
+ }).join('|') : '_(no-args)_';
2509
+
2510
+ if (Object.prototype.hasOwnProperty.call(cache, key)) {
2511
+ return cache[key];
2397
2512
  }
2398
- },
2399
- 'options.cancelButtonText': 'Cancel',
2400
- 'options.cobrowsing.cobrowsingActiveText': 'Sharing screen',
2401
- 'options.cobrowsing.cobrowsingUnavailable': 'Screen sharing is currently unavailable.',
2402
- 'options.cobrowsing.description': 'This allows the agent to see the page you\'re currently on. Nothing else is shared.',
2403
- 'options.cobrowsing.labelTurnOff': 'Turn screen sharing off',
2404
- 'options.cobrowsing.labelTurnOn': 'Turn screen sharing on',
2405
- 'options.cobrowsing.menuTitle': 'Screen sharing',
2406
- 'options.cobrowsing.srCobrowsingAvailable': 'Screen sharing is now available.',
2407
- 'options.cobrowsing.srStartedCobrowsingText': 'Screen sharing has been started.',
2408
- 'options.cobrowsing.srStopCobrowsingText': 'Stop screen sharing',
2409
- 'options.cobrowsing.srStoppedCobrowsingText': 'Screen sharing has been stopped.',
2410
- 'options.cobrowsing.stopCobrowsingText': 'Stop',
2411
- 'options.cobrowsing.title': 'Share my screen',
2412
- 'options.openButtonText': 'Options',
2413
- 'options.saveButtonText': 'Save',
2414
- 'options.sendTranscript.description': 'Enter the email address you would like to send the chat transcript to.',
2415
- 'options.sendTranscript.invalidEmailText': 'Please enter a valid email address',
2416
- 'options.sendTranscript.label': 'Email address',
2417
- 'options.sendTranscript.menuTitle': 'Send transcript',
2418
- 'options.sendTranscript.noEmailText': 'Please enter an email address',
2419
- 'options.sendTranscript.sendButtonText': 'Send',
2420
- 'options.sendTranscript.title': 'Send chat transcript',
2421
- 'options.unavailableText': 'unavailable',
2422
- 'resumeConversationPrompt.continueButton': 'Resume conversation',
2423
- 'resumeConversationPrompt.detachButton': 'Ask new question',
2424
- 'resumeConversationPrompt.title': name => `Would you like to continue the conversation with ${name}?`,
2425
- skiplinkText: 'Skip to chat input',
2426
- 'toggleButton.resumeTitle': 'Resume chat with',
2427
- 'toggleButton.subtitle': 'Start a chat with us',
2428
- 'toggleButton.title': 'Have a question?',
2429
- 'translations.divider.restartButtonText': 'Start again',
2430
- 'translations.divider.startText': language => `Translating to ${language}`,
2431
- 'translations.divider.stopText': language => `Translating to ${language} ended`,
2432
- 'translations.settings.cancelButtonText': 'Cancel',
2433
- 'translations.settings.currentTranslationLabel': 'Currently translating to',
2434
- 'translations.settings.defaultOptionLabel': 'Choose language',
2435
- 'translations.settings.description': 'Automatic translations might contain errors.',
2436
- 'translations.settings.endButtonText': 'Stop translating',
2437
- 'translations.settings.inputLabel': 'Translate chat to',
2438
- 'translations.settings.noLocaleText': 'Choose a language to translate to',
2439
- 'translations.settings.openButtonText': 'Translation',
2440
- 'translations.settings.startButtonText': 'Start translating',
2441
- 'translations.settings.title': 'Translation',
2442
- 'translations.status.label': language => `Translating to ${language}`,
2443
- 'translations.status.srStopText': 'Stop translating',
2444
- 'translations.status.stopText': 'Stop',
2445
- 'translations.toggle.hideButtonText': 'Show original',
2446
- 'translations.toggle.showButtonText': 'Show translation',
2447
- 'window.srModalLayoutLabel': 'Chat window',
2448
- 'window.srTexts.onClose': 'The chat is closed.',
2449
- 'window.srTexts.onHistoryLoad': 'Chat history has been loaded.',
2450
- 'window.srTexts.onLoad': 'Chat is available on this page.',
2451
- 'window.srTexts.onOpen': 'The chat is opened.'
2452
- });
2453
- ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/index.js
2454
- function i18n_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; }
2455
2513
 
2456
- function i18n_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { i18n_ownKeys(Object(source), true).forEach(function (key) { i18n_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { i18n_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2514
+ var result = func.apply(void 0, args);
2515
+ cache[key] = result;
2516
+ return result;
2517
+ };
2518
+ }
2457
2519
 
2458
- function i18n_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2520
+ //# sourceMappingURL=function-utils.es.js.map
2521
+ ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/lib/icu-message-formatter.es.js
2459
2522
 
2460
2523
 
2461
2524
 
2462
2525
 
2463
2526
 
2464
2527
 
2465
- // Actions
2466
2528
 
2467
- const {
2468
- createAction: i18n_createAction
2469
- } = createDomain('i18n');
2470
- const initI18n = i18n_createAction('init', overrides => ({
2471
- overrides
2472
- })); // Reducer
2529
+ /*
2530
+ * Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
2531
+ *
2532
+ * Licensed under the Apache License, Version 2.0 (the "License");
2533
+ * you may not use this file except in compliance with the License.
2534
+ * You may obtain a copy of the License at
2535
+ *
2536
+ * http://www.apache.org/licenses/LICENSE-2.0
2537
+ *
2538
+ * Unless required by applicable law or agreed to in writing, software
2539
+ * distributed under the License is distributed on an "AS IS" BASIS,
2540
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2541
+ * See the License for the specific language governing permissions and
2542
+ * limitations under the License.
2543
+ */
2473
2544
 
2474
- const defaultState = {
2475
- translations: flattenObject(en),
2476
- overrides: {}
2477
- };
2478
- const Reducer = createReducer('i18n', {
2479
- [initI18n]: (state, {
2480
- overrides
2481
- }) => {
2482
- return i18n_objectSpread(i18n_objectSpread({}, state), {}, {
2483
- overrides: overrides ? flattenObject(overrides) : undefined
2484
- });
2545
+ /**
2546
+ * Most branch-based type handlers are based around "cases".
2547
+ * For example, `select` and `plural` compare compare a value
2548
+ * to "case keys" to choose a subtranslation.
2549
+ *
2550
+ * This util splits "matches" portions provided to the aforementioned
2551
+ * handlers into case strings, and extracts any prepended arguments
2552
+ * (for example, `plural` supports an `offset:n` argument used for
2553
+ * populating the magic `#` variable).
2554
+ *
2555
+ * @param {String} string
2556
+ * @return {Object} The `cases` key points to a map of all cases.
2557
+ * The `arguments` key points to a list of prepended arguments.
2558
+ */
2559
+ function parseCases(string) {
2560
+ var isWhitespace = function isWhitespace(ch) {
2561
+ return /\s/.test(ch);
2562
+ };
2563
+
2564
+ var args = [];
2565
+ var cases = {};
2566
+ var currTermStart = 0;
2567
+ var latestTerm = null;
2568
+ var inTerm = false;
2569
+ var i = 0;
2570
+
2571
+ while (i < string.length) {
2572
+ // Term ended
2573
+ if (inTerm && (isWhitespace(string[i]) || string[i] === '{')) {
2574
+ inTerm = false;
2575
+ latestTerm = string.slice(currTermStart, i); // We want to process the opening char again so the case will be properly registered.
2576
+
2577
+ if (string[i] === '{') {
2578
+ i--;
2579
+ }
2580
+ } // New term
2581
+ else if (!inTerm && !isWhitespace(string[i])) {
2582
+ var caseBody = string[i] === '{'; // If there's a previous term, we can either handle a whole
2583
+ // case, or add that as an argument.
2584
+
2585
+ if (latestTerm && caseBody) {
2586
+ var branchEndIndex = findClosingBracket(string, i);
2587
+
2588
+ if (branchEndIndex === -1) {
2589
+ throw new Error("Unbalanced curly braces in string: \"".concat(string, "\""));
2590
+ }
2591
+
2592
+ cases[latestTerm] = string.slice(i + 1, branchEndIndex); // Don't include the braces
2593
+
2594
+ i = branchEndIndex; // Will be moved up where needed at end of loop.
2595
+
2596
+ latestTerm = null;
2597
+ } else {
2598
+ if (latestTerm) {
2599
+ args.push(latestTerm);
2600
+ latestTerm = null;
2601
+ }
2602
+
2603
+ inTerm = true;
2604
+ currTermStart = i;
2605
+ }
2606
+ }
2607
+
2608
+ i++;
2485
2609
  }
2486
- }, defaultState); // Selectors
2487
2610
 
2488
- const i18n_getState = state => state[String(Reducer)];
2489
- const getTranslations = createSelector(i18n_getState, state => state.translations);
2490
- const getOverrides = createSelector(i18n_getState, state => state.overrides || {});
2491
- const getCombinedTranslations = createSelector(getTranslations, getOverrides, (translations, overrides) => {
2492
- const overrideKeys = Object.keys(overrides);
2611
+ if (inTerm) {
2612
+ latestTerm = string.slice(currTermStart);
2613
+ }
2493
2614
 
2494
- if (overrideKeys.length === 0) {
2495
- return translations;
2615
+ if (latestTerm) {
2616
+ args.push(latestTerm);
2496
2617
  }
2497
2618
 
2498
- const defaultKeys = Object.keys(translations);
2499
- defaultKeys.forEach(key => {
2500
- if (overrideKeys.indexOf(key) === -1) {
2501
- console.error('Seamly: Missing translation key:', key);
2619
+ return {
2620
+ args: args,
2621
+ cases: cases
2622
+ };
2623
+ }
2624
+ /**
2625
+ * Finds the index of the matching closing curly bracket, including through
2626
+ * strings that could have nested brackets.
2627
+ *
2628
+ * @param {String} string
2629
+ * @param {Number} fromIndex
2630
+ * @return {Number} The index of the matching closing bracket, or -1 if no
2631
+ * closing bracket could be found.
2632
+ */
2633
+
2634
+ function findClosingBracket(string, fromIndex) {
2635
+ var depth = 0;
2636
+
2637
+ for (var i = fromIndex + 1; i < string.length; i++) {
2638
+ var char = string.charAt(i);
2639
+
2640
+ if (char === '}') {
2641
+ if (depth === 0) {
2642
+ return i;
2643
+ }
2644
+
2645
+ depth--;
2646
+ } else if (char === '{') {
2647
+ depth++;
2648
+ }
2649
+ }
2650
+
2651
+ return -1;
2652
+ }
2653
+ /**
2654
+ * Split a `{key, type, format}` block into those 3 parts, taking into account
2655
+ * nested message syntax that can exist in the `format` part.
2656
+ *
2657
+ * @param {String} block
2658
+ * @return {Array}
2659
+ * An array with `key`, `type`, and `format` items in that order, if present
2660
+ * in the formatted argument block.
2661
+ */
2662
+
2663
+ function splitFormattedArgument(block) {
2664
+ return split(block.slice(1, -1), ',', 3);
2665
+ }
2666
+ /**
2667
+ * Like `String.prototype.split()` but where the limit parameter causes the
2668
+ * remainder of the string to be grouped together in a final entry.
2669
+ *
2670
+ * @private
2671
+ * @param {String} string
2672
+ * @param {String} separator
2673
+ * @param {Number} limit
2674
+ * @param {Array} [accumulator=[]]
2675
+ * @return {Array}
2676
+ */
2677
+
2678
+ function split(string, separator, limit) {
2679
+ var accumulator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
2680
+
2681
+ if (!string) {
2682
+ return accumulator;
2683
+ }
2684
+
2685
+ if (limit === 1) {
2686
+ accumulator.push(string);
2687
+ return accumulator;
2688
+ }
2689
+
2690
+ var indexOfDelimiter = string.indexOf(separator);
2691
+
2692
+ if (indexOfDelimiter === -1) {
2693
+ accumulator.push(string);
2694
+ return accumulator;
2695
+ }
2696
+
2697
+ var head = string.substring(0, indexOfDelimiter).trim();
2698
+ var tail = string.substring(indexOfDelimiter + separator.length + 1).trim();
2699
+ accumulator.push(head);
2700
+ return split(tail, separator, limit - 1, accumulator);
2701
+ }
2702
+
2703
+ /**
2704
+ * The main class for formatting messages.
2705
+ *
2706
+ * @author Emanuel Rabina
2707
+ */
2708
+
2709
+ var MessageFormatter = /*#__PURE__*/function () {
2710
+ /**
2711
+ * Creates a new formatter that can work using any of the custom type handlers
2712
+ * you register.
2713
+ *
2714
+ * @param {String} locale
2715
+ * @param {Object} [typeHandlers={}]
2716
+ * Optional object where the keys are the names of the types to register,
2717
+ * their values being the functions that will return a nicely formatted
2718
+ * string for the data and locale they are given.
2719
+ */
2720
+ function MessageFormatter(locale) {
2721
+ var _this = this;
2722
+
2723
+ var typeHandlers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2724
+
2725
+ _classCallCheck(this, MessageFormatter);
2726
+
2727
+ defineProperty_defineProperty(this, "format", memoize(function (message) {
2728
+ var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2729
+ return flatten(_this.process(message, values)).join('');
2730
+ }));
2731
+
2732
+ this.locale = locale;
2733
+ this.typeHandlers = typeHandlers;
2734
+ }
2735
+ /**
2736
+ * Formats an ICU message syntax string using `values` for placeholder data
2737
+ * and any currently-registered type handlers.
2738
+ *
2739
+ * @param {String} message
2740
+ * @param {Object} [values={}]
2741
+ * @return {String}
2742
+ */
2743
+
2744
+
2745
+ _createClass(MessageFormatter, [{
2746
+ key: "process",
2747
+ value:
2748
+ /**
2749
+ * Process an ICU message syntax string using `values` for placeholder data
2750
+ * and any currently-registered type handlers. The result of this method is
2751
+ * an array of the component parts after they have been processed in turn by
2752
+ * their own type handlers. This raw output is useful for other renderers,
2753
+ * eg: React where components can be used instead of being forced to return
2754
+ * raw strings.
2755
+ *
2756
+ * This method is used by {@link MessageFormatter#format} where it acts as a
2757
+ * string renderer.
2758
+ *
2759
+ * @param {String} message
2760
+ * @param {Object} [values={}]
2761
+ * @return {Array}
2762
+ */
2763
+ function process(message) {
2764
+ var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2765
+
2766
+ if (!message) {
2767
+ return [];
2768
+ }
2769
+
2770
+ var blockStartIndex = message.indexOf('{');
2771
+
2772
+ if (blockStartIndex !== -1) {
2773
+ var blockEndIndex = findClosingBracket(message, blockStartIndex);
2774
+
2775
+ if (blockEndIndex !== -1) {
2776
+ var block = message.substring(blockStartIndex, blockEndIndex + 1);
2777
+
2778
+ if (block) {
2779
+ var result = [];
2780
+ var head = message.substring(0, blockStartIndex);
2781
+
2782
+ if (head) {
2783
+ result.push(head);
2784
+ }
2785
+
2786
+ var _splitFormattedArgume = splitFormattedArgument(block),
2787
+ _splitFormattedArgume2 = _slicedToArray(_splitFormattedArgume, 3),
2788
+ key = _splitFormattedArgume2[0],
2789
+ type = _splitFormattedArgume2[1],
2790
+ format = _splitFormattedArgume2[2];
2791
+
2792
+ var body = values[key];
2793
+
2794
+ if (body === null || body === undefined) {
2795
+ body = '';
2796
+ }
2797
+
2798
+ var typeHandler = type && this.typeHandlers[type];
2799
+ result.push(typeHandler ? typeHandler(body, format, this.locale, values, this.process.bind(this)) : body);
2800
+ var tail = message.substring(blockEndIndex + 1);
2801
+
2802
+ if (tail) {
2803
+ result.push(this.process(tail, values));
2804
+ }
2805
+
2806
+ return result;
2807
+ }
2808
+ } else {
2809
+ throw new Error("Unbalanced curly braces in string: \"".concat(message, "\""));
2810
+ }
2811
+ }
2812
+
2813
+ return [message];
2814
+ }
2815
+ }]);
2816
+
2817
+ return MessageFormatter;
2818
+ }();
2819
+
2820
+ function icu_message_formatter_es_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; }
2821
+
2822
+ function icu_message_formatter_es_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { icu_message_formatter_es_ownKeys(Object(source), true).forEach(function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { icu_message_formatter_es_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2823
+ var pluralFormatter;
2824
+ var keyCounter = 0; // All the special keywords that can be used in `plural` blocks for the various branches
2825
+
2826
+ var ONE = 'one';
2827
+ var OTHER$1 = 'other';
2828
+ /**
2829
+ * @private
2830
+ * @param {String} caseBody
2831
+ * @param {Number} value
2832
+ * @return {Object} {caseBody: string, numberValues: object}
2833
+ */
2834
+
2835
+ function replaceNumberSign(caseBody, value) {
2836
+ var i = 0;
2837
+ var output = '';
2838
+ var numBraces = 0;
2839
+ var numberValues = {};
2840
+
2841
+ while (i < caseBody.length) {
2842
+ if (caseBody[i] === '#' && !numBraces) {
2843
+ var keyParam = "__hashToken".concat(keyCounter++);
2844
+ output += "{".concat(keyParam, ", number}");
2845
+ numberValues[keyParam] = value;
2846
+ } else {
2847
+ output += caseBody[i];
2848
+ }
2849
+
2850
+ if (caseBody[i] === '{') {
2851
+ numBraces++;
2852
+ } else if (caseBody[i] === '}') {
2853
+ numBraces--;
2854
+ }
2855
+
2856
+ i++;
2857
+ }
2858
+
2859
+ return {
2860
+ caseBody: output,
2861
+ numberValues: numberValues
2862
+ };
2863
+ }
2864
+ /**
2865
+ * Handler for `plural` statements within ICU message syntax strings. Returns
2866
+ * a formatted string for the branch that closely matches the current value.
2867
+ *
2868
+ * See https://formatjs.io/docs/core-concepts/icu-syntax#plural-format for more
2869
+ * details on how the `plural` statement works.
2870
+ *
2871
+ * @param {String} value
2872
+ * @param {String} matches
2873
+ * @param {String} locale
2874
+ * @param {String} values
2875
+ * @param {Function} format
2876
+ * @return {String}
2877
+ */
2878
+
2879
+
2880
+ function pluralTypeHandler(value) {
2881
+ var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2882
+ var locale = arguments.length > 2 ? arguments[2] : undefined;
2883
+ var values = arguments.length > 3 ? arguments[3] : undefined;
2884
+ var format = arguments.length > 4 ? arguments[4] : undefined;
2885
+
2886
+ var _parseCases = parseCases(matches),
2887
+ args = _parseCases.args,
2888
+ cases = _parseCases.cases;
2889
+
2890
+ var intValue = parseInt(value);
2891
+ args.forEach(function (arg) {
2892
+ if (arg.startsWith('offset:')) {
2893
+ intValue -= parseInt(arg.slice('offset:'.length));
2502
2894
  }
2503
2895
  });
2504
- return i18n_objectSpread(i18n_objectSpread({}, translations), overrides);
2505
- }); // Hooks
2896
+ var keywordPossibilities = [];
2897
+
2898
+ if ('PluralRules' in Intl) {
2899
+ // Effectively memoize because instantiation of `Int.*` objects is expensive.
2900
+ if (pluralFormatter === undefined || pluralFormatter.resolvedOptions().locale !== locale) {
2901
+ pluralFormatter = new Intl.PluralRules(locale);
2902
+ }
2903
+
2904
+ var pluralKeyword = pluralFormatter.select(intValue); // Other is always added last with least priority, so we don't want to add it here.
2905
+
2906
+ if (pluralKeyword !== OTHER$1) {
2907
+ keywordPossibilities.push(pluralKeyword);
2908
+ }
2909
+ }
2910
+
2911
+ if (intValue === 1) {
2912
+ keywordPossibilities.push(ONE);
2913
+ }
2914
+
2915
+ keywordPossibilities.push("=".concat(intValue), OTHER$1);
2916
+
2917
+ for (var i = 0; i < keywordPossibilities.length; i++) {
2918
+ var keyword = keywordPossibilities[i];
2506
2919
 
2507
- function i18n_useI18n() {
2508
- const translations = useSelector(getCombinedTranslations);
2920
+ if (keyword in cases) {
2921
+ var _replaceNumberSign = replaceNumberSign(cases[keyword], intValue),
2922
+ caseBody = _replaceNumberSign.caseBody,
2923
+ numberValues = _replaceNumberSign.numberValues;
2924
+
2925
+ return format(caseBody, icu_message_formatter_es_objectSpread(icu_message_formatter_es_objectSpread({}, values), numberValues));
2926
+ }
2927
+ }
2928
+
2929
+ return value;
2930
+ }
2931
+
2932
+ /*
2933
+ * Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
2934
+ *
2935
+ * Licensed under the Apache License, Version 2.0 (the "License");
2936
+ * you may not use this file except in compliance with the License.
2937
+ * You may obtain a copy of the License at
2938
+ *
2939
+ * http://www.apache.org/licenses/LICENSE-2.0
2940
+ *
2941
+ * Unless required by applicable law or agreed to in writing, software
2942
+ * distributed under the License is distributed on an "AS IS" BASIS,
2943
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2944
+ * See the License for the specific language governing permissions and
2945
+ * limitations under the License.
2946
+ */
2947
+ var OTHER = 'other';
2948
+ /**
2949
+ * Handler for `select` statements within ICU message syntax strings. Returns
2950
+ * a formatted string for the branch that closely matches the current value.
2951
+ *
2952
+ * See https://formatjs.io/docs/core-concepts/icu-syntax#select-format for more
2953
+ * details on how the `select` statement works.
2954
+ *
2955
+ * @param {String} value
2956
+ * @param {String} matches
2957
+ * @param {String} locale
2958
+ * @param {String} values
2959
+ * @param {Function} format
2960
+ * @return {String}
2961
+ */
2962
+
2963
+ function selectTypeHandler(value) {
2964
+ var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2965
+ var values = arguments.length > 3 ? arguments[3] : undefined;
2966
+ var format = arguments.length > 4 ? arguments[4] : undefined;
2967
+
2968
+ var _parseCases = parseCases(matches),
2969
+ cases = _parseCases.cases;
2970
+
2971
+ if (value in cases) {
2972
+ return format(cases[value], values);
2973
+ } else if (OTHER in cases) {
2974
+ return format(cases[OTHER], values);
2975
+ }
2976
+
2977
+ return value;
2978
+ }
2979
+
2980
+
2981
+ //# sourceMappingURL=icu-message-formatter.es.js.map
2982
+
2983
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/hooks.js
2984
+
2985
+
2986
+
2987
+ // The passed in locale (en-GB) is only used to call Intl.PluralRules.select() in
2988
+ // pluralTypeHandler. Since we only use exact plural matches (=0, =1 etc) we can
2989
+ // safely use en-GB all the time.
2990
+
2991
+ const formatter = new MessageFormatter('en-GB', {
2992
+ plural: pluralTypeHandler,
2993
+ select: selectTypeHandler
2994
+ });
2995
+ function hooks_useI18n() {
2996
+ const translations = useSelector(Selectors.selectTranslations);
2997
+ const locale = useSelector(Selectors.selectLocale);
2998
+ const initialLocale = useSelector(Selectors.selectInitialLocale);
2509
2999
  const t = useCallback((key, values = {}) => {
2510
3000
  const translation = translations[key];
2511
3001
 
2512
- if (typeof translation === 'function') {
2513
- return translation(values);
2514
- } else {
2515
- return translation;
3002
+ if (!translation) {
3003
+ return null;
2516
3004
  }
3005
+
3006
+ return formatter.format(translation, values);
2517
3007
  }, [translations]);
2518
3008
  return {
2519
- t
3009
+ t,
3010
+ locale,
3011
+ initialLocale
2520
3012
  };
2521
3013
  }
3014
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/reducer.js
3015
+ function i18n_reducer_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; }
3016
+
3017
+ function i18n_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { i18n_reducer_ownKeys(Object(source), true).forEach(function (key) { i18n_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { i18n_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3018
+
3019
+ function i18n_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3020
+
3021
+
3022
+
3023
+ const defaultState = {
3024
+ translations: {
3025
+ 'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
3026
+ 'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
3027
+ 'errors.configError.title': 'Chat configuration error.',
3028
+ 'errors.general.buttonText': 'Restart chat',
3029
+ 'errors.general.message': 'Do you want to start a new chat session?',
3030
+ 'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
3031
+ 'errors.general.title': 'Something went wrong',
3032
+ 'errors.seamlyOffline.message': 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
3033
+ 'errors.seamlyOffline.srText': 'The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.',
3034
+ 'errors.seamlyOffline.title': 'Connection issues'
3035
+ },
3036
+ isLoading: false,
3037
+ initialLocale: undefined
3038
+ };
3039
+ /* harmony default export */ const i18n_reducer = (i18n_utils_createReducer({
3040
+ [setInitialLocale]: (state, {
3041
+ locale
3042
+ }) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
3043
+ initialLocale: locale
3044
+ }),
3045
+ [setLocaleStart]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
3046
+ isLoading: true
3047
+ }),
3048
+ [setLocaleResolve]: (state, {
3049
+ locale,
3050
+ translations
3051
+ }) => {
3052
+ return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
3053
+ isLoading: false,
3054
+ locale,
3055
+ translations: Object.keys(translations).sort().reduce((accum, key) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, accum), {}, {
3056
+ [key]: translations[key]
3057
+ }), {})
3058
+ });
3059
+ },
3060
+ [setLocaleReject]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
3061
+ isLoading: false
3062
+ })
3063
+ }, defaultState));
3064
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/index.js
3065
+
3066
+
3067
+
3068
+
3069
+
2522
3070
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-option-hooks.js
2523
3071
  function seamly_option_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; }
2524
3072
 
@@ -2538,7 +3086,7 @@ const {
2538
3086
  SET_USER_SELECTED_OPTIONS: seamly_option_hooks_SET_USER_SELECTED_OPTIONS,
2539
3087
  SHOW_OPTION: seamly_option_hooks_SHOW_OPTION,
2540
3088
  HIDE_OPTION: seamly_option_hooks_HIDE_OPTION
2541
- } = seamlyActions;
3089
+ } = seamly_utils_seamlyActions;
2542
3090
  const seamly_option_hooks_useSeamlyOptions = () => {
2543
3091
  const {
2544
3092
  t
@@ -2636,152 +3184,6 @@ const seamly_option_hooks_useOptionButton = () => {
2636
3184
  focusButton
2637
3185
  };
2638
3186
  };
2639
- ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-offline-error.js
2640
- class seamly_offline_error_SeamlyOfflineError extends Error {
2641
- constructor(params) {
2642
- super(params);
2643
-
2644
- if (Error.captureStackTrace) {
2645
- Error.captureStackTrace(this, seamly_offline_error_SeamlyOfflineError);
2646
- }
2647
-
2648
- this.name = 'SeamlyOfflineError';
2649
- this.langKey = 'errors.seamlyOffline';
2650
- }
2651
-
2652
- }
2653
- ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
2654
- class seamly_general_error_SeamlyGeneralError extends Error {
2655
- constructor(params) {
2656
- super(params);
2657
-
2658
- if (Error.captureStackTrace) {
2659
- Error.captureStackTrace(this, seamly_general_error_SeamlyGeneralError);
2660
- }
2661
-
2662
- this.name = 'SeamlyGeneralError';
2663
- this.langKey = 'errors.general';
2664
- this.action = 'reset';
2665
- }
2666
-
2667
- }
2668
- ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-configuration-error.js
2669
- class seamly_configuration_error_SeamlyConfigurationError extends Error {
2670
- constructor(params) {
2671
- super(params);
2672
-
2673
- if (Error.captureStackTrace) {
2674
- Error.captureStackTrace(this, seamly_configuration_error_SeamlyConfigurationError);
2675
- }
2676
-
2677
- this.name = 'SeamlyConfigurationError';
2678
- this.langKey = 'errors.configError';
2679
- }
2680
-
2681
- }
2682
- ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-session-expired-error.js
2683
- class seamly_session_expired_error_SeamlySessionExpiredError extends Error {
2684
- constructor(params) {
2685
- super(params);
2686
-
2687
- if (Error.captureStackTrace) {
2688
- Error.captureStackTrace(this, seamly_session_expired_error_SeamlySessionExpiredError);
2689
- }
2690
-
2691
- this.name = 'SeamlySessionExpiredError';
2692
- this.action = 'reset';
2693
- }
2694
-
2695
- }
2696
- ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unauthorized-error.js
2697
- class seamly_unauthorized_error_SeamlyUnauthorizedError extends Error {
2698
- constructor(params) {
2699
- super(params);
2700
-
2701
- if (Error.captureStackTrace) {
2702
- Error.captureStackTrace(this, seamly_unauthorized_error_SeamlyUnauthorizedError);
2703
- }
2704
-
2705
- this.name = 'SeamlyUnauthorizedError';
2706
- this.langKey = 'errors.general';
2707
- this.action = 'reset';
2708
- }
2709
-
2710
- }
2711
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-interrupt.js
2712
- function use_seamly_interrupt_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; }
2713
-
2714
- function use_seamly_interrupt_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { use_seamly_interrupt_ownKeys(Object(source), true).forEach(function (key) { use_seamly_interrupt_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { use_seamly_interrupt_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2715
-
2716
- function use_seamly_interrupt_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2717
-
2718
-
2719
-
2720
-
2721
-
2722
-
2723
-
2724
-
2725
-
2726
-
2727
-
2728
-
2729
- const {
2730
- SET_INTERRUPT: use_seamly_interrupt_SET_INTERRUPT
2731
- } = seamlyActions;
2732
-
2733
- const use_seamly_interrupt_useSeamlyInterrupt = () => {
2734
- const {
2735
- t
2736
- } = useI18n();
2737
- const {
2738
- hasInterrupt,
2739
- meta
2740
- } = useSeamlyStateContext().interrupt;
2741
- const dispatch = useSeamlyDispatchContext();
2742
- const {
2743
- setUserSelectedOption
2744
- } = useSeamlyOptions();
2745
- const setInterrupt = useCallback(error => {
2746
- if (!(error instanceof SeamlyOfflineError)) {
2747
- setUserSelectedOption(featureKeys.cobrowsing, false);
2748
- }
2749
-
2750
- if (error instanceof SeamlyGeneralError || error instanceof SeamlyConfigurationError || error instanceof SeamlySessionExpiredError || error instanceof SeamlyOfflineError || error instanceof SeamlyUnauthorizedError) {
2751
- const {
2752
- langKey,
2753
- action
2754
- } = error;
2755
- const title = t(`${langKey}.title`);
2756
- const message = t(`${langKey}.message`);
2757
- const srText = t(`${langKey}.srText`);
2758
- const buttonText = t(`${langKey}.buttonText`);
2759
- dispatch({
2760
- type: use_seamly_interrupt_SET_INTERRUPT,
2761
- interrupt: use_seamly_interrupt_objectSpread(use_seamly_interrupt_objectSpread(use_seamly_interrupt_objectSpread(use_seamly_interrupt_objectSpread({}, langKey ? {
2762
- title,
2763
- message,
2764
- srText
2765
- } : {}), action ? {
2766
- action
2767
- } : {}), action && langKey ? {
2768
- buttonText
2769
- } : {}), {}, {
2770
- originalError: error
2771
- })
2772
- });
2773
- } else {
2774
- throw error;
2775
- }
2776
- }, [dispatch, t, setUserSelectedOption]);
2777
- return {
2778
- hasInterrupt,
2779
- meta,
2780
- setInterrupt
2781
- };
2782
- };
2783
-
2784
- /* harmony default export */ const use_seamly_interrupt = ((/* unused pure expression or super */ null && (use_seamly_interrupt_useSeamlyInterrupt)));
2785
3187
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-file-upload-context.js
2786
3188
 
2787
3189
  const seamly_file_upload_context_SeamlyFileUploadContext = (0,external_preact_namespaceObject.createContext)({});
@@ -2800,7 +3202,7 @@ function file_upload_hooks_defineProperty(obj, key, value) { if (key in obj) { O
2800
3202
 
2801
3203
  const {
2802
3204
  CLEAR_ALL_UPLOADS: file_upload_hooks_CLEAR_ALL_UPLOADS
2803
- } = seamlyActions;
3205
+ } = seamly_utils_seamlyActions;
2804
3206
 
2805
3207
  const useSeamlyFileUploadContext = () => useContext(SeamlyFileUploadContext);
2806
3208
 
@@ -2868,33 +3270,314 @@ const useFileUploads = () => {
2868
3270
  isComplete: currentUploads.every(file => file.complete)
2869
3271
  };
2870
3272
  };
2871
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/utility-hooks.js
3273
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/utility-hooks.js
3274
+
3275
+
3276
+ const useForceUpdate = () => {
3277
+ // This is an escape hatch mentioned in the React docs:
3278
+ // https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate
3279
+
3280
+ /* eslint-disable-next-line no-unused-vars */
3281
+ const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
3282
+ return useCallback(() => {
3283
+ setTimeout(() => {
3284
+ forceUpdate();
3285
+ });
3286
+ }, []);
3287
+ };
3288
+ const utility_hooks_useGeneratedId = () => {
3289
+ const [id] = useState(() => randomId());
3290
+ return id;
3291
+ };
3292
+ const utility_hooks_useStableCallback = callback => {
3293
+ const callbackRef = useRef();
3294
+ callbackRef.current = callback;
3295
+ const isFunction = typeof callback === 'function';
3296
+ return useMemo(() => {
3297
+ return isFunction ? (...args) => callbackRef.current(...args) : undefined;
3298
+ }, [isFunction]);
3299
+ };
3300
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/utils.js
3301
+
3302
+ const {
3303
+ createAction: interrupt_utils_createAction,
3304
+ createReducer: interrupt_utils_createReducer,
3305
+ selectState: interrupt_utils_selectState
3306
+ } = createDomain('interrupt');
3307
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/actions.js
3308
+
3309
+ const set = interrupt_utils_createAction('set', error => ({
3310
+ error
3311
+ }));
3312
+ const clear = interrupt_utils_createAction('clear');
3313
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.js
3314
+
3315
+
3316
+ const selectError = createSelector(interrupt_utils_selectState, ({
3317
+ error
3318
+ }) => error);
3319
+
3320
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.js
3321
+ function 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; }
3322
+
3323
+ function hooks_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { hooks_ownKeys(Object(source), true).forEach(function (key) { hooks_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { hooks_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3324
+
3325
+ function hooks_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3326
+
3327
+
3328
+
3329
+
3330
+
3331
+ function hooks_useInterrupt() {
3332
+ const {
3333
+ t
3334
+ } = useI18n();
3335
+ const error = useSelector(Selectors.selectError);
3336
+ const hasInterrupt = Boolean(error);
3337
+ const meta = useMemo(() => {
3338
+ if (!error) return {};
3339
+ const {
3340
+ langKey,
3341
+ action
3342
+ } = error;
3343
+ const title = t(`${langKey}.title`);
3344
+ const message = t(`${langKey}.message`);
3345
+ const srText = t(`${langKey}.srText`);
3346
+ const buttonText = t(`${langKey}.buttonText`);
3347
+ return hooks_objectSpread(hooks_objectSpread(hooks_objectSpread(hooks_objectSpread({}, langKey ? {
3348
+ title,
3349
+ message,
3350
+ srText
3351
+ } : {}), action ? {
3352
+ action
3353
+ } : {}), action && langKey ? {
3354
+ buttonText
3355
+ } : {}), {}, {
3356
+ originalError: error
3357
+ });
3358
+ }, [t, error]);
3359
+ return {
3360
+ hasInterrupt,
3361
+ meta,
3362
+ error
3363
+ };
3364
+ }
3365
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
3366
+ class SeamlyGeneralError extends Error {
3367
+ constructor(params) {
3368
+ super(params);
3369
+
3370
+ if (Error.captureStackTrace) {
3371
+ Error.captureStackTrace(this, SeamlyGeneralError);
3372
+ }
3373
+
3374
+ this.name = 'SeamlyGeneralError';
3375
+ this.langKey = 'errors.general';
3376
+ this.action = 'reset';
3377
+ }
3378
+
3379
+ }
3380
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-configuration-error.js
3381
+ class SeamlyConfigurationError extends Error {
3382
+ constructor(params) {
3383
+ super(params);
3384
+
3385
+ if (Error.captureStackTrace) {
3386
+ Error.captureStackTrace(this, SeamlyConfigurationError);
3387
+ }
3388
+
3389
+ this.name = 'SeamlyConfigurationError';
3390
+ this.langKey = 'errors.configError';
3391
+ }
3392
+
3393
+ }
3394
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-session-expired-error.js
3395
+ class SeamlySessionExpiredError extends Error {
3396
+ constructor(params) {
3397
+ super(params);
3398
+
3399
+ if (Error.captureStackTrace) {
3400
+ Error.captureStackTrace(this, SeamlySessionExpiredError);
3401
+ }
3402
+
3403
+ this.name = 'SeamlySessionExpiredError';
3404
+ this.action = 'reset';
3405
+ }
3406
+
3407
+ }
3408
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-offline-error.js
3409
+ class SeamlyOfflineError extends Error {
3410
+ constructor(params) {
3411
+ super(params);
3412
+
3413
+ if (Error.captureStackTrace) {
3414
+ Error.captureStackTrace(this, SeamlyOfflineError);
3415
+ }
3416
+
3417
+ this.name = 'SeamlyOfflineError';
3418
+ this.langKey = 'errors.seamlyOffline';
3419
+ }
3420
+
3421
+ }
3422
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unauthorized-error.js
3423
+ class SeamlyUnauthorizedError extends Error {
3424
+ constructor(params) {
3425
+ super(params);
3426
+
3427
+ if (Error.captureStackTrace) {
3428
+ Error.captureStackTrace(this, SeamlyUnauthorizedError);
3429
+ }
3430
+
3431
+ this.name = 'SeamlyUnauthorizedError';
3432
+ this.langKey = 'errors.general';
3433
+ this.action = 'reset';
3434
+ }
3435
+
3436
+ }
3437
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/middleware.js
3438
+
3439
+
3440
+
3441
+
3442
+
3443
+
3444
+ const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError];
3445
+ function middleware_createMiddleware() {
3446
+ return () => next => action => {
3447
+ if (action.type === String(Actions.set)) {
3448
+ if (!handledErrorTypes.some(ErrorType => action.error instanceof ErrorType)) {
3449
+ throw action.error;
3450
+ }
3451
+ }
3452
+
3453
+ return next(action);
3454
+ };
3455
+ }
3456
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
3457
+ function interrupt_reducer_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; }
3458
+
3459
+ function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { interrupt_reducer_ownKeys(Object(source), true).forEach(function (key) { interrupt_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { interrupt_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3460
+
3461
+ function interrupt_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3462
+
3463
+
3464
+
3465
+ const interrupt_reducer_initialState = {
3466
+ error: undefined
3467
+ };
3468
+ /* harmony default export */ const interrupt_reducer = (interrupt_utils_createReducer({
3469
+ [set]: (state, {
3470
+ error
3471
+ }) => {
3472
+ return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
3473
+ error
3474
+ });
3475
+ },
3476
+ [clear]: () => {
3477
+ return interrupt_reducer_initialState;
3478
+ }
3479
+ }, interrupt_reducer_initialState));
3480
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
2872
3481
 
2873
3482
 
2874
- const useForceUpdate = () => {
2875
- // This is an escape hatch mentioned in the React docs:
2876
- // https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate
2877
3483
 
2878
- /* eslint-disable-next-line no-unused-vars */
2879
- const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
2880
- return useCallback(() => {
2881
- setTimeout(() => {
2882
- forceUpdate();
3484
+
3485
+
3486
+
3487
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
3488
+
3489
+ const {
3490
+ createAction: app_utils_createAction,
3491
+ createThunk: app_utils_createThunk,
3492
+ createReducer: app_utils_createReducer,
3493
+ selectState: app_utils_selectState
3494
+ } = createDomain('app');
3495
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
3496
+
3497
+
3498
+
3499
+
3500
+
3501
+ const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
3502
+ hasResponded
3503
+ }));
3504
+ const actions_initialize = app_utils_createThunk('initialize', config => async (dispatch, getState, {
3505
+ api
3506
+ }) => {
3507
+ try {
3508
+ var _config$context;
3509
+
3510
+ dispatch(initialize(config));
3511
+ const {
3512
+ features,
3513
+ defaultLocale
3514
+ } = await api.getConfig();
3515
+ dispatch({
3516
+ type: seamly_utils_seamlyActions.SET_FEATURES,
3517
+ features
2883
3518
  });
2884
- }, []);
2885
- };
2886
- const utility_hooks_useGeneratedId = () => {
2887
- const [id] = useState(() => randomId());
2888
- return id;
2889
- };
2890
- const utility_hooks_useStableCallback = callback => {
2891
- const callbackRef = useRef();
2892
- callbackRef.current = callback;
2893
- const isFunction = typeof callback === 'function';
2894
- return useMemo(() => {
2895
- return isFunction ? (...args) => callbackRef.current(...args) : undefined;
2896
- }, [isFunction]);
3519
+ let locale = (config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale) || defaultLocale;
3520
+ dispatch(setInitialLocale(locale));
3521
+
3522
+ try {
3523
+ if (api.hasConversation()) {
3524
+ var _initialState$transla;
3525
+
3526
+ const initialState = await api.getConversationIntitialState();
3527
+ dispatch({
3528
+ type: seamly_utils_seamlyActions.SET_INITIAL_STATE,
3529
+ initialState
3530
+ });
3531
+ locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
3532
+
3533
+ if ('userResponded' in initialState) {
3534
+ dispatch(setHasResponded(initialState.userResponded));
3535
+ }
3536
+ }
3537
+ } catch (error) {
3538
+ dispatch(set(error));
3539
+ }
3540
+
3541
+ await dispatch(setLocale(locale));
3542
+ } catch (error) {
3543
+ dispatch(set(error));
3544
+ }
3545
+ });
3546
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
3547
+
3548
+
3549
+ const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
3550
+
3551
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
3552
+
3553
+
3554
+ function hooks_useUserHasResponded() {
3555
+ return useSelector(Selectors.selectUserHasResponded);
3556
+ }
3557
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/reducer.js
3558
+ function app_reducer_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; }
3559
+
3560
+ function app_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { app_reducer_ownKeys(Object(source), true).forEach(function (key) { app_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { app_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3561
+
3562
+ function app_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3563
+
3564
+
3565
+
3566
+ const app_reducer_initialState = {
3567
+ userHasResponded: false
2897
3568
  };
3569
+ /* harmony default export */ const app_reducer = (app_utils_createReducer({
3570
+ [setHasResponded]: (state, {
3571
+ hasResponded
3572
+ }) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
3573
+ userHasResponded: hasResponded
3574
+ })
3575
+ }, app_reducer_initialState));
3576
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
3577
+
3578
+
3579
+
3580
+
2898
3581
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-commands.js
2899
3582
  function use_seamly_commands_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; }
2900
3583
 
@@ -2913,10 +3596,11 @@ function use_seamly_commands_defineProperty(obj, key, value) { if (key in obj) {
2913
3596
 
2914
3597
 
2915
3598
 
3599
+
3600
+
2916
3601
  const {
2917
3602
  ADD_EVENT: use_seamly_commands_ADD_EVENT,
2918
3603
  CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
2919
- CLEAR_INTERRUPT: use_seamly_commands_CLEAR_INTERRUPT,
2920
3604
  SET_IS_LOADING: use_seamly_commands_SET_IS_LOADING,
2921
3605
  CLEAR_PARTICIPANTS: use_seamly_commands_CLEAR_PARTICIPANTS,
2922
3606
  SET_HEADER_SUB_TITLE: use_seamly_commands_SET_HEADER_SUB_TITLE,
@@ -2925,25 +3609,19 @@ const {
2925
3609
  SET_FEATURES: use_seamly_commands_SET_FEATURES,
2926
3610
  RESET_UPLOAD_STATE: use_seamly_commands_RESET_UPLOAD_STATE,
2927
3611
  RESET_ENTRY_STATE: use_seamly_commands_RESET_ENTRY_STATE
2928
- } = seamlyActions;
3612
+ } = seamly_utils_seamlyActions;
2929
3613
 
2930
3614
  const use_seamly_commands_useSeamlyCommands = () => {
2931
3615
  const api = useSeamlyApiContext();
2932
- const seamlyState = useSeamlyStateContext();
3616
+ const appConfig = useConfig();
2933
3617
  const dispatch = useSeamlyDispatchContext();
2934
3618
  const eventBus = useContext(SeamlyEventBusContext);
2935
- const {
2936
- setInterrupt
2937
- } = useSeamlyInterrupt();
2938
- const hasResponded = useSeamlyHasUserResponded();
3619
+ const hasResponded = useUserHasResponded();
2939
3620
  const hasConversation = useSeamlyHasConversation();
2940
3621
  const {
2941
3622
  visible: visibility
2942
3623
  } = useSeamlyStateContext();
2943
3624
  const unreadMessageCount = useSeamlyUnreadCount();
2944
- const {
2945
- config: appConfig
2946
- } = seamlyState;
2947
3625
  const emitEvent = useCallback((...args) => {
2948
3626
  eventBus.emit(...args);
2949
3627
  }, [eventBus]);
@@ -2964,12 +3642,10 @@ const use_seamly_commands_useSeamlyCommands = () => {
2964
3642
  });
2965
3643
  }, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
2966
3644
  const reset = useCallback(async () => {
3645
+ dispatch(InterruptActions.clear());
2967
3646
  dispatch({
2968
3647
  type: use_seamly_commands_CLEAR_EVENTS
2969
3648
  });
2970
- dispatch({
2971
- type: use_seamly_commands_CLEAR_INTERRUPT
2972
- });
2973
3649
  dispatch({
2974
3650
  type: use_seamly_commands_SET_IS_LOADING,
2975
3651
  isLoading: true
@@ -2995,42 +3671,30 @@ const use_seamly_commands_useSeamlyCommands = () => {
2995
3671
  });
2996
3672
 
2997
3673
  try {
2998
- const {
2999
- accountConfig = {},
3000
- initialState = {}
3001
- } = await api.reset();
3002
3674
  const {
3003
3675
  features
3004
- } = accountConfig || {};
3676
+ } = await api.reset();
3005
3677
  dispatch({
3006
3678
  type: use_seamly_commands_SET_FEATURES,
3007
3679
  features
3008
3680
  });
3009
3681
  dispatch({
3010
3682
  type: use_seamly_commands_SET_INITIAL_STATE,
3011
- initialState
3683
+ initialState: {}
3012
3684
  });
3013
3685
  } catch (error) {
3014
- setInterrupt(error);
3686
+ dispatch(InterruptActions.set(error));
3015
3687
  }
3016
- }, [api, dispatch, appConfig, setInterrupt]);
3017
- const getMessageBase = useCallback(type => {
3018
- const {
3019
- events
3020
- } = seamlyState;
3021
- return {
3022
- type,
3023
- id: randomId(),
3024
- transactionId: randomId(),
3025
- participant: userParticipantId,
3026
- fromClient: true,
3027
- // We add a timestamp of 1 greater than the previous timestamp in the
3028
- // events array to ensure proper sorting should a history fetch be done
3029
- // prior to receipt of the related ACK.
3030
- occurredAt: events.length > 0 ? events[events.length - 1].payload.occurredAt + 1 : Date.now(),
3031
- meta: {}
3032
- };
3033
- }, [seamlyState]);
3688
+ }, [api, dispatch, appConfig]);
3689
+ const getMessageBase = useCallback(type => ({
3690
+ type,
3691
+ id: randomId(),
3692
+ transactionId: randomId(),
3693
+ participant: userParticipantId,
3694
+ fromClient: true,
3695
+ occurredAt: Date.now() * 1000,
3696
+ meta: {}
3697
+ }), []);
3034
3698
  const getTextMessageBase = useCallback(bodyText => {
3035
3699
  const base = getMessageBase('text');
3036
3700
  return use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, base), {}, {
@@ -3076,7 +3740,7 @@ const use_seamly_commands_useSeamlyCommands = () => {
3076
3740
  }
3077
3741
  });
3078
3742
  }, [dispatch, getTextMessageBase]);
3079
- const addUploadBubble = useCallback((id, transactionId, occurredAt, contentType, deleteAt, filename, filesize, url) => {
3743
+ const addUploadBubble = useCallback((id, transactionId, occurredAt, contentType, filename, filesize, url) => {
3080
3744
  dispatch({
3081
3745
  type: use_seamly_commands_ADD_EVENT,
3082
3746
  event: {
@@ -3091,7 +3755,6 @@ const use_seamly_commands_useSeamlyCommands = () => {
3091
3755
  meta: {},
3092
3756
  body: {
3093
3757
  contentType,
3094
- deleteAt,
3095
3758
  filename,
3096
3759
  filesize,
3097
3760
  url
@@ -3164,9 +3827,9 @@ const use_seamly_commands_useSeamlyCommands = () => {
3164
3827
  });
3165
3828
  }
3166
3829
  }).catch(error => {
3167
- setInterrupt(error);
3830
+ dispatch(InterruptActions.set(error));
3168
3831
  });
3169
- }, [api, dispatch, setInterrupt]);
3832
+ }, [api, dispatch]);
3170
3833
  return {
3171
3834
  connect,
3172
3835
  start,
@@ -3235,33 +3898,31 @@ function seamly_entry_hooks_defineProperty(obj, key, value) { if (key in obj) {
3235
3898
 
3236
3899
 
3237
3900
 
3901
+
3238
3902
  const {
3239
3903
  SET_BLOCK_AUTO_ENTRY_SWITCH: seamly_entry_hooks_SET_BLOCK_AUTO_ENTRY_SWITCH,
3240
3904
  SET_ACTIVE_ENTRY_TYPE: seamly_entry_hooks_SET_ACTIVE_ENTRY_TYPE,
3241
3905
  SET_USER_ENTRY_TYPE: seamly_entry_hooks_SET_USER_ENTRY_TYPE
3242
- } = seamlyActions;
3906
+ } = seamly_utils_seamlyActions;
3243
3907
  const useSeamlyTyping = () => {
3244
3908
  const {
3245
3909
  sendAction
3246
3910
  } = useSeamlyCommands();
3247
- const {
3248
- typing: typingConfig
3249
- } = useSeamlyConfig();
3250
3911
  const {
3251
3912
  features
3252
3913
  } = useSeamlyOptions();
3253
3914
  const {
3254
3915
  typingPeekahead
3255
3916
  } = features || {};
3256
- const typingTimeout = useRef(null);
3257
- const sendEndTypingTimeout = useRef(null);
3917
+ const typingTimerId = useRef(null);
3918
+ const sendEndTypingTimerId = useRef(null);
3258
3919
  const isTyping = useRef(false);
3259
- const typingInterval = useRef(null);
3920
+ const typingIntervalId = useRef(null);
3260
3921
  useEffect(() => {
3261
3922
  return () => {
3262
- clearInterval(typingInterval.current);
3263
- clearTimeout(typingTimeout.current);
3264
- clearTimeout(sendEndTypingTimeout.current);
3923
+ clearInterval(typingIntervalId.current);
3924
+ clearTimeout(typingTimerId.current);
3925
+ clearTimeout(sendEndTypingTimerId.current);
3265
3926
  };
3266
3927
  }, []);
3267
3928
 
@@ -3281,32 +3942,28 @@ const useSeamlyTyping = () => {
3281
3942
  return;
3282
3943
  }
3283
3944
 
3284
- if (!typingConfig) {
3285
- return;
3286
- }
3287
-
3288
3945
  isTyping.current = true;
3289
3946
 
3290
- if (!typingInterval.current) {
3947
+ if (!typingIntervalId.current) {
3291
3948
  sendTypingState(true, e.target.value);
3292
- typingInterval.current = setInterval(() => {
3949
+ typingIntervalId.current = setInterval(() => {
3293
3950
  if (!isTyping.current) {
3294
- clearInterval(typingInterval.current);
3295
- typingInterval.current = null;
3951
+ clearInterval(typingIntervalId.current);
3952
+ typingIntervalId.current = null;
3296
3953
  } else if (typingPeekahead && typingPeekahead.enabled) {
3297
3954
  sendTypingState(true, e.target.value);
3298
3955
  }
3299
- }, typingConfig.timeout);
3956
+ }, typingTimeout);
3300
3957
  }
3301
3958
 
3302
- clearTimeout(typingTimeout.current);
3303
- clearTimeout(sendEndTypingTimeout.current);
3304
- typingTimeout.current = setTimeout(() => {
3959
+ clearTimeout(typingTimerId.current);
3960
+ clearTimeout(sendEndTypingTimerId.current);
3961
+ typingTimerId.current = setTimeout(() => {
3305
3962
  isTyping.current = false;
3306
3963
  }, 300);
3307
- sendEndTypingTimeout.current = setTimeout(() => {
3964
+ sendEndTypingTimerId.current = setTimeout(() => {
3308
3965
  sendTypingState(false, e.target.value);
3309
- }, typingConfig.timeout);
3966
+ }, typingTimeout);
3310
3967
  };
3311
3968
  };
3312
3969
  const useSeamlyEntry = () => {
@@ -3367,7 +4024,7 @@ function use_seamly_stored_visibility_defineProperty(obj, key, value) { if (key
3367
4024
  const use_seamly_stored_visibility_useSeamlyStoredVisibility = () => {
3368
4025
  const {
3369
4026
  layoutMode
3370
- } = useSeamlyConfig();
4027
+ } = useConfig();
3371
4028
  const key = 'visibility';
3372
4029
  const {
3373
4030
  get,
@@ -3398,12 +4055,14 @@ const use_seamly_stored_visibility_useSeamlyStoredVisibility = () => {
3398
4055
 
3399
4056
 
3400
4057
 
4058
+
4059
+
3401
4060
  const {
3402
4061
  SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
3403
- } = seamlyActions;
4062
+ } = seamly_utils_seamlyActions;
3404
4063
 
3405
4064
  const use_seamly_visibility_useSeamlyVisibility = () => {
3406
- const config = useSeamlyConfig();
4065
+ const config = useConfig();
3407
4066
  const {
3408
4067
  layoutMode,
3409
4068
  visibilityCallback
@@ -3416,7 +4075,7 @@ const use_seamly_visibility_useSeamlyVisibility = () => {
3416
4075
  } = useSeamlyCommands();
3417
4076
  const dispatch = useSeamlyDispatchContext();
3418
4077
  const [storedVisibility, setStoredVisibility] = useSeamlyStoredVisibility();
3419
- const hasResponded = useSeamlyHasUserResponded();
4078
+ const hasResponded = useUserHasResponded();
3420
4079
  const hasConversation = useSeamlyHasConversation();
3421
4080
  const unreadMessageCount = useSeamlyUnreadCount();
3422
4081
  const isVisible = visible ? visible !== visibilityStates.hidden : false;
@@ -3478,7 +4137,7 @@ const use_seamly_visibility_useSeamlyVisibility = () => {
3478
4137
 
3479
4138
  const {
3480
4139
  SET_IS_LOADING: use_seamly_chat_SET_IS_LOADING
3481
- } = seamlyActions;
4140
+ } = seamly_utils_seamlyActions;
3482
4141
 
3483
4142
  const useSeamlyChat = () => {
3484
4143
  const {
@@ -3622,7 +4281,7 @@ const {
3622
4281
  INIT_IDLE_DETACH_COUNTDOWN: use_seamly_idle_detach_countdown_INIT_IDLE_DETACH_COUNTDOWN,
3623
4282
  DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER: use_seamly_idle_detach_countdown_DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER,
3624
4283
  STOP_IDLE_DETACH_COUNTDOWN_COUNTER: use_seamly_idle_detach_countdown_STOP_IDLE_DETACH_COUNTDOWN_COUNTER
3625
- } = seamlyActions;
4284
+ } = seamly_utils_seamlyActions;
3626
4285
 
3627
4286
  const useSeamlyIdleDetachCountdown = () => {
3628
4287
  const dispatch = useSeamlyDispatchContext();
@@ -3764,7 +4423,7 @@ const useSeamlyIdleDetachCountdown = () => {
3764
4423
 
3765
4424
  const {
3766
4425
  CLEAR_RESUME_CONVERSATION_PROMPT: use_seamly_resume_conversation_prompt_CLEAR_RESUME_CONVERSATION_PROMPT
3767
- } = seamlyActions;
4426
+ } = seamly_utils_seamlyActions;
3768
4427
 
3769
4428
  const useSeamlyResumeConversationPrompt = () => {
3770
4429
  const dispatch = useSeamlyDispatchContext();
@@ -3832,7 +4491,6 @@ const useSeamlyResumeConversationPrompt = () => {
3832
4491
 
3833
4492
 
3834
4493
 
3835
-
3836
4494
  // This hook isn't used within the core
3837
4495
  // But it is used in implementations
3838
4496
  // and imported directly from this file
@@ -3947,6 +4605,123 @@ function hooks_useTranslationsContainer() {
3947
4605
  focusContainer
3948
4606
  };
3949
4607
  }
4608
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/middleware.js
4609
+
4610
+
4611
+
4612
+ function translations_middleware_createMiddleware() {
4613
+ return ({
4614
+ dispatch,
4615
+ getState
4616
+ }) => next => action => {
4617
+ var _action$history, _action$history$trans, _action$initialState, _action$initialState$, _action$event, _action$event$payload, _action$event$payload2;
4618
+
4619
+ const result = next(action);
4620
+
4621
+ switch (action.type) {
4622
+ case String(seamlyActions.SET_HISTORY):
4623
+ if ((_action$history = action.history) !== null && _action$history !== void 0 && (_action$history$trans = _action$history.translation) !== null && _action$history$trans !== void 0 && _action$history$trans.enabled) {
4624
+ dispatch(Actions.enable(action.history.translation.locale));
4625
+ }
4626
+
4627
+ break;
4628
+
4629
+ case String(seamlyActions.SET_INITIAL_STATE):
4630
+ if ((_action$initialState = action.initialState) !== null && _action$initialState !== void 0 && (_action$initialState$ = _action$initialState.translation) !== null && _action$initialState$ !== void 0 && _action$initialState$.enabled) {
4631
+ dispatch(Actions.enable(action.initialState.translation.locale));
4632
+ dispatch(I18nActions.setLocale(action.locale));
4633
+ }
4634
+
4635
+ break;
4636
+
4637
+ case String(seamlyActions.ADD_EVENT):
4638
+ if (action.event.type === 'info' && ((_action$event = action.event) === null || _action$event === void 0 ? void 0 : (_action$event$payload = _action$event.payload) === null || _action$event$payload === void 0 ? void 0 : (_action$event$payload2 = _action$event$payload.body) === null || _action$event$payload2 === void 0 ? void 0 : _action$event$payload2.subtype) === 'new_translation' && action.event.payload.body.translationEnabled) {
4639
+ dispatch(I18nActions.setLocale(action.event.payload.body.translationLocale));
4640
+ }
4641
+
4642
+ break;
4643
+
4644
+ case String(Actions.disable):
4645
+ const initialLocale = I18nSelectors.selectInitialLocale(getState());
4646
+ dispatch(I18nActions.setLocale(initialLocale));
4647
+ break;
4648
+ }
4649
+
4650
+ return result;
4651
+ };
4652
+ }
4653
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/reducer.js
4654
+ function translations_reducer_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; }
4655
+
4656
+ function translations_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { translations_reducer_ownKeys(Object(source), true).forEach(function (key) { translations_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { translations_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4657
+
4658
+ function translations_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4659
+
4660
+
4661
+
4662
+
4663
+
4664
+ const translations_reducer_initialState = {
4665
+ isActive: false,
4666
+ currentLocale: undefined,
4667
+ isAvailable: false,
4668
+ languages: [],
4669
+ originalPayloadIds: [],
4670
+ containerId: id_randomId()
4671
+ };
4672
+ /* harmony default export */ const translations_reducer = (translations_utils_createReducer({
4673
+ [seamly_utils_seamlyActions.SET_FEATURES]: (state, action) => {
4674
+ var _action$features;
4675
+
4676
+ const feature = action === null || action === void 0 ? void 0 : (_action$features = action.features) === null || _action$features === void 0 ? void 0 : _action$features.translation;
4677
+
4678
+ if (!feature) {
4679
+ return state;
4680
+ }
4681
+
4682
+ return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
4683
+ isAvailable: feature.enabled === true,
4684
+ languages: feature.languages || []
4685
+ });
4686
+ },
4687
+ [seamly_utils_seamlyActions.CLEAR_FEATURES]: () => translations_reducer_initialState,
4688
+ [enable]: (state, {
4689
+ locale
4690
+ }) => {
4691
+ return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
4692
+ isActive: true,
4693
+ currentLocale: locale
4694
+ });
4695
+ },
4696
+ [disable]: state => {
4697
+ return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
4698
+ isActive: false,
4699
+ currentLocale: undefined
4700
+ });
4701
+ },
4702
+ [enableEvent]: (state, {
4703
+ payloadId
4704
+ }) => {
4705
+ if (!state.originalPayloadIds.includes(payloadId)) {
4706
+ return state;
4707
+ }
4708
+
4709
+ return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
4710
+ originalPayloadIds: state.originalPayloadIds.filter(id => id !== payloadId)
4711
+ });
4712
+ },
4713
+ [disableEvent]: (state, {
4714
+ payloadId
4715
+ }) => {
4716
+ if (state.originalPayloadIds.includes(payloadId)) {
4717
+ return state;
4718
+ }
4719
+
4720
+ return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
4721
+ originalPayloadIds: [...state.originalPayloadIds, payloadId]
4722
+ });
4723
+ }
4724
+ }, translations_reducer_initialState));
3950
4725
  ;// CONCATENATED MODULE: ./src/javascripts/lib/css.js
3951
4726
 
3952
4727
  /**
@@ -4275,6 +5050,35 @@ function form_Form(_ref) {
4275
5050
  }
4276
5051
 
4277
5052
  /* harmony default export */ const form_controls_form = ((/* unused pure expression or super */ null && (form_Form)));
5053
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/form-controls/error.js
5054
+
5055
+
5056
+
5057
+
5058
+
5059
+ function error_Error({
5060
+ id,
5061
+ error
5062
+ }) {
5063
+ const [isAvailable, setIsAvailable] = useState(false);
5064
+ useEffect(() => {
5065
+ const timerId = setTimeout(() => setIsAvailable(true), 300); // 300 = magic number, could be less or more
5066
+
5067
+ return () => clearTimeout(timerId); // clear timer if error is mounted+unmounted within 300
5068
+ }, []);
5069
+ return _jsx("div", {
5070
+ "aria-live": "assertive",
5071
+ "aria-atomic": "true",
5072
+ children: isAvailable && error && _jsxs("span", {
5073
+ id: id,
5074
+ className: className('error'),
5075
+ children: [_jsx(Icon, {
5076
+ name: "error",
5077
+ size: "16"
5078
+ }), error]
5079
+ })
5080
+ });
5081
+ }
4278
5082
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/form-controls/wrapper.js
4279
5083
 
4280
5084
 
@@ -4300,17 +5104,9 @@ const wrapper_FormControlWrapper = ({
4300
5104
  id: `${id}-content-hint`,
4301
5105
  className: className('input__content-hint'),
4302
5106
  children: contentHint
4303
- }), _jsx("div", {
4304
- "aria-live": "assertive",
4305
- "aria-atomic": "true",
4306
- children: !validity && _jsxs("span", {
4307
- id: `${id}-error`,
4308
- className: className('error'),
4309
- children: [_jsx(Icon, {
4310
- name: "error",
4311
- size: "16"
4312
- }), errorText]
4313
- })
5107
+ }), _jsx(Error, {
5108
+ id: `${id}-error`,
5109
+ error: !validity && errorText
4314
5110
  }), children]
4315
5111
  });
4316
5112
  };
@@ -4411,6 +5207,9 @@ function form_TranslationsOptionsDialogForm({
4411
5207
  languages,
4412
5208
  currentLocale
4413
5209
  } = useTranslations();
5210
+ const {
5211
+ locale: uiLocale
5212
+ } = useI18n();
4414
5213
  const languageName = useMemo(() => {
4415
5214
  var _languages$find;
4416
5215
 
@@ -4420,11 +5219,11 @@ function form_TranslationsOptionsDialogForm({
4420
5219
  return [{
4421
5220
  value: '',
4422
5221
  label: t('translations.settings.defaultOptionLabel')
4423
- }, ...languages.map(language => ({
5222
+ }, ...languages.filter(language => language.locale.toLowerCase() !== String(uiLocale).toLowerCase()).map(language => ({
4424
5223
  value: language.locale,
4425
5224
  label: language.nativeName
4426
5225
  }))];
4427
- }, [t, languages]);
5226
+ }, [t, languages, uiLocale]);
4428
5227
  return _jsxs(Form, {
4429
5228
  noValidate: "true",
4430
5229
  children: [_jsx("p", {
@@ -4807,6 +5606,7 @@ function chat_status_ChatStatus({
4807
5606
 
4808
5607
 
4809
5608
 
5609
+
4810
5610
  function TranslationsChatStatus() {
4811
5611
  const {
4812
5612
  t
@@ -4816,7 +5616,7 @@ function TranslationsChatStatus() {
4816
5616
  } = useTranslationsContainer();
4817
5617
  const {
4818
5618
  hasInterrupt
4819
- } = useSeamlyInterrupt();
5619
+ } = useInterrupt();
4820
5620
  const {
4821
5621
  isActive,
4822
5622
  disableTranslations,
@@ -4841,7 +5641,9 @@ function TranslationsChatStatus() {
4841
5641
  return _jsx(ChatStatus, {
4842
5642
  type: "translations",
4843
5643
  id: id,
4844
- label: t('translations.status.label', languageName),
5644
+ label: t('translations.status.label', {
5645
+ language: languageName
5646
+ }),
4845
5647
  onButtonClick: handleClickStop,
4846
5648
  buttonText: t('translations.status.stopText'),
4847
5649
  srButtonText: t('translations.status.srStopText')
@@ -4855,8 +5657,9 @@ function TranslationsChatStatus() {
4855
5657
 
4856
5658
 
4857
5659
 
5660
+
4858
5661
  ;// CONCATENATED MODULE: ./src/javascripts/style-guide/components/static-core.js
4859
- const static_core_excluded = ["translations"];
5662
+ const static_core_excluded = ["translations", "interrupt", "config"];
4860
5663
 
4861
5664
  function static_core_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = static_core_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4862
5665
 
@@ -4869,6 +5672,9 @@ function static_core_objectWithoutPropertiesLoose(source, excluded) { if (source
4869
5672
 
4870
5673
 
4871
5674
 
5675
+
5676
+
5677
+
4872
5678
  const bareApi = {
4873
5679
  send: () => {},
4874
5680
  reset: () => {
@@ -4882,6 +5688,7 @@ const bareApi = {
4882
5688
 
4883
5689
  const SeamlyTestCore = ({
4884
5690
  state,
5691
+ translations,
4885
5692
  children
4886
5693
  }) => {
4887
5694
  const liveMsgRef = (0,hooks_namespaceObject.useRef)(() => {});
@@ -4891,20 +5698,32 @@ const SeamlyTestCore = ({
4891
5698
  const store = (0,hooks_namespaceObject.useMemo)(() => {
4892
5699
  const _ref = state || {},
4893
5700
  {
4894
- translations: translationsSlice
5701
+ translations: translationsSlice,
5702
+ interrupt: interruptSlice,
5703
+ config: configSlice
4895
5704
  } = _ref,
4896
5705
  restState = static_core_objectWithoutProperties(_ref, static_core_excluded);
4897
5706
 
4898
- return (0,web_ui_namespaceObject.createReduxStore)({
4899
- state: stateReducer,
4900
- [String(reducer)]: reducer,
4901
- [String(translations_reducer)]: translations_reducer,
4902
- [String(Reducer)]: Reducer
4903
- }, {
4904
- state: restState,
4905
- translations: translationsSlice
5707
+ const newStore = (0,web_ui_namespaceObject.createReduxStore)({
5708
+ reducers: {
5709
+ state: stateReducer,
5710
+ [String(app_reducer)]: app_reducer,
5711
+ [String(config_reducer)]: config_reducer,
5712
+ [String(reducer)]: reducer,
5713
+ [String(translations_reducer)]: translations_reducer,
5714
+ [String(i18n_reducer)]: i18n_reducer,
5715
+ [String(interrupt_reducer)]: interrupt_reducer
5716
+ },
5717
+ initialState: {
5718
+ state: restState,
5719
+ [String(translations_reducer)]: translationsSlice,
5720
+ [String(interrupt_reducer)]: interruptSlice
5721
+ }
4906
5722
  });
4907
- }, [state]);
5723
+ newStore.dispatch(initialize(configSlice || {}));
5724
+ newStore.dispatch(setLocaleResolve('en-GB', translations));
5725
+ return newStore;
5726
+ }, [state, translations]);
4908
5727
  return state && (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.StoreProvider, {
4909
5728
  store: store,
4910
5729
  children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.SeamlyEventBusContext.Provider, {
@@ -5043,7 +5862,8 @@ const baseState = {
5043
5862
  layoutMode: 'inline',
5044
5863
  accountConfig: {},
5045
5864
  hideOnNoUserResponse: false,
5046
- showFaq: false
5865
+ showFaq: false,
5866
+ showDisclaimer: false
5047
5867
  },
5048
5868
  initialState: {},
5049
5869
  unreadEvents: 0,
@@ -5066,14 +5886,12 @@ const baseState = {
5066
5886
  subTitle: 'Test subtitle'
5067
5887
  },
5068
5888
  interrupt: {
5069
- hasInterrupt: false,
5070
- meta: {}
5889
+ error: undefined
5071
5890
  },
5072
5891
  historyLoaded: false,
5073
5892
  skiplinkTargetId: (0,web_ui_namespaceObject.randomId)(),
5074
5893
  optionsButtonId: (0,web_ui_namespaceObject.randomId)(),
5075
5894
  cobrowseContainerId: (0,web_ui_namespaceObject.randomId)(),
5076
- showDisclaimer: false,
5077
5895
  serviceData: {},
5078
5896
  options: {
5079
5897
  features: {},
@@ -5557,7 +6375,7 @@ const imageMessage = {
5557
6375
  description: 'Plaatje',
5558
6376
  isZoomable: false,
5559
6377
  type: 'image',
5560
- url: 'https://via.placeholder.com/150'
6378
+ url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg'
5561
6379
  },
5562
6380
  fromClient: false,
5563
6381
  fromHistory: true,
@@ -5585,7 +6403,7 @@ const imageMessageWithLightbox = {
5585
6403
  description: 'Plaatje',
5586
6404
  isZoomable: true,
5587
6405
  type: 'image',
5588
- url: 'https://via.placeholder.com/150'
6406
+ url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-portrait.jpg'
5589
6407
  },
5590
6408
  fromClient: false,
5591
6409
  fromHistory: true,
@@ -5731,10 +6549,9 @@ const fileDownloadPayload = {
5731
6549
  meta: {},
5732
6550
  body: {
5733
6551
  contentType: 'image/jpg',
5734
- deleteAt: 1000 * (Date.now() + 3600000),
5735
6552
  filename: 'placeholder.jpg',
5736
6553
  filesize: 991078,
5737
- url: 'https://via.placeholder.com/150'
6554
+ url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg'
5738
6555
  }
5739
6556
  };
5740
6557
  const fileDownloadAgentMessage = {
@@ -5748,9 +6565,7 @@ const fileDownloadAgentMessage = {
5748
6565
 
5749
6566
  const deletedFileDownloadAgentMessage = states_objectSpread(states_objectSpread({}, fileDownloadAgentMessage), {}, {
5750
6567
  payload: states_objectSpread(states_objectSpread({}, fileDownloadAgentMessage.payload), {}, {
5751
- body: states_objectSpread(states_objectSpread({}, fileDownloadAgentMessage.payload.body), {}, {
5752
- deleteAt: 1000 * (Date.now() - 3600000)
5753
- }),
6568
+ body: states_objectSpread({}, fileDownloadAgentMessage.payload.body),
5754
6569
  id: (0,web_ui_namespaceObject.randomId)()
5755
6570
  })
5756
6571
  });
@@ -5764,16 +6579,6 @@ const fileDownloadUserMessage = {
5764
6579
  })
5765
6580
  };
5766
6581
 
5767
- const deletedFileDownloadUserMessage = states_objectSpread(states_objectSpread({}, fileDownloadUserMessage), {}, {
5768
- payload: states_objectSpread(states_objectSpread({
5769
- id: (0,web_ui_namespaceObject.randomId)()
5770
- }, fileDownloadUserMessage.payload), {}, {
5771
- body: states_objectSpread(states_objectSpread({}, fileDownloadUserMessage.payload.body), {}, {
5772
- deleteAt: 1000 * (Date.now() - 3600000)
5773
- })
5774
- })
5775
- });
5776
-
5777
6582
  const emptyUrlFileDownloadUserMessage = states_objectSpread(states_objectSpread({}, fileDownloadUserMessage), {}, {
5778
6583
  payload: states_objectSpread(states_objectSpread({}, fileDownloadUserMessage.payload), {}, {
5779
6584
  id: (0,web_ui_namespaceObject.randomId)(),
@@ -5874,7 +6679,7 @@ const cardAskText = {
5874
6679
  },
5875
6680
  buttonText: 'Ask about pizzas!',
5876
6681
  description: 'Pizza Margherita is a **typical Neapolitan pizza**.\n\nIt is made with San Marzano tomatoes, mozzarella cheese, fresh basil, salt, and extra-virgin olive oil.',
5877
- image: 'https://via.placeholder.com/400x200/dee3e5/6a7f8c?text=Margherita',
6682
+ image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-square.jpg',
5878
6683
  title: 'Pizza Margherita'
5879
6684
  }
5880
6685
  }
@@ -5892,7 +6697,7 @@ const cardNavigate = {
5892
6697
  },
5893
6698
  buttonText: 'Order now!',
5894
6699
  description: 'Pizza Margherita is a **typical Neapolitan pizza**.',
5895
- image: 'https://via.placeholder.com/400x200/dee3e5/6a7f8c?text=Margherita',
6700
+ image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-landscape.jpg',
5896
6701
  title: 'Pizza Margherita'
5897
6702
  }
5898
6703
  }
@@ -5908,7 +6713,7 @@ const cardTopic = {
5908
6713
  type: 'topic'
5909
6714
  },
5910
6715
  buttonText: 'Set topic! (title & description optional)',
5911
- image: 'https://via.placeholder.com/400x200/dee3e5/6a7f8c?text=Margherita'
6716
+ image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-portrait.jpg'
5912
6717
  }
5913
6718
  }
5914
6719
  };
@@ -5933,7 +6738,7 @@ const standardState = {
5933
6738
  payload: states_objectSpread(states_objectSpread({}, choicePromptMessage.payload), {}, {
5934
6739
  id: `${choicePromptMessage.payload.id}XXX`
5935
6740
  })
5936
- }), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, deletedFileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage]
6741
+ }), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage]
5937
6742
  }),
5938
6743
  userMessages: states_objectSpread(states_objectSpread({
5939
6744
  category: categoryKeys.messages,
@@ -5941,7 +6746,7 @@ const standardState = {
5941
6746
  description: ''
5942
6747
  }, baseState), {}, {
5943
6748
  participantInfo,
5944
- events: [userMessage, userMessageLong, fileDownloadUserMessage, deletedFileDownloadUserMessage, emptyUrlFileDownloadUserMessage]
6749
+ events: [userMessage, userMessageLong, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage]
5945
6750
  }),
5946
6751
  withParticipants: states_objectSpread(states_objectSpread({
5947
6752
  category: categoryKeys.messages,
@@ -6153,12 +6958,7 @@ const standardState = {
6153
6958
  description: ''
6154
6959
  }, baseState), {}, {
6155
6960
  interrupt: {
6156
- hasInterrupt: true,
6157
- meta: {
6158
- title: 'Connection issues',
6159
- message: 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
6160
- srText: 'The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.'
6161
- }
6961
+ error: new web_ui_namespaceObject.SeamlyOfflineError()
6162
6962
  }
6163
6963
  }),
6164
6964
  generalErrorInterrupt: states_objectSpread(states_objectSpread({
@@ -6168,14 +6968,7 @@ const standardState = {
6168
6968
  description: ''
6169
6969
  }, baseState), {}, {
6170
6970
  interrupt: {
6171
- hasInterrupt: true,
6172
- meta: {
6173
- title: 'Something went wrong',
6174
- message: 'Do you want to start a new chat session?',
6175
- buttonText: 'Restart chat',
6176
- action: 'reset',
6177
- srText: 'Something went wrong with the chat session. You can restart the chat.'
6178
- }
6971
+ error: new web_ui_namespaceObject.SeamlyGeneralError()
6179
6972
  }
6180
6973
  }),
6181
6974
  configErrorInterrupt: states_objectSpread(states_objectSpread({
@@ -6185,12 +6978,7 @@ const standardState = {
6185
6978
  description: ''
6186
6979
  }, baseState), {}, {
6187
6980
  interrupt: {
6188
- hasInterrupt: true,
6189
- meta: {
6190
- title: 'Chat configuration error.',
6191
- message: 'We are sorry this happened, please retry at a later time.',
6192
- srText: 'A chat configuration error occurred. Our apologies, please retry at a later time.'
6193
- }
6981
+ error: new web_ui_namespaceObject.SeamlyConfigurationError()
6194
6982
  }
6195
6983
  }),
6196
6984
  privacyDisclaimer: states_objectSpread(states_objectSpread({
@@ -6200,12 +6988,11 @@ const standardState = {
6200
6988
  }, baseState), {}, {
6201
6989
  config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
6202
6990
  showDisclaimer: true
6203
- }),
6204
- showDisclaimer: true
6991
+ })
6205
6992
  }),
6206
- cobrowserBar: states_objectSpread(states_objectSpread({
6993
+ chatStatusBar: states_objectSpread(states_objectSpread({
6207
6994
  category: categoryKeys.features,
6208
- headingText: `Cobrowse bar`,
6995
+ headingText: `Chat status bar`,
6209
6996
  description: ''
6210
6997
  }, baseState), {}, {
6211
6998
  options: {
@@ -6743,7 +7530,7 @@ const standardState = {
6743
7530
  payload: states_objectSpread(states_objectSpread({}, choicePromptMessage.payload), {}, {
6744
7531
  id: `${choicePromptMessage.payload.id}XXX`
6745
7532
  })
6746
- }), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, newTranslationDividerStart, newTranslationDividerStop, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, deletedFileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage].map(addTranslationData),
7533
+ }), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, newTranslationDividerStart, newTranslationDividerStop, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage].map(addTranslationData),
6747
7534
  translations: states_objectSpread(states_objectSpread({}, translationsSlice), {}, {
6748
7535
  currentLocale: 'nl',
6749
7536
  isActive: true,
@@ -6976,6 +7763,7 @@ function app_defineProperty(obj, key, value) { if (key in obj) { Object.definePr
6976
7763
  const StyleGuideApp = ({
6977
7764
  config,
6978
7765
  styleGuideConfig,
7766
+ translations,
6979
7767
  headingLevel = 2
6980
7768
  }) => {
6981
7769
  const [staticState, setStaticState] = (0,hooks_namespaceObject.useState)(null);
@@ -7003,7 +7791,6 @@ const StyleGuideApp = ({
7003
7791
  }, [setStaticState, stateUpdateCallback]);
7004
7792
  const getState = (0,hooks_namespaceObject.useCallback)((layoutMode, feature) => {
7005
7793
  const {
7006
- showDisclaimer,
7007
7794
  defaults
7008
7795
  } = config;
7009
7796
  const {
@@ -7020,14 +7807,13 @@ const StyleGuideApp = ({
7020
7807
  } = defaults || {};
7021
7808
 
7022
7809
  const updatedState = app_objectSpread(app_objectSpread({}, bareState), {}, {
7023
- config: app_objectSpread(app_objectSpread(app_objectSpread(app_objectSpread({}, bareState.config), (0,web_ui_namespaceObject.getSeamlyConfig)(config)), {}, {
7810
+ config: app_objectSpread(app_objectSpread(app_objectSpread(app_objectSpread({}, bareState.config), config), {}, {
7024
7811
  layoutMode: bareState.config.layoutMode
7025
7812
  }, overrideMessages ? {
7026
7813
  messages: overrideMessages
7027
7814
  } : {}), {}, {
7028
7815
  showFaq
7029
7816
  }),
7030
- showDisclaimer: showDisclaimer != null ? showDisclaimer : bareState.showDisclaimer,
7031
7817
  headerTitles: app_objectSpread(app_objectSpread({}, bareState.headerTitles), {}, {
7032
7818
  subTitle: agentName || bareState.headerTitles.subTitle
7033
7819
  })
@@ -7109,7 +7895,7 @@ const StyleGuideApp = ({
7109
7895
  }), (0,jsx_runtime_namespaceObject.jsx)("div", {
7110
7896
  children: showStyleGuide && (0,jsx_runtime_namespaceObject.jsx)(view, {
7111
7897
  customComponents: styleGuideConfig.customComponents,
7112
- translations: config.translations,
7898
+ translations: translations,
7113
7899
  state: staticState
7114
7900
  })
7115
7901
  })]
@@ -7146,7 +7932,6 @@ function style_guide_engine_objectWithoutPropertiesLoose(source, excluded) { if
7146
7932
 
7147
7933
 
7148
7934
 
7149
-
7150
7935
  class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
7151
7936
  constructor(_ref, externalApi) {
7152
7937
  let {
@@ -7158,23 +7943,28 @@ class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
7158
7943
  this.styleGuideConfig = styleGuideConfig || {};
7159
7944
  }
7160
7945
 
7161
- render() {
7162
- const restComponents = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.customComponents || {}), {}, {
7946
+ async render() {
7947
+ const restComponents = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config.customComponents || {}), {}, {
7163
7948
  view: undefined
7164
7949
  });
7165
7950
 
7951
+ const api = new web_ui_namespaceObject.API({
7952
+ namespace: this.config.namespace,
7953
+ config: this.config.api
7954
+ });
7955
+ api.URLS = {
7956
+ translations: '/client/wilson/translations/{version}/{locale}.json'
7957
+ };
7958
+ const translations = await api.getTranslations('en-GB');
7959
+
7166
7960
  const renderConfig = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config), {}, {
7167
- customComponents: Object.keys(restComponents).length ? restComponents : undefined,
7168
- translations: this.config.translations || style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, (en_default())), {}, {
7169
- disclaimer: style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, (en_default()).disclaimer), {}, {
7170
- content: 'This chat session will be saved to help us improve our service delivery. <a href="https://seamly.ai/">More information</a>'
7171
- })
7172
- })
7961
+ customComponents: Object.keys(restComponents).length ? restComponents : undefined
7173
7962
  });
7174
7963
 
7175
7964
  (0,external_preact_namespaceObject.render)((0,jsx_runtime_namespaceObject.jsx)(app, {
7176
7965
  config: renderConfig,
7177
- styleGuideConfig: this.styleGuideConfig
7966
+ styleGuideConfig: this.styleGuideConfig,
7967
+ translations: translations
7178
7968
  }), this.parentElement);
7179
7969
  }
7180
7970