@seamly/web-ui 18.1.1 → 18.3.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.
- package/build/dist/lib/index.debug.js +286 -99
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +84 -16
- package/build/dist/lib/index.js +4104 -3887
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +4351 -4084
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +746 -641
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/build/dist/lib/utils.js +0 -1
- package/build/dist/lib/utils.min.js +1 -1
- package/build/dist/translations/de-informal.js +0 -1
- package/build/dist/translations/de-informal.min.js +1 -1
- package/build/dist/translations/en.js +0 -1
- package/build/dist/translations/en.min.js +1 -1
- package/build/dist/translations/es-informal.js +0 -1
- package/build/dist/translations/es-informal.min.js +1 -1
- package/build/dist/translations/nl-formal.js +0 -1
- package/build/dist/translations/nl-formal.min.js +1 -1
- package/build/dist/translations/nl-informal.js +0 -1
- package/build/dist/translations/nl-informal.min.js +1 -1
- package/package.json +4 -2
- package/src/javascripts/api/index.js +9 -9
- package/src/javascripts/api/producer.js +8 -8
- package/src/javascripts/config.js +9 -11
- package/src/javascripts/domains/app/actions.js +25 -0
- package/src/javascripts/domains/app/index.js +3 -0
- package/src/javascripts/domains/config/actions.js +6 -0
- package/src/javascripts/domains/config/hooks.js +6 -0
- package/src/javascripts/domains/config/index.js +8 -0
- package/src/javascripts/domains/config/middleware.js +26 -0
- package/src/javascripts/domains/config/reducer.js +74 -0
- package/src/javascripts/domains/config/selectors.js +23 -0
- package/src/javascripts/domains/forms/actions.js +1 -1
- package/src/javascripts/domains/forms/hooks.js +10 -14
- package/src/javascripts/domains/forms/provider.js +4 -6
- package/src/javascripts/domains/forms/selectors.js +3 -3
- package/src/javascripts/domains/i18n/index.js +9 -5
- package/src/javascripts/domains/interrupt/actions.js +6 -0
- package/src/javascripts/domains/interrupt/hooks.js +29 -0
- package/src/javascripts/domains/interrupt/index.js +9 -0
- package/src/javascripts/domains/interrupt/middleware.js +30 -0
- package/src/javascripts/domains/interrupt/reducer.js +22 -0
- package/src/javascripts/domains/interrupt/selectors.js +5 -0
- package/src/javascripts/domains/options/index.js +1 -0
- package/src/javascripts/domains/options/middleware.js +35 -0
- package/src/javascripts/domains/redux/create-redux-store.js +14 -6
- package/src/javascripts/domains/redux/hooks.js +2 -2
- package/src/javascripts/domains/redux/index.js +2 -1
- package/src/javascripts/domains/redux/provider.js +5 -0
- package/src/javascripts/domains/store/index.js +38 -0
- package/src/javascripts/{ui → domains}/store/state-reducer.js +4 -7
- package/src/javascripts/domains/translations/actions.js +3 -3
- package/src/javascripts/domains/translations/components/chat-status.js +6 -12
- package/src/javascripts/domains/translations/components/options-button.js +3 -3
- package/src/javascripts/domains/translations/components/options-dialog/form.js +2 -2
- package/src/javascripts/domains/translations/components/options-dialog/index.js +2 -5
- package/src/javascripts/domains/translations/hooks.js +1 -1
- package/src/javascripts/domains/translations/reducer.js +2 -2
- package/src/javascripts/domains/translations/selectors.js +2 -2
- package/src/javascripts/index.js +17 -5
- package/src/javascripts/lib/css.js +5 -5
- package/src/javascripts/lib/engine/index.js +38 -11
- package/src/javascripts/lib/external-api/index.js +6 -6
- package/src/javascripts/lib/i18n.js +2 -2
- package/src/javascripts/lib/parse-body.js +1 -1
- package/src/javascripts/lib/redux-helpers/index.js +18 -4
- package/src/javascripts/lib/split-url-params.js +2 -2
- package/src/javascripts/lib/store/providers/app-storage.js +1 -1
- package/src/javascripts/lib/store/providers/cookie-storage.js +1 -1
- package/src/javascripts/package/utils.js +0 -1
- package/src/javascripts/style-guide/components/app.js +5 -12
- package/src/javascripts/style-guide/components/links.js +6 -6
- package/src/javascripts/style-guide/components/static-core.js +23 -7
- package/src/javascripts/style-guide/state-helpers/index.js +1 -1
- package/src/javascripts/style-guide/states.js +27 -67
- package/src/javascripts/style-guide/style-guide-engine.js +1 -1
- package/src/javascripts/ui/components/chat-app.js +2 -2
- package/src/javascripts/ui/components/conversation/component-filter.js +2 -2
- package/src/javascripts/ui/components/conversation/conversation.js +2 -2
- package/src/javascripts/ui/components/conversation/event/card-component.js +29 -4
- package/src/javascripts/ui/components/conversation/event/carousel-component/components/pagination.js +2 -2
- package/src/javascripts/ui/components/conversation/event/carousel-component/index.js +4 -3
- package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js +2 -1
- package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +2 -2
- package/src/javascripts/ui/components/conversation/event/choice-prompt.js +11 -6
- package/src/javascripts/ui/components/conversation/event/cta.js +1 -6
- package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +1 -1
- package/src/javascripts/ui/components/conversation/event/event-participant.js +3 -5
- package/src/javascripts/ui/components/conversation/event/hooks/use-event-link-click-handler.js +2 -2
- package/src/javascripts/ui/components/conversation/event/hooks/use-formatted-date.js +3 -3
- package/src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js +3 -3
- package/src/javascripts/ui/components/conversation/event/participant.js +2 -2
- package/src/javascripts/ui/components/conversation/event/upload.js +12 -27
- package/src/javascripts/ui/components/conversation/message-container.js +4 -6
- package/src/javascripts/ui/components/core/seamly-activity-monitor.js +4 -5
- package/src/javascripts/ui/components/core/seamly-core.js +6 -7
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +16 -17
- package/src/javascripts/ui/components/core/seamly-file-upload.js +5 -6
- package/src/javascripts/ui/components/core/seamly-idle-detach-counter.js +2 -6
- package/src/javascripts/ui/components/core/seamly-initializer.js +7 -60
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +10 -10
- package/src/javascripts/ui/components/core/seamly-live-region.js +1 -1
- package/src/javascripts/ui/components/core/seamly-new-notifications.js +1 -1
- package/src/javascripts/ui/components/core/seamly-read-state.js +2 -2
- package/src/javascripts/ui/components/entry/entry-container.js +7 -10
- package/src/javascripts/ui/components/entry/toggle-button.js +24 -10
- package/src/javascripts/ui/components/entry/upload/index.js +4 -11
- package/src/javascripts/ui/components/faq/faq.js +4 -4
- package/src/javascripts/ui/components/form-controls/error.js +22 -0
- package/src/javascripts/ui/components/form-controls/file-input.js +3 -9
- package/src/javascripts/ui/components/form-controls/select.js +1 -1
- package/src/javascripts/ui/components/form-controls/wrapper.js +2 -9
- package/src/javascripts/ui/components/layout/agent-info.js +4 -4
- package/src/javascripts/ui/components/layout/app-frame.js +5 -5
- package/src/javascripts/ui/components/layout/chat-frame.js +3 -5
- package/src/javascripts/ui/components/layout/header.js +4 -18
- package/src/javascripts/ui/components/layout/privacy-disclaimer.js +2 -2
- package/src/javascripts/ui/components/options/cobrowsing.js +3 -7
- package/src/javascripts/ui/components/options/options-button.js +9 -13
- package/src/javascripts/ui/components/options/options-frame.js +1 -1
- package/src/javascripts/ui/components/options/transcript/index.js +2 -2
- package/src/javascripts/ui/components/options/transcript/transcript-form.js +1 -1
- package/src/javascripts/ui/components/warnings/cobrowsing-active-frame.js +3 -6
- package/src/javascripts/ui/components/warnings/idle-detach-warning.js +2 -6
- package/src/javascripts/ui/components/widgets/in-out-transition.js +2 -2
- package/src/javascripts/ui/components/widgets/lightbox.js +4 -4
- package/src/javascripts/ui/components/widgets/modal.js +3 -3
- package/src/javascripts/ui/components/widgets/upload-progress.js +2 -13
- package/src/javascripts/ui/hooks/component-helper-hooks.js +4 -15
- package/src/javascripts/ui/hooks/file-upload-hooks.js +3 -3
- package/src/javascripts/ui/hooks/focus-helper-hooks.js +4 -4
- package/src/javascripts/ui/hooks/live-region-hooks.js +2 -2
- package/src/javascripts/ui/hooks/seamly-entry-hooks.js +7 -6
- package/src/javascripts/ui/hooks/seamly-hooks.js +3 -9
- package/src/javascripts/ui/hooks/seamly-option-hooks.js +4 -4
- package/src/javascripts/ui/hooks/seamly-state-hooks.js +8 -16
- package/src/javascripts/ui/hooks/use-event-component-mapping.js +1 -1
- package/src/javascripts/ui/hooks/use-seamly-chat.js +1 -0
- package/src/javascripts/ui/hooks/use-seamly-commands.js +27 -49
- package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +3 -3
- package/src/javascripts/ui/hooks/use-seamly-stored-visibility.js +3 -3
- package/src/javascripts/ui/hooks/use-seamly-visibility.js +3 -3
- package/src/javascripts/ui/hooks/utility-hooks.js +2 -2
- package/src/javascripts/ui/utils/form-utils.js +3 -3
- package/src/javascripts/ui/utils/general-utils.js +17 -11
- package/src/javascripts/ui/utils/seamly-utils.js +15 -83
- package/src/javascripts/ui/utils/validations.js +10 -7
- package/src/stylesheets/5-components/_card.scss +0 -1
- package/src/stylesheets/5-components/_choice-prompt.scss +5 -0
- package/src/stylesheets/5-components/_message.scss +10 -0
- package/src/stylesheets/5-components/_options.scss +3 -2
- package/translations/de-informal.js +0 -2
- package/translations/en.js +0 -2
- package/translations/es-informal.js +0 -2
- package/translations/nl-formal.js +0 -2
- package/translations/nl-informal.js +0 -2
- package/webpack/config.common.js +3 -3
- package/webpack/config.package.js +4 -4
- package/webpack/config.site.js +8 -6
- package/CHANGELOG.md +0 -551
- package/src/javascripts/ui/components/core/seamly-api.js +0 -44
- package/src/javascripts/ui/hooks/use-seamly-interrupt.js +0 -62
- package/src/javascripts/ui/store/index.js +0 -37
|
@@ -67,45 +67,6 @@ const hooks_namespaceObject = require("preact/hooks");
|
|
|
67
67
|
function id_randomId() {
|
|
68
68
|
return '_' + (Number(String(Math.random()).slice(2)) + Date.now() + Math.round(performance.now())).toString(36);
|
|
69
69
|
}
|
|
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
70
|
;// CONCATENATED MODULE: ./src/javascripts/ui/utils/general-utils.js
|
|
110
71
|
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
72
|
|
|
@@ -290,14 +251,11 @@ const flattenObject = (obj, prefix = '') => Object.keys(obj).reduce((acc, k) =>
|
|
|
290
251
|
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
252
|
return acc;
|
|
292
253
|
}, {});
|
|
254
|
+
const pick = (obj, keys) => keys.reduce((accum, key) => {
|
|
255
|
+
if (key in obj) accum[key] = obj[key];
|
|
256
|
+
return accum;
|
|
257
|
+
}, {});
|
|
293
258
|
;// 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
259
|
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
260
|
|
|
303
261
|
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 +263,6 @@ function seamly_utils_objectSpread(target) { for (var i = 1; i < arguments.lengt
|
|
|
305
263
|
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
264
|
|
|
307
265
|
|
|
308
|
-
|
|
309
266
|
const eventTypes = {
|
|
310
267
|
info: 'info',
|
|
311
268
|
message: 'message',
|
|
@@ -364,13 +321,13 @@ const dividerKeys = {
|
|
|
364
321
|
new_topic: 'newTopic',
|
|
365
322
|
new_translation: 'newTranslation'
|
|
366
323
|
};
|
|
367
|
-
const
|
|
324
|
+
const featureKeys = {
|
|
368
325
|
cobrowsing: 'cobrowsing',
|
|
369
326
|
sendTranscript: 'sendTranscript',
|
|
370
327
|
typingPeekahead: 'typingPeekahead',
|
|
371
328
|
uploads: 'uploads'
|
|
372
329
|
};
|
|
373
|
-
const
|
|
330
|
+
const seamly_utils_seamlyActions = {
|
|
374
331
|
ADD_EVENT: 'ADD_EVENT',
|
|
375
332
|
CLEAR_EVENTS: 'CLEAR_EVENTS',
|
|
376
333
|
SET_HISTORY: 'SET_HISTORY',
|
|
@@ -381,12 +338,9 @@ const seamlyActions = {
|
|
|
381
338
|
SET_PARTICIPANT: 'SET_PARTICIPANT',
|
|
382
339
|
SET_HEADER_TITLE: 'SET_HEADER_TITLE',
|
|
383
340
|
SET_HEADER_SUB_TITLE: 'SET_HEADER_SUB_TITLE',
|
|
384
|
-
SET_INTERRUPT: ' SET_INTERRUPT',
|
|
385
|
-
CLEAR_INTERRUPT: 'CLEAR_INTERRUPT',
|
|
386
341
|
SET_VISIBILITY: 'SET_VISIBILITY',
|
|
387
342
|
RESET_HISTORY_LOADED_FLAG: 'RESET_HISTORY_LOADED_FLAG',
|
|
388
343
|
SET_ACTIVE_SERVICE: 'SET_ACTIVE_SERVICE',
|
|
389
|
-
SET_SHOW_DISCLAIMER: 'SET_SHOW_DISCLAIMER',
|
|
390
344
|
INIT_IDLE_DETACH_COUNTDOWN: 'INIT_IDLE_DETACH_COUNTDOWN',
|
|
391
345
|
DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER: 'DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER',
|
|
392
346
|
STOP_IDLE_DETACH_COUNTDOWN_COUNTER: 'STOP_IDLE_DETACH_COUNTDOWN_COUNTER',
|
|
@@ -394,7 +348,6 @@ const seamlyActions = {
|
|
|
394
348
|
INIT_RESUME_CONVERSATION_PROMPT: 'INIT_RESUME_CONVERSATION_PROMPT',
|
|
395
349
|
CLEAR_RESUME_CONVERSATION_PROMPT: 'CLEAR_RESUME_CONVERSATION_PROMPT',
|
|
396
350
|
SET_SERVICE_DATA_ITEM: 'SET_SERVICE_DATA_ITEM',
|
|
397
|
-
UPDATE_CONFIG: 'UPDATE_CONFIG',
|
|
398
351
|
SET_FEATURES: 'SET_FEATURES',
|
|
399
352
|
SET_FEATURE_ENABLED_STATE: 'SET_FEATURE_ENABLED_STATE',
|
|
400
353
|
CLEAR_FEATURES: 'CLEAR_FEATURES',
|
|
@@ -433,12 +386,9 @@ const {
|
|
|
433
386
|
SET_PARTICIPANT,
|
|
434
387
|
SET_HEADER_TITLE,
|
|
435
388
|
SET_HEADER_SUB_TITLE,
|
|
436
|
-
SET_INTERRUPT,
|
|
437
|
-
CLEAR_INTERRUPT,
|
|
438
389
|
SET_VISIBILITY,
|
|
439
390
|
RESET_HISTORY_LOADED_FLAG,
|
|
440
391
|
SET_ACTIVE_SERVICE,
|
|
441
|
-
SET_SHOW_DISCLAIMER,
|
|
442
392
|
INIT_IDLE_DETACH_COUNTDOWN,
|
|
443
393
|
DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER,
|
|
444
394
|
STOP_IDLE_DETACH_COUNTDOWN_COUNTER,
|
|
@@ -446,7 +396,6 @@ const {
|
|
|
446
396
|
INIT_RESUME_CONVERSATION_PROMPT,
|
|
447
397
|
CLEAR_RESUME_CONVERSATION_PROMPT,
|
|
448
398
|
SET_SERVICE_DATA_ITEM,
|
|
449
|
-
UPDATE_CONFIG,
|
|
450
399
|
SET_FEATURES,
|
|
451
400
|
SET_FEATURE_ENABLED_STATE,
|
|
452
401
|
CLEAR_FEATURES,
|
|
@@ -468,7 +417,7 @@ const {
|
|
|
468
417
|
RESET_UPLOAD_STATE,
|
|
469
418
|
RESET_ENTRY_STATE,
|
|
470
419
|
SET_SEAMLY_CONTAINER_ELEMENT
|
|
471
|
-
} =
|
|
420
|
+
} = seamly_utils_seamlyActions;
|
|
472
421
|
const isUnreadMessage = ({
|
|
473
422
|
type,
|
|
474
423
|
payload
|
|
@@ -554,25 +503,6 @@ const headerTitlesReducer = (state, action) => {
|
|
|
554
503
|
}
|
|
555
504
|
};
|
|
556
505
|
|
|
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
506
|
const calculateNewEntryMeta = (entryMeta, payload) => {
|
|
577
507
|
const {
|
|
578
508
|
entry
|
|
@@ -612,7 +542,7 @@ const seamlyStateReducer = (state, action) => {
|
|
|
612
542
|
type: eventType,
|
|
613
543
|
payload
|
|
614
544
|
} = action.event;
|
|
615
|
-
const accountHasUploads = state.options.features.hasOwnProperty(
|
|
545
|
+
const accountHasUploads = state.options.features.hasOwnProperty(featureKeys.uploads);
|
|
616
546
|
const newEntryMeta = calculateNewEntryMeta(state.entryMeta, payload);
|
|
617
547
|
|
|
618
548
|
let newOptions = seamly_utils_objectSpread({}, state.options); // This enabled override of the service enabled value for uploads.
|
|
@@ -740,7 +670,7 @@ const seamlyStateReducer = (state, action) => {
|
|
|
740
670
|
let newFeatures = seamly_utils_objectSpread({}, state.options.features); // Only set cobrowsing if it was initialised by the account config.
|
|
741
671
|
|
|
742
672
|
|
|
743
|
-
if (newFeatures.hasOwnProperty(
|
|
673
|
+
if (newFeatures.hasOwnProperty(featureKeys.cobrowsing)) {
|
|
744
674
|
newFeatures = seamly_utils_objectSpread(seamly_utils_objectSpread({}, newFeatures), {}, {
|
|
745
675
|
cobrowsing: {
|
|
746
676
|
enabled: !!(cobrowsing && cobrowsing.enabled)
|
|
@@ -748,7 +678,7 @@ const seamlyStateReducer = (state, action) => {
|
|
|
748
678
|
});
|
|
749
679
|
}
|
|
750
680
|
|
|
751
|
-
const newFeaturesHasUpload = newFeatures.hasOwnProperty(
|
|
681
|
+
const newFeaturesHasUpload = newFeatures.hasOwnProperty(featureKeys.uploads); // Only set uploads if it was initialised by the account config.
|
|
752
682
|
|
|
753
683
|
if (newFeaturesHasUpload) {
|
|
754
684
|
const {
|
|
@@ -892,22 +822,6 @@ const seamlyStateReducer = (state, action) => {
|
|
|
892
822
|
headerTitles: headerTitlesReducer(state.headerTitles, action)
|
|
893
823
|
});
|
|
894
824
|
|
|
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
825
|
case SET_INITIAL_STATE:
|
|
912
826
|
return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
|
|
913
827
|
initialState: action.initialState
|
|
@@ -1123,27 +1037,6 @@ const seamlyStateReducer = (state, action) => {
|
|
|
1123
1037
|
return state;
|
|
1124
1038
|
}
|
|
1125
1039
|
};
|
|
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
1040
|
const seamly_utils_calculateVisibility = ({
|
|
1148
1041
|
hasResponded,
|
|
1149
1042
|
previousVisibility,
|
|
@@ -1166,14 +1059,12 @@ const seamly_utils_calculateVisibility = ({
|
|
|
1166
1059
|
const baseVisibility = layoutMode === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized;
|
|
1167
1060
|
return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
|
|
1168
1061
|
};
|
|
1169
|
-
;// CONCATENATED MODULE: ./src/javascripts/
|
|
1062
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/store/state-reducer.js
|
|
1063
|
+
// Legacy state reducer. Do not add new features here but extract/create new reducers as needed
|
|
1170
1064
|
|
|
1171
1065
|
|
|
1172
1066
|
const initialState = {
|
|
1173
1067
|
events: [],
|
|
1174
|
-
config: {
|
|
1175
|
-
hideOnNoUserResponse: false
|
|
1176
|
-
},
|
|
1177
1068
|
initialState: {},
|
|
1178
1069
|
unreadEvents: 0,
|
|
1179
1070
|
isLoading: false,
|
|
@@ -1194,15 +1085,11 @@ const initialState = {
|
|
|
1194
1085
|
title: null,
|
|
1195
1086
|
subTitle: ''
|
|
1196
1087
|
},
|
|
1197
|
-
interrupt: {
|
|
1198
|
-
hasInterrupt: false,
|
|
1199
|
-
meta: {}
|
|
1200
|
-
},
|
|
1201
1088
|
historyLoaded: false,
|
|
1202
1089
|
skiplinkTargetId: id_randomId(),
|
|
1203
1090
|
optionsButtonId: id_randomId(),
|
|
1204
1091
|
cobrowsingContainerId: id_randomId(),
|
|
1205
|
-
|
|
1092
|
+
headerCollapseButtonId: id_randomId(),
|
|
1206
1093
|
serviceData: {},
|
|
1207
1094
|
options: {
|
|
1208
1095
|
features: {},
|
|
@@ -1267,10 +1154,22 @@ function createActions(baseType, ...args) {
|
|
|
1267
1154
|
const create = prefixType(baseType, createAction, SLICE_DELIMITER);
|
|
1268
1155
|
return handlers.map(handler => create(...handler));
|
|
1269
1156
|
}
|
|
1157
|
+
function createThunk(type, thunkCreator) {
|
|
1158
|
+
const fn = (...args) => {
|
|
1159
|
+
const thunk = thunkCreator(...args);
|
|
1160
|
+
thunk.type = type;
|
|
1161
|
+
return thunk;
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
fn.toString = () => type;
|
|
1165
|
+
|
|
1166
|
+
return fn;
|
|
1167
|
+
}
|
|
1270
1168
|
function createDomain(domain) {
|
|
1271
1169
|
return {
|
|
1272
1170
|
createAction: prefixType(domain, createAction, DOMAIN_DELIMITER),
|
|
1273
|
-
createActions: prefixType(domain, createActions, DOMAIN_DELIMITER)
|
|
1171
|
+
createActions: prefixType(domain, createActions, DOMAIN_DELIMITER),
|
|
1172
|
+
createThunk: prefixType(domain, createThunk, DOMAIN_DELIMITER)
|
|
1274
1173
|
};
|
|
1275
1174
|
}
|
|
1276
1175
|
function createReducer(domain, handlers = {}, defaultState) {
|
|
@@ -1493,9 +1392,7 @@ function updateFormControl(state, formId, name, controlState) {
|
|
|
1493
1392
|
formId,
|
|
1494
1393
|
persistData
|
|
1495
1394
|
}) => {
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
const formState = persistData ? (_state$formId2 = state[formId]) !== null && _state$formId2 !== void 0 ? _state$formId2 : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1395
|
+
const formState = persistData ? state[formId] ?? reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1499
1396
|
persistData
|
|
1500
1397
|
}) : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1501
1398
|
persistData
|
|
@@ -1600,6 +1497,20 @@ const {
|
|
|
1600
1497
|
Provider: context_Provider,
|
|
1601
1498
|
Consumer
|
|
1602
1499
|
} = context_StoreContext;
|
|
1500
|
+
;// CONCATENATED MODULE: external "preact/jsx-runtime"
|
|
1501
|
+
const jsx_runtime_namespaceObject = require("preact/jsx-runtime");
|
|
1502
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/redux/provider.js
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
function StoreProvider({
|
|
1506
|
+
store,
|
|
1507
|
+
children
|
|
1508
|
+
}) {
|
|
1509
|
+
return _jsx(Provider, {
|
|
1510
|
+
value: store,
|
|
1511
|
+
children: children
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1603
1514
|
;// CONCATENATED MODULE: ./src/javascripts/domains/redux/hooks.js
|
|
1604
1515
|
|
|
1605
1516
|
// import { arrayContentEquals } from './utils'
|
|
@@ -1674,6 +1585,7 @@ const hooks_useSelectorWithProps = function useSelectorWithProps(selector, props
|
|
|
1674
1585
|
|
|
1675
1586
|
|
|
1676
1587
|
|
|
1588
|
+
|
|
1677
1589
|
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/context.js
|
|
1678
1590
|
|
|
1679
1591
|
const context_FormContext = (0,external_preact_namespaceObject.createContext)({});
|
|
@@ -1761,10 +1673,8 @@ function hooks_useFormControl(name) {
|
|
|
1761
1673
|
}), [isValid, error, touched]);
|
|
1762
1674
|
return [field, meta];
|
|
1763
1675
|
}
|
|
1764
|
-
;// CONCATENATED MODULE: external "preact/jsx-runtime"
|
|
1765
|
-
const jsx_runtime_namespaceObject = require("preact/jsx-runtime");
|
|
1766
1676
|
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/provider.js
|
|
1767
|
-
const
|
|
1677
|
+
const _excluded = (/* unused pure expression or super */ null && (["children", "formId", "persistData", "onSubmit", "validationSchema"]));
|
|
1768
1678
|
|
|
1769
1679
|
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
1680
|
|
|
@@ -1772,9 +1682,9 @@ function provider_objectSpread(target) { for (var i = 1; i < arguments.length; i
|
|
|
1772
1682
|
|
|
1773
1683
|
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
1684
|
|
|
1775
|
-
function
|
|
1685
|
+
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
1686
|
|
|
1777
|
-
function
|
|
1687
|
+
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
1688
|
|
|
1779
1689
|
|
|
1780
1690
|
|
|
@@ -1791,7 +1701,7 @@ function provider_FormProvider(_ref) {
|
|
|
1791
1701
|
onSubmit,
|
|
1792
1702
|
validationSchema
|
|
1793
1703
|
} = _ref,
|
|
1794
|
-
props =
|
|
1704
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
1795
1705
|
|
|
1796
1706
|
const dispatch = useStoreDispatch();
|
|
1797
1707
|
const values = useSelectorWithProps(getFormValuesByFormId, {
|
|
@@ -1914,7 +1824,7 @@ const translations_reducer_initialState = {
|
|
|
1914
1824
|
containerId: id_randomId()
|
|
1915
1825
|
};
|
|
1916
1826
|
/* harmony default export */ const translations_reducer = (createReducer('translations', {
|
|
1917
|
-
[
|
|
1827
|
+
[seamly_utils_seamlyActions.SET_FEATURES]: (state, action) => {
|
|
1918
1828
|
var _action$features;
|
|
1919
1829
|
|
|
1920
1830
|
const feature = action === null || action === void 0 ? void 0 : (_action$features = action.features) === null || _action$features === void 0 ? void 0 : _action$features.translation;
|
|
@@ -1928,7 +1838,7 @@ const translations_reducer_initialState = {
|
|
|
1928
1838
|
languages: feature.languages || []
|
|
1929
1839
|
});
|
|
1930
1840
|
},
|
|
1931
|
-
[
|
|
1841
|
+
[seamly_utils_seamlyActions.SET_HISTORY]: (state, {
|
|
1932
1842
|
history
|
|
1933
1843
|
}) => {
|
|
1934
1844
|
var _history$translation, _history$translation2;
|
|
@@ -1938,7 +1848,7 @@ const translations_reducer_initialState = {
|
|
|
1938
1848
|
currentLocale: history === null || history === void 0 ? void 0 : (_history$translation2 = history.translation) === null || _history$translation2 === void 0 ? void 0 : _history$translation2.locale
|
|
1939
1849
|
});
|
|
1940
1850
|
},
|
|
1941
|
-
[
|
|
1851
|
+
[seamly_utils_seamlyActions.CLEAR_FEATURES]: () => translations_reducer_initialState,
|
|
1942
1852
|
[enable]: (state, {
|
|
1943
1853
|
locale
|
|
1944
1854
|
}) => {
|
|
@@ -2016,207 +1926,155 @@ const seamly_api_hooks_useSeamlyHasUserResponded = () => {
|
|
|
2016
1926
|
} = seamly_api_hooks_useSeamlyObjectStore();
|
|
2017
1927
|
return get ? !!get('userResponded') : false;
|
|
2018
1928
|
};
|
|
2019
|
-
;// CONCATENATED MODULE: ./src/javascripts/
|
|
2020
|
-
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; }
|
|
1929
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
|
|
2021
1930
|
|
|
2022
|
-
|
|
1931
|
+
const {
|
|
1932
|
+
createAction: actions_createAction
|
|
1933
|
+
} = createDomain('config');
|
|
1934
|
+
const initialize = actions_createAction('initialize', config => ({
|
|
1935
|
+
config
|
|
1936
|
+
}));
|
|
1937
|
+
const update = actions_createAction('update', config => ({
|
|
1938
|
+
config
|
|
1939
|
+
}));
|
|
1940
|
+
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
1941
|
+
const CSS_NAME = 'cvco';
|
|
1942
|
+
const apiVersion = '2';
|
|
1943
|
+
const config_userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
|
|
1944
|
+
// broadcasting to the screen reader. This is done to avoid verbosity.
|
|
2023
1945
|
|
|
2024
|
-
|
|
1946
|
+
const unreadScreenReaderWait = 2000;
|
|
1947
|
+
const newMessageScreenReaderWait = 1000;
|
|
1948
|
+
const config_screenReaderDebounceDelaySeconds = 10;
|
|
1949
|
+
const activitySendDelay = 15000;
|
|
1950
|
+
const maxCharacterWarningLimit = 50;
|
|
1951
|
+
const maxCharacterSrDebounceDelay = 300;
|
|
1952
|
+
const config_defaultTransitionTimeMs = 300;
|
|
1953
|
+
const defaultConfig = {
|
|
1954
|
+
namespace: 'default',
|
|
1955
|
+
layoutMode: 'window',
|
|
1956
|
+
// "window", "inline" ("sidebar"), "modal"
|
|
1957
|
+
messages: {
|
|
1958
|
+
agent: {
|
|
1959
|
+
showAvatar: false,
|
|
1960
|
+
// true, "inline"
|
|
1961
|
+
showName: false
|
|
1962
|
+
},
|
|
1963
|
+
user: {
|
|
1964
|
+
showAvatar: false,
|
|
1965
|
+
// true, "inline"
|
|
1966
|
+
showName: false
|
|
1967
|
+
},
|
|
1968
|
+
timeIndicator: {
|
|
1969
|
+
enabled: false,
|
|
1970
|
+
threshold: 3600000 // Default threshold is an hour in milliseconds
|
|
1971
|
+
|
|
1972
|
+
}
|
|
1973
|
+
},
|
|
1974
|
+
typing: {
|
|
1975
|
+
timeout: 2000 // How long to wait before we decide the user isn't typing
|
|
2025
1976
|
|
|
1977
|
+
},
|
|
1978
|
+
appContainerClassNames: config => [`app--layout-${config.layoutMode}`, `namespace--${config.namespace}`]
|
|
1979
|
+
};
|
|
1980
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/reducer.js
|
|
1981
|
+
const reducer_excluded = ["messages", "typing"];
|
|
2026
1982
|
|
|
1983
|
+
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; }
|
|
2027
1984
|
|
|
1985
|
+
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; }
|
|
2028
1986
|
|
|
2029
|
-
|
|
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, ({
|
|
2036
|
-
events
|
|
2037
|
-
}, config) => {
|
|
2038
|
-
var _config$messages$time, _config$messages;
|
|
1987
|
+
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; }
|
|
2039
1988
|
|
|
2040
|
-
|
|
2041
|
-
enabled,
|
|
2042
|
-
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 : {};
|
|
1989
|
+
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; }
|
|
2044
1990
|
|
|
2045
|
-
|
|
2046
|
-
return events;
|
|
2047
|
-
}
|
|
1991
|
+
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; }
|
|
2048
1992
|
|
|
2049
|
-
const mappedEvents = [];
|
|
2050
|
-
let previousEvent = null;
|
|
2051
|
-
events.forEach((event, idx) => {
|
|
2052
|
-
// always add timeIndicator to first message
|
|
2053
|
-
if (idx === 0) {
|
|
2054
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2055
|
-
timeIndicator: event.payload.occurredAt
|
|
2056
|
-
})); // else check if diff is greater than threshold
|
|
2057
|
-
} else {
|
|
2058
|
-
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
2059
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2060
|
-
timeIndicator
|
|
2061
|
-
}));
|
|
2062
|
-
}
|
|
2063
1993
|
|
|
2064
|
-
previousEvent = event;
|
|
2065
|
-
});
|
|
2066
|
-
return mappedEvents;
|
|
2067
|
-
});
|
|
2068
|
-
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
2069
|
-
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
2070
|
-
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
2071
|
-
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
2072
|
-
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
2073
|
-
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
2074
|
-
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
2075
|
-
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2076
|
-
var _filteredEvents;
|
|
2077
1994
|
|
|
2078
|
-
const filteredEvents = events.filter(event => event.type === 'message');
|
|
2079
|
-
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
2080
|
-
});
|
|
2081
|
-
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
2082
|
-
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
2083
|
-
const useSeamlyDisclaimerState = () => seamly_state_hooks_useSeamlyStateContext().showDisclaimer;
|
|
2084
|
-
const useSeamlyCurrentAgent = () => {
|
|
2085
|
-
const {
|
|
2086
|
-
participants,
|
|
2087
|
-
currentAgent
|
|
2088
|
-
} = seamly_state_hooks_useSeamlyStateContext().participantInfo;
|
|
2089
|
-
return currentAgent ? participants[currentAgent] : null;
|
|
2090
|
-
};
|
|
2091
|
-
const useSeamlyServiceData = key => seamly_state_hooks_useSeamlyStateContext().serviceData[key];
|
|
2092
|
-
const useEntryTextLimit = () => {
|
|
2093
|
-
const {
|
|
2094
|
-
entryMeta: {
|
|
2095
|
-
options: {
|
|
2096
|
-
text
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
} = seamly_state_hooks_useSeamlyStateContext();
|
|
2100
|
-
const {
|
|
2101
|
-
limit
|
|
2102
|
-
} = text || {};
|
|
2103
|
-
return {
|
|
2104
|
-
hasLimit: limit != null,
|
|
2105
|
-
limit: limit != null ? limit : null
|
|
2106
|
-
};
|
|
2107
|
-
};
|
|
2108
|
-
const useSeamlyLayoutMode = () => {
|
|
2109
|
-
const {
|
|
2110
|
-
layoutMode
|
|
2111
|
-
} = seamly_state_hooks_useSeamlyConfig();
|
|
2112
|
-
return {
|
|
2113
|
-
isInline: layoutMode === 'inline',
|
|
2114
|
-
isModal: layoutMode === 'modal',
|
|
2115
|
-
isWindow: layoutMode === 'window',
|
|
2116
|
-
isResolving: !layoutMode
|
|
2117
|
-
};
|
|
2118
|
-
};
|
|
2119
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-dispatch.js
|
|
2120
1995
|
|
|
2121
|
-
/* harmony default export */ const use_seamly_dispatch = ((/* unused pure expression or super */ null && (useStoreDispatch)));
|
|
2122
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/focus-helper-hooks.js
|
|
2123
1996
|
|
|
2124
1997
|
|
|
1998
|
+
const config_reducer_initialState = config_reducer_objectSpread(config_reducer_objectSpread({}, defaultConfig), {}, {
|
|
1999
|
+
hideOnNoUserResponse: false,
|
|
2000
|
+
showDisclaimer: false,
|
|
2001
|
+
showFaq: false,
|
|
2002
|
+
customComponents: {},
|
|
2003
|
+
defaults: {}
|
|
2004
|
+
});
|
|
2125
2005
|
|
|
2006
|
+
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'typing', 'visible', 'visibilityCallback'];
|
|
2126
2007
|
|
|
2008
|
+
const updateState = (state, {
|
|
2009
|
+
config
|
|
2010
|
+
}) => {
|
|
2011
|
+
const _pick = pick(config, configKeys),
|
|
2012
|
+
{
|
|
2013
|
+
messages,
|
|
2014
|
+
typing
|
|
2015
|
+
} = _pick,
|
|
2016
|
+
partialConfig = reducer_objectWithoutProperties(_pick, reducer_excluded);
|
|
2127
2017
|
|
|
2128
|
-
|
|
2129
|
-
SET_SEAMLY_CONTAINER_ELEMENT: focus_helper_hooks_SET_SEAMLY_CONTAINER_ELEMENT
|
|
2130
|
-
} = seamlyActions;
|
|
2018
|
+
let newState = state;
|
|
2131
2019
|
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2020
|
+
if (Object.keys(partialConfig).length > 0) {
|
|
2021
|
+
newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), partialConfig);
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
if (messages) {
|
|
2025
|
+
newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), {}, {
|
|
2026
|
+
messages: config_reducer_objectSpread(config_reducer_objectSpread({}, newState.messages), messages)
|
|
2137
2027
|
});
|
|
2138
|
-
}
|
|
2139
|
-
};
|
|
2028
|
+
}
|
|
2140
2029
|
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
} = useSeamlyStateContext();
|
|
2145
|
-
const dispatch = useSeamlyDispatchContext();
|
|
2146
|
-
const setSeamlyContainerElement = useCallback(element => {
|
|
2147
|
-
dispatch({
|
|
2148
|
-
type: focus_helper_hooks_SET_SEAMLY_CONTAINER_ELEMENT,
|
|
2149
|
-
element
|
|
2030
|
+
if (typing) {
|
|
2031
|
+
newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), {}, {
|
|
2032
|
+
typing: config_reducer_objectSpread(config_reducer_objectSpread({}, newState.typing), typing)
|
|
2150
2033
|
});
|
|
2151
|
-
}
|
|
2152
|
-
return [seamlyContainerElement, setSeamlyContainerElement];
|
|
2153
|
-
};
|
|
2154
|
-
const focus_helper_hooks_useElementFocusingById = elementId => useCallback(() => {
|
|
2155
|
-
focusWithRaf(elementId);
|
|
2156
|
-
}, [elementId]);
|
|
2157
|
-
const focus_helper_hooks_useSkiplinkTargetFocusing = () => {
|
|
2158
|
-
const skiplinkTargetId = useSkiplink();
|
|
2159
|
-
return focus_helper_hooks_useElementFocusingById(skiplinkTargetId);
|
|
2160
|
-
};
|
|
2161
|
-
const useFocusIfSeamlyContainedFocus = () => {
|
|
2162
|
-
const containerElementRef = useRef(null);
|
|
2163
|
-
const [seamlyContainerElement] = useSeamlyContainerElement();
|
|
2164
|
-
containerElementRef.current = seamlyContainerElement;
|
|
2165
|
-
return useCallback(elementToFocus => {
|
|
2166
|
-
const focusFn = () => {
|
|
2167
|
-
focusWithRaf(elementToFocus);
|
|
2168
|
-
};
|
|
2034
|
+
}
|
|
2169
2035
|
|
|
2170
|
-
|
|
2171
|
-
}, []);
|
|
2036
|
+
return newState;
|
|
2172
2037
|
};
|
|
2173
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
|
|
2174
2038
|
|
|
2039
|
+
/* harmony default export */ const config_reducer = (createReducer('config', {
|
|
2040
|
+
[initialize]: (state, action) => {
|
|
2041
|
+
return updateState(state, action);
|
|
2042
|
+
},
|
|
2043
|
+
[update]: (state, action) => {
|
|
2044
|
+
return updateState(state, action);
|
|
2045
|
+
}
|
|
2046
|
+
}, config_reducer_initialState));
|
|
2047
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/selectors.js
|
|
2048
|
+
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; }
|
|
2175
2049
|
|
|
2176
|
-
|
|
2177
|
-
const config = useSeamlyConfig();
|
|
2178
|
-
const {
|
|
2179
|
-
appContainerClassNames
|
|
2180
|
-
} = config;
|
|
2050
|
+
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; }
|
|
2181
2051
|
|
|
2182
|
-
|
|
2183
|
-
return [];
|
|
2184
|
-
}
|
|
2052
|
+
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; }
|
|
2185
2053
|
|
|
2186
|
-
switch (typeof config.appContainerClassNames) {
|
|
2187
|
-
case 'function':
|
|
2188
|
-
return config.appContainerClassNames(config);
|
|
2189
2054
|
|
|
2190
|
-
default:
|
|
2191
|
-
return config.appContainerClassNames;
|
|
2192
|
-
}
|
|
2193
|
-
};
|
|
2194
|
-
const useSeamlyMessageContainerClassNames = event => {
|
|
2195
|
-
const {
|
|
2196
|
-
fromClient
|
|
2197
|
-
} = event.payload;
|
|
2198
|
-
const classNames = ['message'];
|
|
2199
2055
|
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2056
|
+
|
|
2057
|
+
const selectState = state => state[String(config_reducer)];
|
|
2058
|
+
const selectConfig = createSelector(selectState, config => {
|
|
2059
|
+
let newConfig = selectors_objectSpread({
|
|
2060
|
+
visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized,
|
|
2061
|
+
appContainerClassNames: config.appContainerClassNames || []
|
|
2062
|
+
}, config);
|
|
2063
|
+
|
|
2064
|
+
if (typeof newConfig.appContainerClassNames === 'function') {
|
|
2065
|
+
newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
|
|
2066
|
+
appContainerClassNames: newConfig.appContainerClassNames(newConfig)
|
|
2067
|
+
});
|
|
2206
2068
|
}
|
|
2207
2069
|
|
|
2208
|
-
return
|
|
2209
|
-
};
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
id,
|
|
2217
|
-
focusContainer
|
|
2218
|
-
};
|
|
2219
|
-
};
|
|
2070
|
+
return newConfig;
|
|
2071
|
+
});
|
|
2072
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
function hooks_useConfig() {
|
|
2076
|
+
return useSelector(Selectors.selectConfig);
|
|
2077
|
+
}
|
|
2220
2078
|
;// CONCATENATED MODULE: ./translations/en.js
|
|
2221
2079
|
// Please note: All texts containing the string 'srText' are short for
|
|
2222
2080
|
// Screen Reader Text. These texts are invisible on screen but broadcast
|
|
@@ -2279,7 +2137,6 @@ const useCobrowsingContainer = () => {
|
|
|
2279
2137
|
'fileUpload.srAvailableText': 'File uploads are now available in the chat.',
|
|
2280
2138
|
'fileUpload.srCompleteText': 'Upload complete.',
|
|
2281
2139
|
'fileUpload.srFileDownloadText': fileName => `Download file ${fileName}.`,
|
|
2282
|
-
'fileUpload.srFileUnavailableText': fileName => `Download for ${fileName} has expired.`,
|
|
2283
2140
|
'fileUpload.srFileUploadedText': fileName => `Uploaded file ${fileName}.`,
|
|
2284
2141
|
'fileUpload.srProgressLabel': fileName => `${fileName} upload progress status`,
|
|
2285
2142
|
'fileUpload.srStartedText': 'Upload started.',
|
|
@@ -2467,16 +2324,19 @@ function i18n_defineProperty(obj, key, value) { if (key in obj) { Object.defineP
|
|
|
2467
2324
|
const {
|
|
2468
2325
|
createAction: i18n_createAction
|
|
2469
2326
|
} = createDomain('i18n');
|
|
2470
|
-
const
|
|
2327
|
+
const i18n_initI18n = i18n_createAction('init', overrides => ({
|
|
2471
2328
|
overrides
|
|
2472
|
-
}));
|
|
2329
|
+
}));
|
|
2330
|
+
const i18n_Actions = {
|
|
2331
|
+
initI18n: i18n_initI18n
|
|
2332
|
+
}; // Reducer
|
|
2473
2333
|
|
|
2474
2334
|
const defaultState = {
|
|
2475
2335
|
translations: flattenObject(en),
|
|
2476
2336
|
overrides: {}
|
|
2477
2337
|
};
|
|
2478
2338
|
const Reducer = createReducer('i18n', {
|
|
2479
|
-
[
|
|
2339
|
+
[i18n_initI18n]: (state, {
|
|
2480
2340
|
overrides
|
|
2481
2341
|
}) => {
|
|
2482
2342
|
return i18n_objectSpread(i18n_objectSpread({}, state), {}, {
|
|
@@ -2519,203 +2379,235 @@ function i18n_useI18n() {
|
|
|
2519
2379
|
t
|
|
2520
2380
|
};
|
|
2521
2381
|
}
|
|
2522
|
-
;// CONCATENATED MODULE: ./src/javascripts/
|
|
2523
|
-
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
|
-
|
|
2525
|
-
function seamly_option_hooks_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { seamly_option_hooks_ownKeys(Object(source), true).forEach(function (key) { seamly_option_hooks_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { seamly_option_hooks_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2382
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
|
|
2526
2383
|
|
|
2527
|
-
function seamly_option_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; }
|
|
2528
2384
|
|
|
2529
2385
|
|
|
2386
|
+
function createMiddleware() {
|
|
2387
|
+
return ({
|
|
2388
|
+
dispatch
|
|
2389
|
+
}) => next => action => {
|
|
2390
|
+
var _action$config, _action$config2, _action$config2$defau;
|
|
2530
2391
|
|
|
2392
|
+
const result = next(action);
|
|
2531
2393
|
|
|
2394
|
+
switch (action.type) {
|
|
2395
|
+
case String(Actions.initialize):
|
|
2396
|
+
case String(Actions.update):
|
|
2397
|
+
if (action !== null && action !== void 0 && (_action$config = action.config) !== null && _action$config !== void 0 && _action$config.translations) {
|
|
2398
|
+
dispatch(initI18n(action.config.translations));
|
|
2399
|
+
}
|
|
2532
2400
|
|
|
2401
|
+
if (action !== null && action !== void 0 && (_action$config2 = action.config) !== null && _action$config2 !== void 0 && (_action$config2$defau = _action$config2.defaults) !== null && _action$config2$defau !== void 0 && _action$config2$defau.agentName) {
|
|
2402
|
+
var _action$config3, _action$config3$defau;
|
|
2533
2403
|
|
|
2404
|
+
dispatch({
|
|
2405
|
+
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
2406
|
+
title: action === null || action === void 0 ? void 0 : (_action$config3 = action.config) === null || _action$config3 === void 0 ? void 0 : (_action$config3$defau = _action$config3.defaults) === null || _action$config3$defau === void 0 ? void 0 : _action$config3$defau.agentName
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2534
2409
|
|
|
2410
|
+
}
|
|
2535
2411
|
|
|
2536
|
-
|
|
2537
|
-
SET_USER_SELECTED_OPTION: seamly_option_hooks_SET_USER_SELECTED_OPTION,
|
|
2538
|
-
SET_USER_SELECTED_OPTIONS: seamly_option_hooks_SET_USER_SELECTED_OPTIONS,
|
|
2539
|
-
SHOW_OPTION: seamly_option_hooks_SHOW_OPTION,
|
|
2540
|
-
HIDE_OPTION: seamly_option_hooks_HIDE_OPTION
|
|
2541
|
-
} = seamlyActions;
|
|
2542
|
-
const seamly_option_hooks_useSeamlyOptions = () => {
|
|
2543
|
-
const {
|
|
2544
|
-
t
|
|
2545
|
-
} = useI18n();
|
|
2546
|
-
const {
|
|
2547
|
-
options
|
|
2548
|
-
} = useSeamlyStateContext();
|
|
2549
|
-
const {
|
|
2550
|
-
panelActive,
|
|
2551
|
-
optionActive,
|
|
2552
|
-
userSelectedOptions,
|
|
2553
|
-
features
|
|
2554
|
-
} = options;
|
|
2555
|
-
const {
|
|
2556
|
-
cobrowsing,
|
|
2557
|
-
sendTranscript
|
|
2558
|
-
} = features;
|
|
2559
|
-
const optionsObj = {
|
|
2560
|
-
cobrowsing,
|
|
2561
|
-
sendTranscript
|
|
2412
|
+
return result;
|
|
2562
2413
|
};
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2414
|
+
}
|
|
2415
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
2416
|
+
|
|
2417
|
+
|
|
2418
|
+
|
|
2419
|
+
|
|
2420
|
+
|
|
2421
|
+
|
|
2422
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
2423
|
+
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; }
|
|
2424
|
+
|
|
2425
|
+
function seamly_state_hooks_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { seamly_state_hooks_ownKeys(Object(source), true).forEach(function (key) { seamly_state_hooks_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { seamly_state_hooks_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2426
|
+
|
|
2427
|
+
function seamly_state_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; }
|
|
2428
|
+
|
|
2429
|
+
|
|
2430
|
+
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
const seamly_state_hooks_selectState = state => state.state;
|
|
2434
|
+
const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
|
|
2435
|
+
const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
|
|
2436
|
+
events
|
|
2437
|
+
}, config) => {
|
|
2438
|
+
var _config$messages;
|
|
2439
|
+
|
|
2572
2440
|
const {
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
} =
|
|
2576
|
-
const initUserSelectedOptions = useCallback(() => {
|
|
2577
|
-
const storedOptions = get('options') || {};
|
|
2578
|
-
dispatch({
|
|
2579
|
-
type: seamly_option_hooks_SET_USER_SELECTED_OPTIONS,
|
|
2580
|
-
options: storedOptions
|
|
2581
|
-
});
|
|
2582
|
-
}, [get, dispatch]);
|
|
2583
|
-
const setUserSelectedOptions = useCallback(optionValues => {
|
|
2584
|
-
dispatch({
|
|
2585
|
-
type: seamly_option_hooks_SET_USER_SELECTED_OPTIONS,
|
|
2586
|
-
options: optionValues
|
|
2587
|
-
});
|
|
2588
|
-
set('options', optionValues);
|
|
2589
|
-
}, [set, dispatch]);
|
|
2590
|
-
const setUserSelectedOption = useCallback((option, value) => {
|
|
2591
|
-
const storedOptions = get('options') || {};
|
|
2592
|
-
set('options', seamly_option_hooks_objectSpread(seamly_option_hooks_objectSpread({}, storedOptions), {}, {
|
|
2593
|
-
[option]: value
|
|
2594
|
-
}));
|
|
2595
|
-
dispatch({
|
|
2596
|
-
type: seamly_option_hooks_SET_USER_SELECTED_OPTION,
|
|
2597
|
-
option,
|
|
2598
|
-
value
|
|
2599
|
-
});
|
|
2600
|
-
}, [dispatch, get, set]);
|
|
2441
|
+
enabled,
|
|
2442
|
+
threshold
|
|
2443
|
+
} = (config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) ?? {};
|
|
2601
2444
|
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
optionName
|
|
2606
|
-
});
|
|
2607
|
-
};
|
|
2445
|
+
if (!enabled) {
|
|
2446
|
+
return events;
|
|
2447
|
+
}
|
|
2608
2448
|
|
|
2609
|
-
const
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2449
|
+
const mappedEvents = [];
|
|
2450
|
+
let previousEvent = null;
|
|
2451
|
+
events.forEach((event, idx) => {
|
|
2452
|
+
// always add timeIndicator to first message
|
|
2453
|
+
if (idx === 0) {
|
|
2454
|
+
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2455
|
+
timeIndicator: event.payload.occurredAt
|
|
2456
|
+
})); // else check if diff is greater than threshold
|
|
2457
|
+
} else {
|
|
2458
|
+
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
2459
|
+
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2460
|
+
timeIndicator
|
|
2461
|
+
}));
|
|
2462
|
+
}
|
|
2614
2463
|
|
|
2464
|
+
previousEvent = event;
|
|
2465
|
+
});
|
|
2466
|
+
return mappedEvents;
|
|
2467
|
+
});
|
|
2468
|
+
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
2469
|
+
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
2470
|
+
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
2471
|
+
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
2472
|
+
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
2473
|
+
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
2474
|
+
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
2475
|
+
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2476
|
+
var _filteredEvents;
|
|
2477
|
+
|
|
2478
|
+
const filteredEvents = events.filter(event => event.type === 'message');
|
|
2479
|
+
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
2480
|
+
});
|
|
2481
|
+
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
2482
|
+
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
2483
|
+
const useSeamlyCurrentAgent = () => {
|
|
2484
|
+
const {
|
|
2485
|
+
participants,
|
|
2486
|
+
currentAgent
|
|
2487
|
+
} = seamly_state_hooks_useSeamlyStateContext().participantInfo;
|
|
2488
|
+
return currentAgent ? participants[currentAgent] : null;
|
|
2489
|
+
};
|
|
2490
|
+
const useSeamlyServiceData = key => seamly_state_hooks_useSeamlyStateContext().serviceData[key];
|
|
2491
|
+
const useEntryTextLimit = () => {
|
|
2492
|
+
const {
|
|
2493
|
+
entryMeta: {
|
|
2494
|
+
options: {
|
|
2495
|
+
text
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
} = seamly_state_hooks_useSeamlyStateContext();
|
|
2499
|
+
const {
|
|
2500
|
+
limit
|
|
2501
|
+
} = text || {};
|
|
2615
2502
|
return {
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
features,
|
|
2619
|
-
menuOptions,
|
|
2620
|
-
initUserSelectedOptions,
|
|
2621
|
-
setUserSelectedOptions,
|
|
2622
|
-
setUserSelectedOption,
|
|
2623
|
-
showOption,
|
|
2624
|
-
hideOption,
|
|
2625
|
-
panelActive,
|
|
2626
|
-
optionActive
|
|
2503
|
+
hasLimit: limit != null,
|
|
2504
|
+
limit: limit != null ? limit : null
|
|
2627
2505
|
};
|
|
2628
2506
|
};
|
|
2629
|
-
const
|
|
2507
|
+
const useSeamlyLayoutMode = () => {
|
|
2630
2508
|
const {
|
|
2631
|
-
|
|
2632
|
-
} =
|
|
2633
|
-
const focusButton = useElementFocusingById(id);
|
|
2509
|
+
layoutMode
|
|
2510
|
+
} = useConfig();
|
|
2634
2511
|
return {
|
|
2635
|
-
|
|
2636
|
-
|
|
2512
|
+
isInline: layoutMode === 'inline',
|
|
2513
|
+
isModal: layoutMode === 'modal',
|
|
2514
|
+
isWindow: layoutMode === 'window',
|
|
2515
|
+
isResolving: !layoutMode
|
|
2637
2516
|
};
|
|
2638
2517
|
};
|
|
2639
|
-
;// CONCATENATED MODULE: ./src/javascripts/
|
|
2640
|
-
class seamly_offline_error_SeamlyOfflineError extends Error {
|
|
2641
|
-
constructor(params) {
|
|
2642
|
-
super(params);
|
|
2518
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-dispatch.js
|
|
2643
2519
|
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
}
|
|
2520
|
+
/* harmony default export */ const use_seamly_dispatch = ((/* unused pure expression or super */ null && (useStoreDispatch)));
|
|
2521
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/focus-helper-hooks.js
|
|
2647
2522
|
|
|
2648
|
-
this.name = 'SeamlyOfflineError';
|
|
2649
|
-
this.langKey = 'errors.seamlyOffline';
|
|
2650
|
-
}
|
|
2651
2523
|
|
|
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
2524
|
|
|
2662
|
-
this.name = 'SeamlyGeneralError';
|
|
2663
|
-
this.langKey = 'errors.general';
|
|
2664
|
-
this.action = 'reset';
|
|
2665
|
-
}
|
|
2666
2525
|
|
|
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
2526
|
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2527
|
+
const {
|
|
2528
|
+
SET_SEAMLY_CONTAINER_ELEMENT: focus_helper_hooks_SET_SEAMLY_CONTAINER_ELEMENT
|
|
2529
|
+
} = seamly_utils_seamlyActions;
|
|
2676
2530
|
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2531
|
+
const focusWithRaf = el => {
|
|
2532
|
+
requestAnimationFrame(() => {
|
|
2533
|
+
requestAnimationFrame(() => {
|
|
2534
|
+
const focusEl = typeof el === 'string' ? document.getElementById(el) : el;
|
|
2535
|
+
focusElement(focusEl);
|
|
2536
|
+
});
|
|
2537
|
+
});
|
|
2538
|
+
};
|
|
2680
2539
|
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2540
|
+
const useSeamlyContainerElement = () => {
|
|
2541
|
+
const {
|
|
2542
|
+
seamlyContainerElement
|
|
2543
|
+
} = useSeamlyStateContext();
|
|
2544
|
+
const dispatch = useSeamlyDispatchContext();
|
|
2545
|
+
const setSeamlyContainerElement = useCallback(element => {
|
|
2546
|
+
dispatch({
|
|
2547
|
+
type: focus_helper_hooks_SET_SEAMLY_CONTAINER_ELEMENT,
|
|
2548
|
+
element
|
|
2549
|
+
});
|
|
2550
|
+
}, [dispatch]);
|
|
2551
|
+
return [seamlyContainerElement, setSeamlyContainerElement];
|
|
2552
|
+
};
|
|
2553
|
+
const focus_helper_hooks_useElementFocusingById = elementId => useCallback(() => {
|
|
2554
|
+
focusWithRaf(elementId);
|
|
2555
|
+
}, [elementId]);
|
|
2556
|
+
const focus_helper_hooks_useSkiplinkTargetFocusing = () => {
|
|
2557
|
+
const skiplinkTargetId = useSkiplink();
|
|
2558
|
+
return focus_helper_hooks_useElementFocusingById(skiplinkTargetId);
|
|
2559
|
+
};
|
|
2560
|
+
const useFocusIfSeamlyContainedFocus = () => {
|
|
2561
|
+
const containerElementRef = useRef(null);
|
|
2562
|
+
const [seamlyContainerElement] = useSeamlyContainerElement();
|
|
2563
|
+
containerElementRef.current = seamlyContainerElement;
|
|
2564
|
+
return useCallback(elementToFocus => {
|
|
2565
|
+
const focusFn = () => {
|
|
2566
|
+
focusWithRaf(elementToFocus);
|
|
2567
|
+
};
|
|
2686
2568
|
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2569
|
+
runIfElementContainsOrHasFocus(containerElementRef.current, focusFn);
|
|
2570
|
+
}, []);
|
|
2571
|
+
};
|
|
2572
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
|
|
2690
2573
|
|
|
2691
|
-
this.name = 'SeamlySessionExpiredError';
|
|
2692
|
-
this.action = 'reset';
|
|
2693
|
-
}
|
|
2694
2574
|
|
|
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
2575
|
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2576
|
+
const useSeamlyAppContainerClassNames = () => {
|
|
2577
|
+
return useConfig().appContainerClassNames;
|
|
2578
|
+
};
|
|
2579
|
+
const useSeamlyMessageContainerClassNames = event => {
|
|
2580
|
+
const {
|
|
2581
|
+
fromClient
|
|
2582
|
+
} = event.payload;
|
|
2583
|
+
const classNames = ['message'];
|
|
2704
2584
|
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2585
|
+
if (event.type === 'info') {
|
|
2586
|
+
classNames.push('message--source-info');
|
|
2587
|
+
} else if (!fromClient) {
|
|
2588
|
+
classNames.push('message--source-agent');
|
|
2589
|
+
} else {
|
|
2590
|
+
classNames.push('message--source-user');
|
|
2708
2591
|
}
|
|
2709
2592
|
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2593
|
+
return classNames;
|
|
2594
|
+
};
|
|
2595
|
+
const useCobrowsingContainer = () => {
|
|
2596
|
+
const {
|
|
2597
|
+
cobrowsingContainerId: id
|
|
2598
|
+
} = useSeamlyStateContext();
|
|
2599
|
+
const focusContainer = useElementFocusingById(id);
|
|
2600
|
+
return {
|
|
2601
|
+
id,
|
|
2602
|
+
focusContainer
|
|
2603
|
+
};
|
|
2604
|
+
};
|
|
2605
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-option-hooks.js
|
|
2606
|
+
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; }
|
|
2717
2607
|
|
|
2608
|
+
function seamly_option_hooks_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { seamly_option_hooks_ownKeys(Object(source), true).forEach(function (key) { seamly_option_hooks_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { seamly_option_hooks_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2718
2609
|
|
|
2610
|
+
function seamly_option_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; }
|
|
2719
2611
|
|
|
2720
2612
|
|
|
2721
2613
|
|
|
@@ -2724,64 +2616,109 @@ function use_seamly_interrupt_defineProperty(obj, key, value) { if (key in obj)
|
|
|
2724
2616
|
|
|
2725
2617
|
|
|
2726
2618
|
|
|
2619
|
+
const {
|
|
2620
|
+
SET_USER_SELECTED_OPTION: seamly_option_hooks_SET_USER_SELECTED_OPTION,
|
|
2621
|
+
SET_USER_SELECTED_OPTIONS: seamly_option_hooks_SET_USER_SELECTED_OPTIONS,
|
|
2622
|
+
SHOW_OPTION: seamly_option_hooks_SHOW_OPTION,
|
|
2623
|
+
HIDE_OPTION: seamly_option_hooks_HIDE_OPTION
|
|
2624
|
+
} = seamly_utils_seamlyActions;
|
|
2625
|
+
const seamly_option_hooks_useSeamlyOptions = () => {
|
|
2626
|
+
const {
|
|
2627
|
+
t
|
|
2628
|
+
} = useI18n();
|
|
2629
|
+
const {
|
|
2630
|
+
options
|
|
2631
|
+
} = useSeamlyStateContext();
|
|
2632
|
+
const {
|
|
2633
|
+
panelActive,
|
|
2634
|
+
optionActive,
|
|
2635
|
+
userSelectedOptions,
|
|
2636
|
+
features
|
|
2637
|
+
} = options;
|
|
2638
|
+
const {
|
|
2639
|
+
cobrowsing,
|
|
2640
|
+
sendTranscript
|
|
2641
|
+
} = features;
|
|
2642
|
+
const optionsObj = {
|
|
2643
|
+
cobrowsing,
|
|
2644
|
+
sendTranscript
|
|
2645
|
+
};
|
|
2646
|
+
const menuOptions = Object.keys(optionsObj).filter(key => {
|
|
2647
|
+
return optionsObj[key];
|
|
2648
|
+
}).map(option => ({
|
|
2649
|
+
name: option,
|
|
2650
|
+
title: t(`options.${option}.menuTitle`),
|
|
2651
|
+
available: optionsObj[option].enabled
|
|
2652
|
+
}));
|
|
2653
|
+
const allowOptionSelection = cobrowsing || sendTranscript;
|
|
2654
|
+
const dispatch = useSeamlyDispatchContext();
|
|
2655
|
+
const {
|
|
2656
|
+
get,
|
|
2657
|
+
set
|
|
2658
|
+
} = useSeamlyObjectStore();
|
|
2659
|
+
const initUserSelectedOptions = useCallback(() => {
|
|
2660
|
+
const storedOptions = get('options') || {};
|
|
2661
|
+
dispatch({
|
|
2662
|
+
type: seamly_option_hooks_SET_USER_SELECTED_OPTIONS,
|
|
2663
|
+
options: storedOptions
|
|
2664
|
+
});
|
|
2665
|
+
}, [get, dispatch]);
|
|
2666
|
+
const setUserSelectedOptions = useCallback(optionValues => {
|
|
2667
|
+
dispatch({
|
|
2668
|
+
type: seamly_option_hooks_SET_USER_SELECTED_OPTIONS,
|
|
2669
|
+
options: optionValues
|
|
2670
|
+
});
|
|
2671
|
+
set('options', optionValues);
|
|
2672
|
+
}, [set, dispatch]);
|
|
2673
|
+
const setUserSelectedOption = useCallback((option, value) => {
|
|
2674
|
+
const storedOptions = get('options') || {};
|
|
2675
|
+
set('options', seamly_option_hooks_objectSpread(seamly_option_hooks_objectSpread({}, storedOptions), {}, {
|
|
2676
|
+
[option]: value
|
|
2677
|
+
}));
|
|
2678
|
+
dispatch({
|
|
2679
|
+
type: seamly_option_hooks_SET_USER_SELECTED_OPTION,
|
|
2680
|
+
option,
|
|
2681
|
+
value
|
|
2682
|
+
});
|
|
2683
|
+
}, [dispatch, get, set]);
|
|
2727
2684
|
|
|
2685
|
+
const showOption = optionName => {
|
|
2686
|
+
dispatch({
|
|
2687
|
+
type: seamly_option_hooks_SHOW_OPTION,
|
|
2688
|
+
optionName
|
|
2689
|
+
});
|
|
2690
|
+
};
|
|
2728
2691
|
|
|
2729
|
-
const {
|
|
2730
|
-
|
|
2731
|
-
|
|
2692
|
+
const hideOption = () => {
|
|
2693
|
+
dispatch({
|
|
2694
|
+
type: seamly_option_hooks_HIDE_OPTION
|
|
2695
|
+
});
|
|
2696
|
+
};
|
|
2732
2697
|
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2698
|
+
return {
|
|
2699
|
+
allowOptionSelection,
|
|
2700
|
+
userSelectedOptions,
|
|
2701
|
+
features,
|
|
2702
|
+
menuOptions,
|
|
2703
|
+
initUserSelectedOptions,
|
|
2704
|
+
setUserSelectedOptions,
|
|
2705
|
+
setUserSelectedOption,
|
|
2706
|
+
showOption,
|
|
2707
|
+
hideOption,
|
|
2708
|
+
panelActive,
|
|
2709
|
+
optionActive
|
|
2710
|
+
};
|
|
2711
|
+
};
|
|
2712
|
+
const seamly_option_hooks_useOptionButton = () => {
|
|
2742
2713
|
const {
|
|
2743
|
-
|
|
2744
|
-
} =
|
|
2745
|
-
const
|
|
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]);
|
|
2714
|
+
optionsButtonId: id
|
|
2715
|
+
} = useSeamlyStateContext();
|
|
2716
|
+
const focusButton = useElementFocusingById(id);
|
|
2777
2717
|
return {
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
setInterrupt
|
|
2718
|
+
id,
|
|
2719
|
+
focusButton
|
|
2781
2720
|
};
|
|
2782
2721
|
};
|
|
2783
|
-
|
|
2784
|
-
/* harmony default export */ const use_seamly_interrupt = ((/* unused pure expression or super */ null && (use_seamly_interrupt_useSeamlyInterrupt)));
|
|
2785
2722
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-file-upload-context.js
|
|
2786
2723
|
|
|
2787
2724
|
const seamly_file_upload_context_SeamlyFileUploadContext = (0,external_preact_namespaceObject.createContext)({});
|
|
@@ -2800,7 +2737,7 @@ function file_upload_hooks_defineProperty(obj, key, value) { if (key in obj) { O
|
|
|
2800
2737
|
|
|
2801
2738
|
const {
|
|
2802
2739
|
CLEAR_ALL_UPLOADS: file_upload_hooks_CLEAR_ALL_UPLOADS
|
|
2803
|
-
} =
|
|
2740
|
+
} = seamly_utils_seamlyActions;
|
|
2804
2741
|
|
|
2805
2742
|
const useSeamlyFileUploadContext = () => useContext(SeamlyFileUploadContext);
|
|
2806
2743
|
|
|
@@ -2895,6 +2832,189 @@ const utility_hooks_useStableCallback = callback => {
|
|
|
2895
2832
|
return isFunction ? (...args) => callbackRef.current(...args) : undefined;
|
|
2896
2833
|
}, [isFunction]);
|
|
2897
2834
|
};
|
|
2835
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/actions.js
|
|
2836
|
+
|
|
2837
|
+
const {
|
|
2838
|
+
createAction: interrupt_actions_createAction
|
|
2839
|
+
} = createDomain('interrupt');
|
|
2840
|
+
const set = interrupt_actions_createAction('set', error => ({
|
|
2841
|
+
error
|
|
2842
|
+
}));
|
|
2843
|
+
const clear = interrupt_actions_createAction('clear');
|
|
2844
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
|
|
2845
|
+
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; }
|
|
2846
|
+
|
|
2847
|
+
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; }
|
|
2848
|
+
|
|
2849
|
+
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; }
|
|
2850
|
+
|
|
2851
|
+
|
|
2852
|
+
|
|
2853
|
+
const interrupt_reducer_initialState = {
|
|
2854
|
+
error: undefined
|
|
2855
|
+
};
|
|
2856
|
+
/* harmony default export */ const interrupt_reducer = (createReducer('interrupt', {
|
|
2857
|
+
[set]: (state, {
|
|
2858
|
+
error
|
|
2859
|
+
}) => {
|
|
2860
|
+
return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
|
|
2861
|
+
error
|
|
2862
|
+
});
|
|
2863
|
+
},
|
|
2864
|
+
[clear]: () => {
|
|
2865
|
+
return interrupt_reducer_initialState;
|
|
2866
|
+
}
|
|
2867
|
+
}, interrupt_reducer_initialState));
|
|
2868
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.js
|
|
2869
|
+
|
|
2870
|
+
|
|
2871
|
+
const selectors_selectState = state => state[String(interrupt_reducer)];
|
|
2872
|
+
const selectError = createSelector(selectors_selectState, ({
|
|
2873
|
+
error
|
|
2874
|
+
}) => error);
|
|
2875
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.js
|
|
2876
|
+
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; }
|
|
2877
|
+
|
|
2878
|
+
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; }
|
|
2879
|
+
|
|
2880
|
+
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; }
|
|
2881
|
+
|
|
2882
|
+
|
|
2883
|
+
|
|
2884
|
+
|
|
2885
|
+
|
|
2886
|
+
function hooks_useInterrupt() {
|
|
2887
|
+
const {
|
|
2888
|
+
t
|
|
2889
|
+
} = useI18n();
|
|
2890
|
+
const error = useSelector(Selectors.selectError);
|
|
2891
|
+
const hasInterrupt = Boolean(error);
|
|
2892
|
+
const meta = useMemo(() => {
|
|
2893
|
+
if (!error) return {};
|
|
2894
|
+
const {
|
|
2895
|
+
langKey,
|
|
2896
|
+
action
|
|
2897
|
+
} = error;
|
|
2898
|
+
const title = t(`${langKey}.title`);
|
|
2899
|
+
const message = t(`${langKey}.message`);
|
|
2900
|
+
const srText = t(`${langKey}.srText`);
|
|
2901
|
+
const buttonText = t(`${langKey}.buttonText`);
|
|
2902
|
+
return hooks_objectSpread(hooks_objectSpread(hooks_objectSpread(hooks_objectSpread({}, langKey ? {
|
|
2903
|
+
title,
|
|
2904
|
+
message,
|
|
2905
|
+
srText
|
|
2906
|
+
} : {}), action ? {
|
|
2907
|
+
action
|
|
2908
|
+
} : {}), action && langKey ? {
|
|
2909
|
+
buttonText
|
|
2910
|
+
} : {}), {}, {
|
|
2911
|
+
originalError: error
|
|
2912
|
+
});
|
|
2913
|
+
}, [t, error]);
|
|
2914
|
+
return {
|
|
2915
|
+
hasInterrupt,
|
|
2916
|
+
meta,
|
|
2917
|
+
error
|
|
2918
|
+
};
|
|
2919
|
+
}
|
|
2920
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
|
|
2921
|
+
class SeamlyGeneralError extends Error {
|
|
2922
|
+
constructor(params) {
|
|
2923
|
+
super(params);
|
|
2924
|
+
|
|
2925
|
+
if (Error.captureStackTrace) {
|
|
2926
|
+
Error.captureStackTrace(this, SeamlyGeneralError);
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
this.name = 'SeamlyGeneralError';
|
|
2930
|
+
this.langKey = 'errors.general';
|
|
2931
|
+
this.action = 'reset';
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
}
|
|
2935
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-configuration-error.js
|
|
2936
|
+
class SeamlyConfigurationError extends Error {
|
|
2937
|
+
constructor(params) {
|
|
2938
|
+
super(params);
|
|
2939
|
+
|
|
2940
|
+
if (Error.captureStackTrace) {
|
|
2941
|
+
Error.captureStackTrace(this, SeamlyConfigurationError);
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
this.name = 'SeamlyConfigurationError';
|
|
2945
|
+
this.langKey = 'errors.configError';
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
}
|
|
2949
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-session-expired-error.js
|
|
2950
|
+
class SeamlySessionExpiredError extends Error {
|
|
2951
|
+
constructor(params) {
|
|
2952
|
+
super(params);
|
|
2953
|
+
|
|
2954
|
+
if (Error.captureStackTrace) {
|
|
2955
|
+
Error.captureStackTrace(this, SeamlySessionExpiredError);
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
this.name = 'SeamlySessionExpiredError';
|
|
2959
|
+
this.action = 'reset';
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
}
|
|
2963
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-offline-error.js
|
|
2964
|
+
class SeamlyOfflineError extends Error {
|
|
2965
|
+
constructor(params) {
|
|
2966
|
+
super(params);
|
|
2967
|
+
|
|
2968
|
+
if (Error.captureStackTrace) {
|
|
2969
|
+
Error.captureStackTrace(this, SeamlyOfflineError);
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
this.name = 'SeamlyOfflineError';
|
|
2973
|
+
this.langKey = 'errors.seamlyOffline';
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
}
|
|
2977
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unauthorized-error.js
|
|
2978
|
+
class SeamlyUnauthorizedError extends Error {
|
|
2979
|
+
constructor(params) {
|
|
2980
|
+
super(params);
|
|
2981
|
+
|
|
2982
|
+
if (Error.captureStackTrace) {
|
|
2983
|
+
Error.captureStackTrace(this, SeamlyUnauthorizedError);
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
this.name = 'SeamlyUnauthorizedError';
|
|
2987
|
+
this.langKey = 'errors.general';
|
|
2988
|
+
this.action = 'reset';
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
}
|
|
2992
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/middleware.js
|
|
2993
|
+
|
|
2994
|
+
|
|
2995
|
+
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError];
|
|
3000
|
+
function middleware_createMiddleware() {
|
|
3001
|
+
return () => next => action => {
|
|
3002
|
+
if (action.type === String(Actions.set)) {
|
|
3003
|
+
if (!handledErrorTypes.some(ErrorType => action.error instanceof ErrorType)) {
|
|
3004
|
+
throw action.error;
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
return next(action);
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
3011
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
|
|
3012
|
+
|
|
3013
|
+
|
|
3014
|
+
|
|
3015
|
+
|
|
3016
|
+
|
|
3017
|
+
|
|
2898
3018
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-commands.js
|
|
2899
3019
|
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
3020
|
|
|
@@ -2913,10 +3033,10 @@ function use_seamly_commands_defineProperty(obj, key, value) { if (key in obj) {
|
|
|
2913
3033
|
|
|
2914
3034
|
|
|
2915
3035
|
|
|
3036
|
+
|
|
2916
3037
|
const {
|
|
2917
3038
|
ADD_EVENT: use_seamly_commands_ADD_EVENT,
|
|
2918
3039
|
CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
|
|
2919
|
-
CLEAR_INTERRUPT: use_seamly_commands_CLEAR_INTERRUPT,
|
|
2920
3040
|
SET_IS_LOADING: use_seamly_commands_SET_IS_LOADING,
|
|
2921
3041
|
CLEAR_PARTICIPANTS: use_seamly_commands_CLEAR_PARTICIPANTS,
|
|
2922
3042
|
SET_HEADER_SUB_TITLE: use_seamly_commands_SET_HEADER_SUB_TITLE,
|
|
@@ -2925,25 +3045,19 @@ const {
|
|
|
2925
3045
|
SET_FEATURES: use_seamly_commands_SET_FEATURES,
|
|
2926
3046
|
RESET_UPLOAD_STATE: use_seamly_commands_RESET_UPLOAD_STATE,
|
|
2927
3047
|
RESET_ENTRY_STATE: use_seamly_commands_RESET_ENTRY_STATE
|
|
2928
|
-
} =
|
|
3048
|
+
} = seamly_utils_seamlyActions;
|
|
2929
3049
|
|
|
2930
3050
|
const use_seamly_commands_useSeamlyCommands = () => {
|
|
2931
3051
|
const api = useSeamlyApiContext();
|
|
2932
|
-
const
|
|
3052
|
+
const appConfig = useConfig();
|
|
2933
3053
|
const dispatch = useSeamlyDispatchContext();
|
|
2934
3054
|
const eventBus = useContext(SeamlyEventBusContext);
|
|
2935
|
-
const {
|
|
2936
|
-
setInterrupt
|
|
2937
|
-
} = useSeamlyInterrupt();
|
|
2938
3055
|
const hasResponded = useSeamlyHasUserResponded();
|
|
2939
3056
|
const hasConversation = useSeamlyHasConversation();
|
|
2940
3057
|
const {
|
|
2941
3058
|
visible: visibility
|
|
2942
3059
|
} = useSeamlyStateContext();
|
|
2943
3060
|
const unreadMessageCount = useSeamlyUnreadCount();
|
|
2944
|
-
const {
|
|
2945
|
-
config: appConfig
|
|
2946
|
-
} = seamlyState;
|
|
2947
3061
|
const emitEvent = useCallback((...args) => {
|
|
2948
3062
|
eventBus.emit(...args);
|
|
2949
3063
|
}, [eventBus]);
|
|
@@ -2967,9 +3081,7 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
2967
3081
|
dispatch({
|
|
2968
3082
|
type: use_seamly_commands_CLEAR_EVENTS
|
|
2969
3083
|
});
|
|
2970
|
-
dispatch(
|
|
2971
|
-
type: use_seamly_commands_CLEAR_INTERRUPT
|
|
2972
|
-
});
|
|
3084
|
+
dispatch(InterruptActions.clear());
|
|
2973
3085
|
dispatch({
|
|
2974
3086
|
type: use_seamly_commands_SET_IS_LOADING,
|
|
2975
3087
|
isLoading: true
|
|
@@ -3011,26 +3123,18 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3011
3123
|
initialState
|
|
3012
3124
|
});
|
|
3013
3125
|
} catch (error) {
|
|
3014
|
-
|
|
3126
|
+
dispatch(InterruptActions.set(error));
|
|
3015
3127
|
}
|
|
3016
|
-
}, [api, dispatch, appConfig
|
|
3017
|
-
const getMessageBase = useCallback(type => {
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
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]);
|
|
3128
|
+
}, [api, dispatch, appConfig]);
|
|
3129
|
+
const getMessageBase = useCallback(type => ({
|
|
3130
|
+
type,
|
|
3131
|
+
id: randomId(),
|
|
3132
|
+
transactionId: randomId(),
|
|
3133
|
+
participant: userParticipantId,
|
|
3134
|
+
fromClient: true,
|
|
3135
|
+
occurredAt: Date.now() * 1000,
|
|
3136
|
+
meta: {}
|
|
3137
|
+
}), []);
|
|
3034
3138
|
const getTextMessageBase = useCallback(bodyText => {
|
|
3035
3139
|
const base = getMessageBase('text');
|
|
3036
3140
|
return use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, base), {}, {
|
|
@@ -3076,7 +3180,7 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3076
3180
|
}
|
|
3077
3181
|
});
|
|
3078
3182
|
}, [dispatch, getTextMessageBase]);
|
|
3079
|
-
const addUploadBubble = useCallback((id, transactionId, occurredAt, contentType,
|
|
3183
|
+
const addUploadBubble = useCallback((id, transactionId, occurredAt, contentType, filename, filesize, url) => {
|
|
3080
3184
|
dispatch({
|
|
3081
3185
|
type: use_seamly_commands_ADD_EVENT,
|
|
3082
3186
|
event: {
|
|
@@ -3091,7 +3195,6 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3091
3195
|
meta: {},
|
|
3092
3196
|
body: {
|
|
3093
3197
|
contentType,
|
|
3094
|
-
deleteAt,
|
|
3095
3198
|
filename,
|
|
3096
3199
|
filesize,
|
|
3097
3200
|
url
|
|
@@ -3164,9 +3267,9 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3164
3267
|
});
|
|
3165
3268
|
}
|
|
3166
3269
|
}).catch(error => {
|
|
3167
|
-
|
|
3270
|
+
dispatch(InterruptActions.set(error));
|
|
3168
3271
|
});
|
|
3169
|
-
}, [api, dispatch
|
|
3272
|
+
}, [api, dispatch]);
|
|
3170
3273
|
return {
|
|
3171
3274
|
connect,
|
|
3172
3275
|
start,
|
|
@@ -3235,18 +3338,19 @@ function seamly_entry_hooks_defineProperty(obj, key, value) { if (key in obj) {
|
|
|
3235
3338
|
|
|
3236
3339
|
|
|
3237
3340
|
|
|
3341
|
+
|
|
3238
3342
|
const {
|
|
3239
3343
|
SET_BLOCK_AUTO_ENTRY_SWITCH: seamly_entry_hooks_SET_BLOCK_AUTO_ENTRY_SWITCH,
|
|
3240
3344
|
SET_ACTIVE_ENTRY_TYPE: seamly_entry_hooks_SET_ACTIVE_ENTRY_TYPE,
|
|
3241
3345
|
SET_USER_ENTRY_TYPE: seamly_entry_hooks_SET_USER_ENTRY_TYPE
|
|
3242
|
-
} =
|
|
3346
|
+
} = seamly_utils_seamlyActions;
|
|
3243
3347
|
const useSeamlyTyping = () => {
|
|
3244
3348
|
const {
|
|
3245
3349
|
sendAction
|
|
3246
3350
|
} = useSeamlyCommands();
|
|
3247
3351
|
const {
|
|
3248
3352
|
typing: typingConfig
|
|
3249
|
-
} =
|
|
3353
|
+
} = useConfig();
|
|
3250
3354
|
const {
|
|
3251
3355
|
features
|
|
3252
3356
|
} = useSeamlyOptions();
|
|
@@ -3367,7 +3471,7 @@ function use_seamly_stored_visibility_defineProperty(obj, key, value) { if (key
|
|
|
3367
3471
|
const use_seamly_stored_visibility_useSeamlyStoredVisibility = () => {
|
|
3368
3472
|
const {
|
|
3369
3473
|
layoutMode
|
|
3370
|
-
} =
|
|
3474
|
+
} = useConfig();
|
|
3371
3475
|
const key = 'visibility';
|
|
3372
3476
|
const {
|
|
3373
3477
|
get,
|
|
@@ -3398,12 +3502,13 @@ const use_seamly_stored_visibility_useSeamlyStoredVisibility = () => {
|
|
|
3398
3502
|
|
|
3399
3503
|
|
|
3400
3504
|
|
|
3505
|
+
|
|
3401
3506
|
const {
|
|
3402
3507
|
SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
|
|
3403
|
-
} =
|
|
3508
|
+
} = seamly_utils_seamlyActions;
|
|
3404
3509
|
|
|
3405
3510
|
const use_seamly_visibility_useSeamlyVisibility = () => {
|
|
3406
|
-
const config =
|
|
3511
|
+
const config = useConfig();
|
|
3407
3512
|
const {
|
|
3408
3513
|
layoutMode,
|
|
3409
3514
|
visibilityCallback
|
|
@@ -3478,7 +3583,7 @@ const use_seamly_visibility_useSeamlyVisibility = () => {
|
|
|
3478
3583
|
|
|
3479
3584
|
const {
|
|
3480
3585
|
SET_IS_LOADING: use_seamly_chat_SET_IS_LOADING
|
|
3481
|
-
} =
|
|
3586
|
+
} = seamly_utils_seamlyActions;
|
|
3482
3587
|
|
|
3483
3588
|
const useSeamlyChat = () => {
|
|
3484
3589
|
const {
|
|
@@ -3622,7 +3727,7 @@ const {
|
|
|
3622
3727
|
INIT_IDLE_DETACH_COUNTDOWN: use_seamly_idle_detach_countdown_INIT_IDLE_DETACH_COUNTDOWN,
|
|
3623
3728
|
DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER: use_seamly_idle_detach_countdown_DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER,
|
|
3624
3729
|
STOP_IDLE_DETACH_COUNTDOWN_COUNTER: use_seamly_idle_detach_countdown_STOP_IDLE_DETACH_COUNTDOWN_COUNTER
|
|
3625
|
-
} =
|
|
3730
|
+
} = seamly_utils_seamlyActions;
|
|
3626
3731
|
|
|
3627
3732
|
const useSeamlyIdleDetachCountdown = () => {
|
|
3628
3733
|
const dispatch = useSeamlyDispatchContext();
|
|
@@ -3764,7 +3869,7 @@ const useSeamlyIdleDetachCountdown = () => {
|
|
|
3764
3869
|
|
|
3765
3870
|
const {
|
|
3766
3871
|
CLEAR_RESUME_CONVERSATION_PROMPT: use_seamly_resume_conversation_prompt_CLEAR_RESUME_CONVERSATION_PROMPT
|
|
3767
|
-
} =
|
|
3872
|
+
} = seamly_utils_seamlyActions;
|
|
3768
3873
|
|
|
3769
3874
|
const useSeamlyResumeConversationPrompt = () => {
|
|
3770
3875
|
const dispatch = useSeamlyDispatchContext();
|
|
@@ -3832,7 +3937,6 @@ const useSeamlyResumeConversationPrompt = () => {
|
|
|
3832
3937
|
|
|
3833
3938
|
|
|
3834
3939
|
|
|
3835
|
-
|
|
3836
3940
|
// This hook isn't used within the core
|
|
3837
3941
|
// But it is used in implementations
|
|
3838
3942
|
// and imported directly from this file
|
|
@@ -4275,6 +4379,35 @@ function form_Form(_ref) {
|
|
|
4275
4379
|
}
|
|
4276
4380
|
|
|
4277
4381
|
/* harmony default export */ const form_controls_form = ((/* unused pure expression or super */ null && (form_Form)));
|
|
4382
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/components/form-controls/error.js
|
|
4383
|
+
|
|
4384
|
+
|
|
4385
|
+
|
|
4386
|
+
|
|
4387
|
+
|
|
4388
|
+
function error_Error({
|
|
4389
|
+
id,
|
|
4390
|
+
error
|
|
4391
|
+
}) {
|
|
4392
|
+
const [isAvailable, setIsAvailable] = useState(false);
|
|
4393
|
+
useEffect(() => {
|
|
4394
|
+
const timerId = setTimeout(() => setIsAvailable(true), 300); // 300 = magic number, could be less or more
|
|
4395
|
+
|
|
4396
|
+
return () => clearTimeout(timerId); // clear timer if error is mounted+unmounted within 300
|
|
4397
|
+
}, []);
|
|
4398
|
+
return _jsx("div", {
|
|
4399
|
+
"aria-live": "assertive",
|
|
4400
|
+
"aria-atomic": "true",
|
|
4401
|
+
children: isAvailable && error && _jsxs("span", {
|
|
4402
|
+
id: id,
|
|
4403
|
+
className: className('error'),
|
|
4404
|
+
children: [_jsx(Icon, {
|
|
4405
|
+
name: "error",
|
|
4406
|
+
size: "16"
|
|
4407
|
+
}), error]
|
|
4408
|
+
})
|
|
4409
|
+
});
|
|
4410
|
+
}
|
|
4278
4411
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/form-controls/wrapper.js
|
|
4279
4412
|
|
|
4280
4413
|
|
|
@@ -4300,17 +4433,9 @@ const wrapper_FormControlWrapper = ({
|
|
|
4300
4433
|
id: `${id}-content-hint`,
|
|
4301
4434
|
className: className('input__content-hint'),
|
|
4302
4435
|
children: contentHint
|
|
4303
|
-
}), _jsx(
|
|
4304
|
-
|
|
4305
|
-
|
|
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
|
-
})
|
|
4436
|
+
}), _jsx(Error, {
|
|
4437
|
+
id: `${id}-error`,
|
|
4438
|
+
error: !validity && errorText
|
|
4314
4439
|
}), children]
|
|
4315
4440
|
});
|
|
4316
4441
|
};
|
|
@@ -4807,6 +4932,7 @@ function chat_status_ChatStatus({
|
|
|
4807
4932
|
|
|
4808
4933
|
|
|
4809
4934
|
|
|
4935
|
+
|
|
4810
4936
|
function TranslationsChatStatus() {
|
|
4811
4937
|
const {
|
|
4812
4938
|
t
|
|
@@ -4816,7 +4942,7 @@ function TranslationsChatStatus() {
|
|
|
4816
4942
|
} = useTranslationsContainer();
|
|
4817
4943
|
const {
|
|
4818
4944
|
hasInterrupt
|
|
4819
|
-
} =
|
|
4945
|
+
} = useInterrupt();
|
|
4820
4946
|
const {
|
|
4821
4947
|
isActive,
|
|
4822
4948
|
disableTranslations,
|
|
@@ -4856,7 +4982,7 @@ function TranslationsChatStatus() {
|
|
|
4856
4982
|
|
|
4857
4983
|
|
|
4858
4984
|
;// CONCATENATED MODULE: ./src/javascripts/style-guide/components/static-core.js
|
|
4859
|
-
const static_core_excluded = ["translations"];
|
|
4985
|
+
const static_core_excluded = ["translations", "interrupt", "config"];
|
|
4860
4986
|
|
|
4861
4987
|
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
4988
|
|
|
@@ -4869,6 +4995,8 @@ function static_core_objectWithoutPropertiesLoose(source, excluded) { if (source
|
|
|
4869
4995
|
|
|
4870
4996
|
|
|
4871
4997
|
|
|
4998
|
+
|
|
4999
|
+
|
|
4872
5000
|
const bareApi = {
|
|
4873
5001
|
send: () => {},
|
|
4874
5002
|
reset: () => {
|
|
@@ -4891,19 +5019,29 @@ const SeamlyTestCore = ({
|
|
|
4891
5019
|
const store = (0,hooks_namespaceObject.useMemo)(() => {
|
|
4892
5020
|
const _ref = state || {},
|
|
4893
5021
|
{
|
|
4894
|
-
translations: translationsSlice
|
|
5022
|
+
translations: translationsSlice,
|
|
5023
|
+
interrupt: interruptSlice,
|
|
5024
|
+
config: configSlice
|
|
4895
5025
|
} = _ref,
|
|
4896
5026
|
restState = static_core_objectWithoutProperties(_ref, static_core_excluded);
|
|
4897
5027
|
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
5028
|
+
const newStore = (0,web_ui_namespaceObject.createReduxStore)({
|
|
5029
|
+
reducers: {
|
|
5030
|
+
state: stateReducer,
|
|
5031
|
+
[String(config_reducer)]: config_reducer,
|
|
5032
|
+
[String(reducer)]: reducer,
|
|
5033
|
+
[String(translations_reducer)]: translations_reducer,
|
|
5034
|
+
[String(Reducer)]: Reducer,
|
|
5035
|
+
[String(interrupt_reducer)]: interrupt_reducer
|
|
5036
|
+
},
|
|
5037
|
+
initialState: {
|
|
5038
|
+
state: restState,
|
|
5039
|
+
[String(translations_reducer)]: translationsSlice,
|
|
5040
|
+
[String(interrupt_reducer)]: interruptSlice
|
|
5041
|
+
}
|
|
4906
5042
|
});
|
|
5043
|
+
newStore.dispatch(initialize(configSlice || {}));
|
|
5044
|
+
return newStore;
|
|
4907
5045
|
}, [state]);
|
|
4908
5046
|
return state && (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.StoreProvider, {
|
|
4909
5047
|
store: store,
|
|
@@ -5043,7 +5181,8 @@ const baseState = {
|
|
|
5043
5181
|
layoutMode: 'inline',
|
|
5044
5182
|
accountConfig: {},
|
|
5045
5183
|
hideOnNoUserResponse: false,
|
|
5046
|
-
showFaq: false
|
|
5184
|
+
showFaq: false,
|
|
5185
|
+
showDisclaimer: false
|
|
5047
5186
|
},
|
|
5048
5187
|
initialState: {},
|
|
5049
5188
|
unreadEvents: 0,
|
|
@@ -5066,14 +5205,12 @@ const baseState = {
|
|
|
5066
5205
|
subTitle: 'Test subtitle'
|
|
5067
5206
|
},
|
|
5068
5207
|
interrupt: {
|
|
5069
|
-
|
|
5070
|
-
meta: {}
|
|
5208
|
+
error: undefined
|
|
5071
5209
|
},
|
|
5072
5210
|
historyLoaded: false,
|
|
5073
5211
|
skiplinkTargetId: (0,web_ui_namespaceObject.randomId)(),
|
|
5074
5212
|
optionsButtonId: (0,web_ui_namespaceObject.randomId)(),
|
|
5075
5213
|
cobrowseContainerId: (0,web_ui_namespaceObject.randomId)(),
|
|
5076
|
-
showDisclaimer: false,
|
|
5077
5214
|
serviceData: {},
|
|
5078
5215
|
options: {
|
|
5079
5216
|
features: {},
|
|
@@ -5370,7 +5507,7 @@ const ctaMessage = {
|
|
|
5370
5507
|
type: 'message',
|
|
5371
5508
|
payload: {
|
|
5372
5509
|
body: {
|
|
5373
|
-
description: '
|
|
5510
|
+
description: 'Thanks for chatting!\n\nMore info about our **products**?',
|
|
5374
5511
|
buttonLink: 'https://seamly.ai',
|
|
5375
5512
|
buttonText: 'View website',
|
|
5376
5513
|
buttonNewTab: true
|
|
@@ -5660,7 +5797,8 @@ const choicePromptMessage = {
|
|
|
5660
5797
|
type: 'choice'
|
|
5661
5798
|
}, {
|
|
5662
5799
|
id: '9fd9a28f-462d-4f07-9661-606dbe3b9466',
|
|
5663
|
-
|
|
5800
|
+
category: 'secondary',
|
|
5801
|
+
text: 'Something else',
|
|
5664
5802
|
type: 'choice'
|
|
5665
5803
|
}],
|
|
5666
5804
|
chooseAgain: true,
|
|
@@ -5730,7 +5868,6 @@ const fileDownloadPayload = {
|
|
|
5730
5868
|
meta: {},
|
|
5731
5869
|
body: {
|
|
5732
5870
|
contentType: 'image/jpg',
|
|
5733
|
-
deleteAt: 1000 * (Date.now() + 3600000),
|
|
5734
5871
|
filename: 'placeholder.jpg',
|
|
5735
5872
|
filesize: 991078,
|
|
5736
5873
|
url: 'https://via.placeholder.com/150'
|
|
@@ -5747,9 +5884,7 @@ const fileDownloadAgentMessage = {
|
|
|
5747
5884
|
|
|
5748
5885
|
const deletedFileDownloadAgentMessage = states_objectSpread(states_objectSpread({}, fileDownloadAgentMessage), {}, {
|
|
5749
5886
|
payload: states_objectSpread(states_objectSpread({}, fileDownloadAgentMessage.payload), {}, {
|
|
5750
|
-
body: states_objectSpread(
|
|
5751
|
-
deleteAt: 1000 * (Date.now() - 3600000)
|
|
5752
|
-
}),
|
|
5887
|
+
body: states_objectSpread({}, fileDownloadAgentMessage.payload.body),
|
|
5753
5888
|
id: (0,web_ui_namespaceObject.randomId)()
|
|
5754
5889
|
})
|
|
5755
5890
|
});
|
|
@@ -5763,16 +5898,6 @@ const fileDownloadUserMessage = {
|
|
|
5763
5898
|
})
|
|
5764
5899
|
};
|
|
5765
5900
|
|
|
5766
|
-
const deletedFileDownloadUserMessage = states_objectSpread(states_objectSpread({}, fileDownloadUserMessage), {}, {
|
|
5767
|
-
payload: states_objectSpread(states_objectSpread({
|
|
5768
|
-
id: (0,web_ui_namespaceObject.randomId)()
|
|
5769
|
-
}, fileDownloadUserMessage.payload), {}, {
|
|
5770
|
-
body: states_objectSpread(states_objectSpread({}, fileDownloadUserMessage.payload.body), {}, {
|
|
5771
|
-
deleteAt: 1000 * (Date.now() - 3600000)
|
|
5772
|
-
})
|
|
5773
|
-
})
|
|
5774
|
-
});
|
|
5775
|
-
|
|
5776
5901
|
const emptyUrlFileDownloadUserMessage = states_objectSpread(states_objectSpread({}, fileDownloadUserMessage), {}, {
|
|
5777
5902
|
payload: states_objectSpread(states_objectSpread({}, fileDownloadUserMessage.payload), {}, {
|
|
5778
5903
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
@@ -5872,7 +5997,7 @@ const cardAskText = {
|
|
|
5872
5997
|
type: 'ask'
|
|
5873
5998
|
},
|
|
5874
5999
|
buttonText: 'Ask about pizzas!',
|
|
5875
|
-
description: 'Pizza Margherita is a typical Neapolitan pizza.',
|
|
6000
|
+
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.',
|
|
5876
6001
|
image: 'https://via.placeholder.com/400x200/dee3e5/6a7f8c?text=Margherita',
|
|
5877
6002
|
title: 'Pizza Margherita'
|
|
5878
6003
|
}
|
|
@@ -5890,7 +6015,7 @@ const cardNavigate = {
|
|
|
5890
6015
|
type: 'navigate'
|
|
5891
6016
|
},
|
|
5892
6017
|
buttonText: 'Order now!',
|
|
5893
|
-
description: 'Pizza Margherita is a typical Neapolitan pizza
|
|
6018
|
+
description: 'Pizza Margherita is a **typical Neapolitan pizza**.',
|
|
5894
6019
|
image: 'https://via.placeholder.com/400x200/dee3e5/6a7f8c?text=Margherita',
|
|
5895
6020
|
title: 'Pizza Margherita'
|
|
5896
6021
|
}
|
|
@@ -5932,7 +6057,7 @@ const standardState = {
|
|
|
5932
6057
|
payload: states_objectSpread(states_objectSpread({}, choicePromptMessage.payload), {}, {
|
|
5933
6058
|
id: `${choicePromptMessage.payload.id}XXX`
|
|
5934
6059
|
})
|
|
5935
|
-
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage,
|
|
6060
|
+
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage]
|
|
5936
6061
|
}),
|
|
5937
6062
|
userMessages: states_objectSpread(states_objectSpread({
|
|
5938
6063
|
category: categoryKeys.messages,
|
|
@@ -5940,7 +6065,7 @@ const standardState = {
|
|
|
5940
6065
|
description: ''
|
|
5941
6066
|
}, baseState), {}, {
|
|
5942
6067
|
participantInfo,
|
|
5943
|
-
events: [userMessage, userMessageLong, fileDownloadUserMessage,
|
|
6068
|
+
events: [userMessage, userMessageLong, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage]
|
|
5944
6069
|
}),
|
|
5945
6070
|
withParticipants: states_objectSpread(states_objectSpread({
|
|
5946
6071
|
category: categoryKeys.messages,
|
|
@@ -6152,12 +6277,7 @@ const standardState = {
|
|
|
6152
6277
|
description: ''
|
|
6153
6278
|
}, baseState), {}, {
|
|
6154
6279
|
interrupt: {
|
|
6155
|
-
|
|
6156
|
-
meta: {
|
|
6157
|
-
title: 'Connection issues',
|
|
6158
|
-
message: 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
|
|
6159
|
-
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.'
|
|
6160
|
-
}
|
|
6280
|
+
error: new web_ui_namespaceObject.SeamlyOfflineError()
|
|
6161
6281
|
}
|
|
6162
6282
|
}),
|
|
6163
6283
|
generalErrorInterrupt: states_objectSpread(states_objectSpread({
|
|
@@ -6167,14 +6287,7 @@ const standardState = {
|
|
|
6167
6287
|
description: ''
|
|
6168
6288
|
}, baseState), {}, {
|
|
6169
6289
|
interrupt: {
|
|
6170
|
-
|
|
6171
|
-
meta: {
|
|
6172
|
-
title: 'Something went wrong',
|
|
6173
|
-
message: 'Do you want to start a new chat session?',
|
|
6174
|
-
buttonText: 'Restart chat',
|
|
6175
|
-
action: 'reset',
|
|
6176
|
-
srText: 'Something went wrong with the chat session. You can restart the chat.'
|
|
6177
|
-
}
|
|
6290
|
+
error: new web_ui_namespaceObject.SeamlyGeneralError()
|
|
6178
6291
|
}
|
|
6179
6292
|
}),
|
|
6180
6293
|
configErrorInterrupt: states_objectSpread(states_objectSpread({
|
|
@@ -6184,12 +6297,7 @@ const standardState = {
|
|
|
6184
6297
|
description: ''
|
|
6185
6298
|
}, baseState), {}, {
|
|
6186
6299
|
interrupt: {
|
|
6187
|
-
|
|
6188
|
-
meta: {
|
|
6189
|
-
title: 'Chat configuration error.',
|
|
6190
|
-
message: 'We are sorry this happened, please retry at a later time.',
|
|
6191
|
-
srText: 'A chat configuration error occurred. Our apologies, please retry at a later time.'
|
|
6192
|
-
}
|
|
6300
|
+
error: new web_ui_namespaceObject.SeamlyConfigurationError()
|
|
6193
6301
|
}
|
|
6194
6302
|
}),
|
|
6195
6303
|
privacyDisclaimer: states_objectSpread(states_objectSpread({
|
|
@@ -6199,8 +6307,7 @@ const standardState = {
|
|
|
6199
6307
|
}, baseState), {}, {
|
|
6200
6308
|
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
6201
6309
|
showDisclaimer: true
|
|
6202
|
-
})
|
|
6203
|
-
showDisclaimer: true
|
|
6310
|
+
})
|
|
6204
6311
|
}),
|
|
6205
6312
|
cobrowserBar: states_objectSpread(states_objectSpread({
|
|
6206
6313
|
category: categoryKeys.features,
|
|
@@ -6742,7 +6849,7 @@ const standardState = {
|
|
|
6742
6849
|
payload: states_objectSpread(states_objectSpread({}, choicePromptMessage.payload), {}, {
|
|
6743
6850
|
id: `${choicePromptMessage.payload.id}XXX`
|
|
6744
6851
|
})
|
|
6745
|
-
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, newTranslationDividerStart, newTranslationDividerStop, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage,
|
|
6852
|
+
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, newTranslationDividerStart, newTranslationDividerStop, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage].map(addTranslationData),
|
|
6746
6853
|
translations: states_objectSpread(states_objectSpread({}, translationsSlice), {}, {
|
|
6747
6854
|
currentLocale: 'nl',
|
|
6748
6855
|
isActive: true,
|
|
@@ -7002,7 +7109,6 @@ const StyleGuideApp = ({
|
|
|
7002
7109
|
}, [setStaticState, stateUpdateCallback]);
|
|
7003
7110
|
const getState = (0,hooks_namespaceObject.useCallback)((layoutMode, feature) => {
|
|
7004
7111
|
const {
|
|
7005
|
-
showDisclaimer,
|
|
7006
7112
|
defaults
|
|
7007
7113
|
} = config;
|
|
7008
7114
|
const {
|
|
@@ -7019,14 +7125,13 @@ const StyleGuideApp = ({
|
|
|
7019
7125
|
} = defaults || {};
|
|
7020
7126
|
|
|
7021
7127
|
const updatedState = app_objectSpread(app_objectSpread({}, bareState), {}, {
|
|
7022
|
-
config: app_objectSpread(app_objectSpread(app_objectSpread(app_objectSpread({}, bareState.config),
|
|
7128
|
+
config: app_objectSpread(app_objectSpread(app_objectSpread(app_objectSpread({}, bareState.config), config), {}, {
|
|
7023
7129
|
layoutMode: bareState.config.layoutMode
|
|
7024
7130
|
}, overrideMessages ? {
|
|
7025
7131
|
messages: overrideMessages
|
|
7026
7132
|
} : {}), {}, {
|
|
7027
7133
|
showFaq
|
|
7028
7134
|
}),
|
|
7029
|
-
showDisclaimer: showDisclaimer != null ? showDisclaimer : bareState.showDisclaimer,
|
|
7030
7135
|
headerTitles: app_objectSpread(app_objectSpread({}, bareState.headerTitles), {}, {
|
|
7031
7136
|
subTitle: agentName || bareState.headerTitles.subTitle
|
|
7032
7137
|
})
|
|
@@ -7158,7 +7263,7 @@ class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
|
|
|
7158
7263
|
}
|
|
7159
7264
|
|
|
7160
7265
|
render() {
|
|
7161
|
-
const restComponents = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.customComponents || {}), {}, {
|
|
7266
|
+
const restComponents = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config.customComponents || {}), {}, {
|
|
7162
7267
|
view: undefined
|
|
7163
7268
|
});
|
|
7164
7269
|
|