@seamly/web-ui 19.0.0-beta.3 → 19.1.2
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 +149 -61
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +40 -8
- package/build/dist/lib/index.js +494 -416
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +582 -435
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +1880 -1795
- package/build/dist/lib/style-guide.min.js +1 -1
- package/package.json +1 -1
- package/src/javascripts/api/errors/seamly-base-error.js +10 -0
- package/src/javascripts/api/errors/seamly-configuration-error.js +4 -6
- package/src/javascripts/api/errors/seamly-general-error.js +4 -6
- package/src/javascripts/api/errors/seamly-offline-error.js +4 -6
- package/src/javascripts/api/errors/seamly-session-expired-error.js +4 -6
- package/src/javascripts/api/errors/seamly-unauthorized-error.js +4 -6
- package/src/javascripts/api/errors/seamly-unavailable-error.js +17 -0
- package/src/javascripts/api/index.js +10 -11
- package/src/javascripts/domains/app/actions.js +27 -17
- package/src/javascripts/domains/app/index.js +2 -1
- package/src/javascripts/domains/config/reducer.js +1 -0
- package/src/javascripts/domains/config/selectors.js +1 -1
- package/src/javascripts/domains/errors/index.js +32 -0
- package/src/javascripts/domains/i18n/reducer.js +6 -0
- package/src/javascripts/domains/interrupt/middleware.js +12 -9
- package/src/javascripts/domains/interrupt/reducer.js +10 -9
- package/src/javascripts/domains/store/index.js +7 -2
- package/src/javascripts/domains/store/state-reducer.js +10 -6
- package/src/javascripts/domains/visibility/actions.js +73 -0
- package/src/javascripts/domains/visibility/constants.js +8 -0
- package/src/javascripts/domains/visibility/hooks.js +24 -0
- package/src/javascripts/domains/visibility/index.js +8 -0
- package/src/javascripts/domains/visibility/reducer.js +19 -0
- package/src/javascripts/domains/visibility/selectors.js +9 -0
- package/src/javascripts/domains/visibility/utils.js +42 -0
- package/src/javascripts/index.js +3 -12
- package/src/javascripts/lib/engine/index.js +1 -0
- package/src/javascripts/lib/redux-helpers/index.js +1 -5
- package/src/javascripts/style-guide/components/app.js +1 -1
- package/src/javascripts/style-guide/components/static-core.js +13 -0
- package/src/javascripts/style-guide/states.js +48 -21
- package/src/javascripts/ui/components/conversation/conversation.js +2 -2
- package/src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js +1 -8
- package/src/javascripts/ui/components/conversation/event/text.js +19 -13
- package/src/javascripts/ui/components/core/seamly-core.js +3 -0
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +3 -3
- package/src/javascripts/ui/components/core/seamly-initializer.js +2 -6
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +2 -3
- package/src/javascripts/ui/components/core/seamly-new-notifications.js +2 -2
- package/src/javascripts/ui/components/core/seamly-read-state.js +2 -2
- package/src/javascripts/ui/components/entry/toggle-button.js +2 -2
- package/src/javascripts/ui/components/layout/agent-info.js +2 -2
- package/src/javascripts/ui/components/layout/app-frame.js +2 -3
- package/src/javascripts/ui/components/layout/chat-frame.js +2 -2
- package/src/javascripts/ui/components/layout/modal-wrapper.js +3 -6
- package/src/javascripts/ui/components/layout/view.js +3 -6
- package/src/javascripts/ui/hooks/seamly-hooks.js +0 -2
- package/src/javascripts/ui/hooks/use-seamly-chat.js +3 -5
- package/src/javascripts/ui/hooks/use-seamly-commands.js +7 -29
- package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +2 -2
- package/src/javascripts/ui/utils/general-utils.js +0 -9
- package/src/javascripts/ui/utils/seamly-utils.js +0 -66
- package/src/javascripts/ui/hooks/use-seamly-stored-visibility.js +0 -31
- package/src/javascripts/ui/hooks/use-seamly-visibility.js +0 -98
|
@@ -48,6 +48,27 @@ const web_ui_namespaceObject = require("@seamly/web-ui");
|
|
|
48
48
|
const external_preact_namespaceObject = require("preact");
|
|
49
49
|
;// CONCATENATED MODULE: external "preact/hooks"
|
|
50
50
|
const hooks_namespaceObject = require("preact/hooks");
|
|
51
|
+
;// CONCATENATED MODULE: ./node_modules/redux-thunk/es/index.js
|
|
52
|
+
function createThunkMiddleware(extraArgument) {
|
|
53
|
+
return function (_ref) {
|
|
54
|
+
var dispatch = _ref.dispatch,
|
|
55
|
+
getState = _ref.getState;
|
|
56
|
+
return function (next) {
|
|
57
|
+
return function (action) {
|
|
58
|
+
if (typeof action === 'function') {
|
|
59
|
+
return action(dispatch, getState, extraArgument);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return next(action);
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var thunk = createThunkMiddleware();
|
|
69
|
+
thunk.withExtraArgument = createThunkMiddleware;
|
|
70
|
+
|
|
71
|
+
/* harmony default export */ const es = (thunk);
|
|
51
72
|
;// CONCATENATED MODULE: ./src/javascripts/lib/id.js
|
|
52
73
|
function id_randomId() {
|
|
53
74
|
return '_' + (Number(String(Math.random()).slice(2)) + Date.now() + Math.round(performance.now())).toString(36);
|
|
@@ -145,7 +166,6 @@ const general_utils_millisecondsToSeconds = milliseconds => {
|
|
|
145
166
|
const microsecondsToMilliseconds = microseconds => {
|
|
146
167
|
return Math.ceil(microseconds / 1000);
|
|
147
168
|
};
|
|
148
|
-
const general_utils_sanitizeText = text => text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g, '/');
|
|
149
169
|
const general_utils_getTimeFromSeconds = seconds => {
|
|
150
170
|
const minutes = Math.floor(seconds / 60);
|
|
151
171
|
const secondsPartial = seconds - minutes * 60;
|
|
@@ -270,12 +290,6 @@ const entryTypes = {
|
|
|
270
290
|
text: 'text',
|
|
271
291
|
upload: 'upload'
|
|
272
292
|
};
|
|
273
|
-
const seamly_utils_visibilityStates = {
|
|
274
|
-
hidden: 'hidden',
|
|
275
|
-
minimized: 'minimized',
|
|
276
|
-
open: 'open',
|
|
277
|
-
initialize: null
|
|
278
|
-
};
|
|
279
293
|
const readStates = {
|
|
280
294
|
received: 'received',
|
|
281
295
|
read: 'read'
|
|
@@ -322,7 +336,6 @@ const seamly_utils_seamlyActions = {
|
|
|
322
336
|
SET_PARTICIPANT: 'SET_PARTICIPANT',
|
|
323
337
|
SET_HEADER_TITLE: 'SET_HEADER_TITLE',
|
|
324
338
|
SET_HEADER_SUB_TITLE: 'SET_HEADER_SUB_TITLE',
|
|
325
|
-
SET_VISIBILITY: 'SET_VISIBILITY',
|
|
326
339
|
RESET_HISTORY_LOADED_FLAG: 'RESET_HISTORY_LOADED_FLAG',
|
|
327
340
|
SET_ACTIVE_SERVICE: 'SET_ACTIVE_SERVICE',
|
|
328
341
|
INIT_IDLE_DETACH_COUNTDOWN: 'INIT_IDLE_DETACH_COUNTDOWN',
|
|
@@ -350,8 +363,6 @@ const seamly_utils_seamlyActions = {
|
|
|
350
363
|
SET_UPLOAD_ERROR: 'SET_UPLOAD_ERROR',
|
|
351
364
|
CLEAR_UPLOAD: 'CLEAR_UPLOAD',
|
|
352
365
|
CLEAR_ALL_UPLOADS: 'CLEAR_ALL_UPLOADS',
|
|
353
|
-
RESET_UPLOAD_STATE: 'RESET_UPLOAD_STATE',
|
|
354
|
-
RESET_ENTRY_STATE: 'RESET_ENTRY_STATE',
|
|
355
366
|
SET_SEAMLY_CONTAINER_ELEMENT: 'SET_SEAMLY_CONTAINER_ELEMENT'
|
|
356
367
|
};
|
|
357
368
|
const cardTypes = {
|
|
@@ -370,7 +381,6 @@ const {
|
|
|
370
381
|
SET_PARTICIPANT,
|
|
371
382
|
SET_HEADER_TITLE,
|
|
372
383
|
SET_HEADER_SUB_TITLE,
|
|
373
|
-
SET_VISIBILITY,
|
|
374
384
|
RESET_HISTORY_LOADED_FLAG,
|
|
375
385
|
SET_ACTIVE_SERVICE,
|
|
376
386
|
INIT_IDLE_DETACH_COUNTDOWN,
|
|
@@ -398,8 +408,6 @@ const {
|
|
|
398
408
|
SET_UPLOAD_ERROR,
|
|
399
409
|
CLEAR_UPLOAD,
|
|
400
410
|
CLEAR_ALL_UPLOADS,
|
|
401
|
-
RESET_UPLOAD_STATE,
|
|
402
|
-
RESET_ENTRY_STATE,
|
|
403
411
|
SET_SEAMLY_CONTAINER_ELEMENT
|
|
404
412
|
} = seamly_utils_seamlyActions;
|
|
405
413
|
const isUnreadMessage = ({
|
|
@@ -778,11 +786,6 @@ const seamlyStateReducer = (state, action) => {
|
|
|
778
786
|
resumeConversationPrompt: false
|
|
779
787
|
});
|
|
780
788
|
|
|
781
|
-
case SET_VISIBILITY:
|
|
782
|
-
return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
|
|
783
|
-
visible: action.visible
|
|
784
|
-
});
|
|
785
|
-
|
|
786
789
|
case SET_PARTICIPANT:
|
|
787
790
|
case CLEAR_PARTICIPANTS:
|
|
788
791
|
return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
|
|
@@ -990,26 +993,6 @@ const seamlyStateReducer = (state, action) => {
|
|
|
990
993
|
currentUploads: []
|
|
991
994
|
});
|
|
992
995
|
|
|
993
|
-
case RESET_UPLOAD_STATE:
|
|
994
|
-
return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
|
|
995
|
-
showFileUpload: false,
|
|
996
|
-
currentUploads: []
|
|
997
|
-
});
|
|
998
|
-
|
|
999
|
-
case RESET_ENTRY_STATE:
|
|
1000
|
-
{
|
|
1001
|
-
return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
|
|
1002
|
-
entryMeta: {
|
|
1003
|
-
default: payloadTypes.text,
|
|
1004
|
-
active: payloadTypes.text,
|
|
1005
|
-
userSelected: null,
|
|
1006
|
-
blockAutoEntrySwitch: false,
|
|
1007
|
-
options: {},
|
|
1008
|
-
optionsOverride: {}
|
|
1009
|
-
}
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
996
|
case SET_SEAMLY_CONTAINER_ELEMENT:
|
|
1014
997
|
{
|
|
1015
998
|
return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
|
|
@@ -1021,81 +1004,6 @@ const seamlyStateReducer = (state, action) => {
|
|
|
1021
1004
|
return state;
|
|
1022
1005
|
}
|
|
1023
1006
|
};
|
|
1024
|
-
const seamly_utils_calculateVisibility = ({
|
|
1025
|
-
hasResponded,
|
|
1026
|
-
previousVisibility,
|
|
1027
|
-
requestedVisibility,
|
|
1028
|
-
config
|
|
1029
|
-
}) => {
|
|
1030
|
-
const {
|
|
1031
|
-
defaults,
|
|
1032
|
-
layoutMode,
|
|
1033
|
-
hideOnNoUserResponse
|
|
1034
|
-
} = config;
|
|
1035
|
-
const {
|
|
1036
|
-
visible: defaultVisibility
|
|
1037
|
-
} = defaults || {}; // Requesting open should override the responded check.
|
|
1038
|
-
|
|
1039
|
-
if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== seamly_utils_visibilityStates.open) {
|
|
1040
|
-
return hasResponded ? requestedVisibility || previousVisibility || seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.hidden;
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
const baseVisibility = layoutMode === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized;
|
|
1044
|
-
return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
|
|
1045
|
-
};
|
|
1046
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/store/state-reducer.js
|
|
1047
|
-
// Legacy state reducer. Do not add new features here but extract/create new reducers as needed
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
const initialState = {
|
|
1051
|
-
events: [],
|
|
1052
|
-
initialState: {},
|
|
1053
|
-
unreadEvents: 0,
|
|
1054
|
-
isLoading: false,
|
|
1055
|
-
idleDetachCountdown: {
|
|
1056
|
-
hasCountdown: false,
|
|
1057
|
-
isActive: false
|
|
1058
|
-
},
|
|
1059
|
-
resumeConversationPrompt: false,
|
|
1060
|
-
visible: seamly_utils_visibilityStates.hidden,
|
|
1061
|
-
serviceInfo: {
|
|
1062
|
-
activeServiceSessionId: ''
|
|
1063
|
-
},
|
|
1064
|
-
participantInfo: {
|
|
1065
|
-
participants: {},
|
|
1066
|
-
currentAgent: ''
|
|
1067
|
-
},
|
|
1068
|
-
headerTitles: {
|
|
1069
|
-
title: null,
|
|
1070
|
-
subTitle: ''
|
|
1071
|
-
},
|
|
1072
|
-
historyLoaded: false,
|
|
1073
|
-
skiplinkTargetId: id_randomId(),
|
|
1074
|
-
optionsButtonId: id_randomId(),
|
|
1075
|
-
cobrowsingContainerId: id_randomId(),
|
|
1076
|
-
headerCollapseButtonId: id_randomId(),
|
|
1077
|
-
serviceData: {},
|
|
1078
|
-
options: {
|
|
1079
|
-
features: {},
|
|
1080
|
-
panelActive: false,
|
|
1081
|
-
optionActive: '',
|
|
1082
|
-
userSelectedOptions: {}
|
|
1083
|
-
},
|
|
1084
|
-
showFileUpload: false,
|
|
1085
|
-
currentUploads: [],
|
|
1086
|
-
entryMeta: {
|
|
1087
|
-
default: entryTypes.text,
|
|
1088
|
-
active: entryTypes.text,
|
|
1089
|
-
userSelected: null,
|
|
1090
|
-
blockAutoEntrySwitch: false,
|
|
1091
|
-
options: {},
|
|
1092
|
-
optionsOverride: {}
|
|
1093
|
-
},
|
|
1094
|
-
seamlyContainerElement: null
|
|
1095
|
-
};
|
|
1096
|
-
function stateReducer(state = initialState, action) {
|
|
1097
|
-
return seamlyStateReducer(state, action);
|
|
1098
|
-
}
|
|
1099
1007
|
;// CONCATENATED MODULE: ./src/javascripts/lib/redux-helpers/index.js
|
|
1100
1008
|
function redux_helpers_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; }
|
|
1101
1009
|
|
|
@@ -1207,12 +1115,7 @@ function createThunk(type, payloadCreator) {
|
|
|
1207
1115
|
});
|
|
1208
1116
|
}
|
|
1209
1117
|
function createReducer(domain, handlers = {}, defaultState) {
|
|
1210
|
-
const reducer = (state, action) => {
|
|
1211
|
-
if (state === undefined) {
|
|
1212
|
-
// eslint-disable-next-line no-param-reassign
|
|
1213
|
-
state = defaultState;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1118
|
+
const reducer = (state = defaultState, action) => {
|
|
1216
1119
|
const typeReducer = handlers === null || handlers === void 0 ? void 0 : handlers[action === null || action === void 0 ? void 0 : action.type];
|
|
1217
1120
|
return typeReducer ? typeReducer(state, action) : state;
|
|
1218
1121
|
};
|
|
@@ -1230,63 +1133,22 @@ function createDomain(domain) {
|
|
|
1230
1133
|
selectState: state => state[domain]
|
|
1231
1134
|
};
|
|
1232
1135
|
}
|
|
1233
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/
|
|
1136
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/utils.js
|
|
1234
1137
|
|
|
1235
1138
|
const {
|
|
1236
|
-
|
|
1139
|
+
createAction: utils_createAction,
|
|
1140
|
+
createThunk: utils_createThunk,
|
|
1237
1141
|
createReducer: utils_createReducer,
|
|
1238
1142
|
selectState
|
|
1239
|
-
} = createDomain('
|
|
1240
|
-
|
|
1241
|
-
return Object.entries(schema).reduce((errors, [key, validations]) => {
|
|
1242
|
-
if (validations && !Array.isArray(validations)) {
|
|
1243
|
-
// eslint-disable-next-line no-param-reassign
|
|
1244
|
-
validations = [validations];
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
for (let i = 0; i < ((_validations = validations) === null || _validations === void 0 ? void 0 : _validations.length) ?? 0; i++) {
|
|
1248
|
-
var _validations;
|
|
1249
|
-
|
|
1250
|
-
if (!validations[i].fn(values[key], validations[i].compareValue)) {
|
|
1251
|
-
errors[key] = validations[i].errorText;
|
|
1252
|
-
break;
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
return errors;
|
|
1257
|
-
}, {});
|
|
1258
|
-
}
|
|
1259
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/actions.js
|
|
1143
|
+
} = createDomain('config');
|
|
1144
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
|
|
1260
1145
|
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
formId
|
|
1268
|
-
})
|
|
1269
|
-
});
|
|
1270
|
-
const [registerControl, deregisterControl, updateControlValue, updateControlTouched] = utils_createActions('control', {
|
|
1271
|
-
register: (formId, name) => ({
|
|
1272
|
-
formId,
|
|
1273
|
-
name
|
|
1274
|
-
}),
|
|
1275
|
-
deregister: (formId, name) => ({
|
|
1276
|
-
formId,
|
|
1277
|
-
name
|
|
1278
|
-
}),
|
|
1279
|
-
updateValue: (formId, name, value) => ({
|
|
1280
|
-
formId,
|
|
1281
|
-
name,
|
|
1282
|
-
value
|
|
1283
|
-
}),
|
|
1284
|
-
updateTouched: (formId, name, touched) => ({
|
|
1285
|
-
formId,
|
|
1286
|
-
name,
|
|
1287
|
-
touched
|
|
1288
|
-
})
|
|
1289
|
-
});
|
|
1146
|
+
const initialize = utils_createAction('initialize', config => ({
|
|
1147
|
+
config
|
|
1148
|
+
}));
|
|
1149
|
+
const update = utils_createAction('update', config => ({
|
|
1150
|
+
config
|
|
1151
|
+
}));
|
|
1290
1152
|
;// CONCATENATED MODULE: ./node_modules/reselect/es/index.js
|
|
1291
1153
|
function defaultEqualityCheck(a, b) {
|
|
1292
1154
|
return a === b;
|
|
@@ -1408,45 +1270,39 @@ function createStructuredSelector(selectors) {
|
|
|
1408
1270
|
}, {});
|
|
1409
1271
|
});
|
|
1410
1272
|
}
|
|
1411
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1273
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/constants.js
|
|
1274
|
+
const StoreKey = 'visibility';
|
|
1275
|
+
const constants_visibilityStates = {
|
|
1276
|
+
hidden: 'hidden',
|
|
1277
|
+
minimized: 'minimized',
|
|
1278
|
+
open: 'open',
|
|
1279
|
+
initialize: null
|
|
1280
|
+
};
|
|
1281
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/selectors.js
|
|
1282
|
+
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; }
|
|
1416
1283
|
|
|
1417
|
-
|
|
1418
|
-
return false;
|
|
1419
|
-
}
|
|
1284
|
+
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; }
|
|
1420
1285
|
|
|
1421
|
-
|
|
1422
|
-
};
|
|
1423
|
-
const getPropSelector = (propName, orDefault) => (_, props) => props[propName] || orDefault;
|
|
1424
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/selectors.js
|
|
1286
|
+
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; }
|
|
1425
1287
|
|
|
1426
1288
|
|
|
1427
1289
|
|
|
1428
|
-
const getState = selectState;
|
|
1429
|
-
const selectors_getFormById = createSelector(getState, getPropSelector('formId'), (forms, formId) => forms[formId]);
|
|
1430
|
-
const getFormControlsByFormId = createSelector(selectors_getFormById, form => (form === null || form === void 0 ? void 0 : form.controls) || {});
|
|
1431
|
-
const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId, controls => {
|
|
1432
|
-
const valuesObj = {};
|
|
1433
|
-
Object.entries(controls).forEach(([key, {
|
|
1434
|
-
value
|
|
1435
|
-
}]) => {
|
|
1436
|
-
valuesObj[key] = value;
|
|
1437
|
-
});
|
|
1438
|
-
return valuesObj;
|
|
1439
|
-
});
|
|
1440
|
-
const selectors_getControlValueByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) => {
|
|
1441
|
-
var _controls$name;
|
|
1442
1290
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1291
|
+
const selectConfig = createSelector(selectState, config => {
|
|
1292
|
+
let newConfig = selectors_objectSpread({
|
|
1293
|
+
visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? constants_visibilityStates.open : constants_visibilityStates.minimized,
|
|
1294
|
+
appContainerClassNames: config.appContainerClassNames || []
|
|
1295
|
+
}, config);
|
|
1447
1296
|
|
|
1448
|
-
|
|
1297
|
+
if (typeof newConfig.appContainerClassNames === 'function') {
|
|
1298
|
+
newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
|
|
1299
|
+
appContainerClassNames: newConfig.appContainerClassNames(newConfig)
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
return newConfig;
|
|
1449
1304
|
});
|
|
1305
|
+
|
|
1450
1306
|
;// CONCATENATED MODULE: ./src/javascripts/domains/redux/context.js
|
|
1451
1307
|
|
|
1452
1308
|
const context_StoreContext = (0,external_preact_namespaceObject.createContext)(undefined);
|
|
@@ -1545,1024 +1401,839 @@ const hooks_useSelectorWithProps = function useSelectorWithProps(selector, props
|
|
|
1545
1401
|
|
|
1546
1402
|
|
|
1547
1403
|
|
|
1548
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/
|
|
1404
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
|
|
1549
1405
|
|
|
1550
|
-
const context_FormContext = (0,external_preact_namespaceObject.createContext)({});
|
|
1551
|
-
/* harmony default export */ const forms_context = ((/* unused pure expression or super */ null && (context_FormContext)));
|
|
1552
|
-
const {
|
|
1553
|
-
Provider: forms_context_Provider,
|
|
1554
|
-
Consumer: context_Consumer
|
|
1555
|
-
} = context_FormContext;
|
|
1556
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/hooks.js
|
|
1557
1406
|
|
|
1407
|
+
function hooks_useConfig() {
|
|
1408
|
+
return useSelector(Selectors.selectConfig);
|
|
1409
|
+
}
|
|
1410
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
function createMiddleware() {
|
|
1414
|
+
return ({
|
|
1415
|
+
dispatch
|
|
1416
|
+
}) => next => action => {
|
|
1417
|
+
var _action$config, _action$config$defaul;
|
|
1558
1418
|
|
|
1419
|
+
const result = next(action);
|
|
1559
1420
|
|
|
1421
|
+
switch (action.type) {
|
|
1422
|
+
case String(Actions.initialize):
|
|
1423
|
+
case String(Actions.update):
|
|
1424
|
+
if (action !== null && action !== void 0 && (_action$config = action.config) !== null && _action$config !== void 0 && (_action$config$defaul = _action$config.defaults) !== null && _action$config$defaul !== void 0 && _action$config$defaul.agentName) {
|
|
1425
|
+
var _action$config2, _action$config2$defau;
|
|
1560
1426
|
|
|
1427
|
+
dispatch({
|
|
1428
|
+
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
1429
|
+
title: action === null || action === void 0 ? void 0 : (_action$config2 = action.config) === null || _action$config2 === void 0 ? void 0 : (_action$config2$defau = _action$config2.defaults) === null || _action$config2$defau === void 0 ? void 0 : _action$config2$defau.agentName
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1561
1432
|
|
|
1433
|
+
}
|
|
1562
1434
|
|
|
1563
|
-
|
|
1564
|
-
return useContext(FormContext);
|
|
1565
|
-
}
|
|
1566
|
-
function hooks_useForm() {
|
|
1567
|
-
const {
|
|
1568
|
-
handleSubmit
|
|
1569
|
-
} = hooks_useFormContext();
|
|
1570
|
-
return {
|
|
1571
|
-
handleSubmit
|
|
1435
|
+
return result;
|
|
1572
1436
|
};
|
|
1573
1437
|
}
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
};
|
|
1580
|
-
}
|
|
1581
|
-
function hooks_useFormControl(name) {
|
|
1582
|
-
const dispatch = useStoreDispatch();
|
|
1583
|
-
const {
|
|
1584
|
-
formId,
|
|
1585
|
-
updateControlValue,
|
|
1586
|
-
updateControlTouched,
|
|
1587
|
-
errors
|
|
1588
|
-
} = hooks_useFormContext();
|
|
1589
|
-
const form = useSelectorWithProps(getFormById, {
|
|
1590
|
-
formId
|
|
1591
|
-
}, [formId]);
|
|
1592
|
-
const isRegistered = !!form;
|
|
1593
|
-
const isRegisteredRef = useRef();
|
|
1594
|
-
isRegisteredRef.current = isRegistered;
|
|
1595
|
-
const value = useSelectorWithProps(getControlValueByName, {
|
|
1596
|
-
formId,
|
|
1597
|
-
name
|
|
1598
|
-
}, [formId, name]);
|
|
1599
|
-
const touched = useSelectorWithProps(getControlTouchedByName, {
|
|
1600
|
-
formId,
|
|
1601
|
-
name
|
|
1602
|
-
}, [formId, name]);
|
|
1603
|
-
const error = errors === null || errors === void 0 ? void 0 : errors[name];
|
|
1604
|
-
const isValid = !error;
|
|
1605
|
-
useEffect(() => {
|
|
1606
|
-
// Make sure the form is registered
|
|
1607
|
-
// Since child useEffect runs before FormProvider useEffect
|
|
1608
|
-
if (isRegisteredRef.current) {
|
|
1609
|
-
dispatch(Actions.registerControl(formId, name));
|
|
1610
|
-
}
|
|
1611
|
-
}, [isRegistered, formId, name, dispatch]);
|
|
1612
|
-
useLayoutEffect(() => {
|
|
1613
|
-
return () => {
|
|
1614
|
-
dispatch(Actions.deregisterControl(formId, name));
|
|
1615
|
-
};
|
|
1616
|
-
}, [isRegistered, formId, name, dispatch]); // preact uses onInput instead of onChange
|
|
1617
|
-
|
|
1618
|
-
const onInput = useCallback(e => updateControlValue(name, e.target.value), [name, updateControlValue]);
|
|
1619
|
-
const onBlur = useCallback(() => {
|
|
1620
|
-
updateControlTouched(name, true);
|
|
1621
|
-
}, [updateControlTouched, name]);
|
|
1622
|
-
const field = useMemo(() => ({
|
|
1623
|
-
name,
|
|
1624
|
-
onInput,
|
|
1625
|
-
onBlur,
|
|
1626
|
-
value
|
|
1627
|
-
}), [name, onInput, onBlur, value]);
|
|
1628
|
-
const meta = useMemo(() => ({
|
|
1629
|
-
isValid,
|
|
1630
|
-
error,
|
|
1631
|
-
touched
|
|
1632
|
-
}), [isValid, error, touched]);
|
|
1633
|
-
return [field, meta];
|
|
1634
|
-
}
|
|
1635
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/provider.js
|
|
1636
|
-
const _excluded = (/* unused pure expression or super */ null && (["children", "formId", "persistData", "onSubmit", "validationSchema"]));
|
|
1438
|
+
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
1439
|
+
const CSS_NAME = 'cvco';
|
|
1440
|
+
const apiVersion = '2';
|
|
1441
|
+
const config_userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
|
|
1442
|
+
// broadcasting to the screen reader. This is done to avoid verbosity.
|
|
1637
1443
|
|
|
1638
|
-
|
|
1444
|
+
const unreadScreenReaderWait = 2000;
|
|
1445
|
+
const newMessageScreenReaderWait = 1000;
|
|
1446
|
+
const config_screenReaderDebounceDelaySeconds = 10;
|
|
1447
|
+
const activitySendDelay = 15000;
|
|
1448
|
+
const maxCharacterWarningLimit = 50;
|
|
1449
|
+
const maxCharacterSrDebounceDelay = 300;
|
|
1450
|
+
const config_defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
|
|
1639
1451
|
|
|
1640
|
-
|
|
1452
|
+
const config_typingTimeout = 2000;
|
|
1453
|
+
const defaultConfig = {
|
|
1454
|
+
namespace: 'default',
|
|
1455
|
+
layoutMode: 'window',
|
|
1456
|
+
// "window", "inline" ("sidebar"), "modal"
|
|
1457
|
+
messages: {
|
|
1458
|
+
agent: {
|
|
1459
|
+
showAvatar: false,
|
|
1460
|
+
// true, "inline"
|
|
1461
|
+
showName: false
|
|
1462
|
+
},
|
|
1463
|
+
user: {
|
|
1464
|
+
showAvatar: false,
|
|
1465
|
+
// true, "inline"
|
|
1466
|
+
showName: false
|
|
1467
|
+
},
|
|
1468
|
+
timeIndicator: {
|
|
1469
|
+
enabled: false,
|
|
1470
|
+
threshold: 3600000 // Default threshold is an hour in milliseconds
|
|
1641
1471
|
|
|
1642
|
-
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1474
|
+
appContainerClassNames: config => [`app--layout-${config.layoutMode}`, `namespace--${config.namespace}`]
|
|
1475
|
+
};
|
|
1476
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/reducer.js
|
|
1477
|
+
const _excluded = ["messages"];
|
|
1643
1478
|
|
|
1644
1479
|
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; }
|
|
1645
1480
|
|
|
1646
1481
|
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; }
|
|
1647
1482
|
|
|
1483
|
+
function reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1648
1484
|
|
|
1485
|
+
function reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reducer_ownKeys(Object(source), true).forEach(function (key) { reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1649
1486
|
|
|
1487
|
+
function reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1650
1488
|
|
|
1651
1489
|
|
|
1652
1490
|
|
|
1653
1491
|
|
|
1654
1492
|
|
|
1655
|
-
function provider_FormProvider(_ref) {
|
|
1656
|
-
let {
|
|
1657
|
-
children,
|
|
1658
|
-
formId,
|
|
1659
|
-
persistData,
|
|
1660
|
-
onSubmit,
|
|
1661
|
-
validationSchema
|
|
1662
|
-
} = _ref,
|
|
1663
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
1664
|
-
|
|
1665
|
-
const dispatch = useStoreDispatch();
|
|
1666
|
-
const values = useSelectorWithProps(getFormValuesByFormId, {
|
|
1667
|
-
formId
|
|
1668
|
-
}, [formId]);
|
|
1669
|
-
const [isSubmitted, setIsSubmitted] = useState(false);
|
|
1670
|
-
const [externalErrors, setExternalErrors] = useState({});
|
|
1671
|
-
const {
|
|
1672
|
-
isValid: validationIsValid,
|
|
1673
|
-
errors: validationErrors
|
|
1674
|
-
} = useValidations(values, validationSchema);
|
|
1675
|
-
const errors = useMemo(() => provider_objectSpread(provider_objectSpread({}, validationErrors), externalErrors), [validationErrors, externalErrors]); // register
|
|
1676
1493
|
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1494
|
+
const initialState = reducer_objectSpread(reducer_objectSpread({}, defaultConfig), {}, {
|
|
1495
|
+
hideOnNoUserResponse: false,
|
|
1496
|
+
showDisclaimer: false,
|
|
1497
|
+
showFaq: false,
|
|
1498
|
+
customComponents: {},
|
|
1499
|
+
defaults: {}
|
|
1500
|
+
});
|
|
1681
1501
|
|
|
1682
|
-
|
|
1683
|
-
return () => {
|
|
1684
|
-
// deregister form from redux store
|
|
1685
|
-
dispatch(Actions.deregisterForm(formId));
|
|
1686
|
-
};
|
|
1687
|
-
}, [formId, persistData, dispatch]);
|
|
1688
|
-
const updateControlValue = useCallback((name, value) => {
|
|
1689
|
-
dispatch(Actions.updateControlValue(formId, name, value));
|
|
1690
|
-
}, [formId, dispatch]);
|
|
1691
|
-
const updateControlTouched = useCallback((name, touched) => {
|
|
1692
|
-
dispatch(Actions.updateControlTouched(formId, name, touched));
|
|
1693
|
-
}, [dispatch, formId]); // Function to manually set an error
|
|
1502
|
+
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback'];
|
|
1694
1503
|
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
},
|
|
1702
|
-
|
|
1703
|
-
e.preventDefault();
|
|
1704
|
-
setIsSubmitted(true);
|
|
1504
|
+
const updateState = (state, {
|
|
1505
|
+
config
|
|
1506
|
+
}) => {
|
|
1507
|
+
const _pick = pick(config, configKeys),
|
|
1508
|
+
{
|
|
1509
|
+
messages
|
|
1510
|
+
} = _pick,
|
|
1511
|
+
partialConfig = _objectWithoutProperties(_pick, _excluded);
|
|
1705
1512
|
|
|
1706
|
-
|
|
1707
|
-
onSubmit(values, {
|
|
1708
|
-
updateControlValue,
|
|
1709
|
-
setError
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
}, [validationIsValid, onSubmit, values, updateControlValue, setError]);
|
|
1713
|
-
const contextValue = useMemo(() => ({
|
|
1714
|
-
formId,
|
|
1715
|
-
values,
|
|
1716
|
-
errors,
|
|
1717
|
-
isValid: Object.keys(errors).length === 0,
|
|
1718
|
-
isSubmitted,
|
|
1719
|
-
handleSubmit,
|
|
1720
|
-
validationSchema,
|
|
1721
|
-
updateControlValue,
|
|
1722
|
-
updateControlTouched
|
|
1723
|
-
}), [formId, values, errors, isSubmitted, handleSubmit, validationSchema, updateControlValue, updateControlTouched]);
|
|
1513
|
+
let newState = state;
|
|
1724
1514
|
|
|
1725
|
-
if (
|
|
1726
|
-
|
|
1727
|
-
return null;
|
|
1515
|
+
if (Object.keys(partialConfig).length > 0) {
|
|
1516
|
+
newState = reducer_objectSpread(reducer_objectSpread({}, newState), partialConfig);
|
|
1728
1517
|
}
|
|
1729
1518
|
|
|
1730
|
-
if (
|
|
1731
|
-
|
|
1732
|
-
|
|
1519
|
+
if (messages) {
|
|
1520
|
+
newState = reducer_objectSpread(reducer_objectSpread({}, newState), {}, {
|
|
1521
|
+
messages: reducer_objectSpread(reducer_objectSpread({}, newState.messages), messages)
|
|
1522
|
+
});
|
|
1733
1523
|
}
|
|
1734
1524
|
|
|
1735
|
-
return
|
|
1736
|
-
|
|
1737
|
-
children: children
|
|
1738
|
-
}));
|
|
1739
|
-
}
|
|
1740
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/reducer.js
|
|
1741
|
-
function reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1742
|
-
|
|
1743
|
-
function reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reducer_ownKeys(Object(source), true).forEach(function (key) { reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1525
|
+
return newState;
|
|
1526
|
+
};
|
|
1744
1527
|
|
|
1745
|
-
|
|
1528
|
+
/* harmony default export */ const reducer = (utils_createReducer({
|
|
1529
|
+
[initialize]: (state, action) => {
|
|
1530
|
+
return updateState(state, action);
|
|
1531
|
+
},
|
|
1532
|
+
[update]: (state, action) => {
|
|
1533
|
+
return updateState(state, action);
|
|
1534
|
+
}
|
|
1535
|
+
}, initialState));
|
|
1536
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
1746
1537
|
|
|
1747
1538
|
|
|
1748
1539
|
|
|
1749
|
-
const reducer_initialState = {};
|
|
1750
|
-
const initialFormState = {
|
|
1751
|
-
controls: {}
|
|
1752
|
-
};
|
|
1753
|
-
const initialControlState = {
|
|
1754
|
-
value: '',
|
|
1755
|
-
touched: false
|
|
1756
|
-
};
|
|
1757
1540
|
|
|
1758
|
-
function updateFormControl(state, formId, name, controlState) {
|
|
1759
|
-
var _state$formId;
|
|
1760
1541
|
|
|
1761
|
-
const currentControlState = ((_state$formId = state[formId]) === null || _state$formId === void 0 ? void 0 : _state$formId.controls[name]) || initialControlState;
|
|
1762
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1763
|
-
[formId]: reducer_objectSpread(reducer_objectSpread({}, state[formId]), {}, {
|
|
1764
|
-
controls: reducer_objectSpread(reducer_objectSpread({}, state[formId].controls), {}, {
|
|
1765
|
-
[name]: reducer_objectSpread(reducer_objectSpread({}, currentControlState), controlState)
|
|
1766
|
-
})
|
|
1767
|
-
})
|
|
1768
|
-
});
|
|
1769
|
-
}
|
|
1770
1542
|
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
persistData
|
|
1776
|
-
}) => {
|
|
1777
|
-
const formState = persistData ? state[formId] ?? reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1778
|
-
persistData
|
|
1779
|
-
}) : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1780
|
-
persistData
|
|
1781
|
-
});
|
|
1782
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1783
|
-
[formId]: formState
|
|
1784
|
-
});
|
|
1785
|
-
},
|
|
1786
|
-
[deregisterForm]: (state, {
|
|
1787
|
-
formId
|
|
1788
|
-
}) => {
|
|
1789
|
-
var _newState$formId;
|
|
1543
|
+
;// CONCATENATED MODULE: ./src/javascripts/lib/mutex.js
|
|
1544
|
+
function createMutex() {
|
|
1545
|
+
let isRunning = false;
|
|
1546
|
+
const tasks = [];
|
|
1790
1547
|
|
|
1791
|
-
|
|
1548
|
+
const next = async () => {
|
|
1549
|
+
if (!isRunning) {
|
|
1550
|
+
while (tasks.length) {
|
|
1551
|
+
const task = tasks.shift();
|
|
1552
|
+
isRunning = true; // eslint-disable-next-line no-await-in-loop
|
|
1792
1553
|
|
|
1793
|
-
|
|
1794
|
-
|
|
1554
|
+
await task().catch(() => {});
|
|
1555
|
+
isRunning = false;
|
|
1556
|
+
}
|
|
1795
1557
|
}
|
|
1558
|
+
};
|
|
1796
1559
|
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
[deregisterControl]: (state, {
|
|
1807
|
-
formId,
|
|
1808
|
-
name
|
|
1809
|
-
}) => {
|
|
1810
|
-
const form = state[formId];
|
|
1811
|
-
|
|
1812
|
-
if (!form) {
|
|
1813
|
-
return state;
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
if (form.persistData) {
|
|
1817
|
-
return state;
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
const controls = reducer_objectSpread({}, form.controls);
|
|
1821
|
-
|
|
1822
|
-
delete controls[name];
|
|
1823
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1824
|
-
[formId]: reducer_objectSpread(reducer_objectSpread({}, form), {}, {
|
|
1825
|
-
controls
|
|
1826
|
-
})
|
|
1827
|
-
});
|
|
1828
|
-
},
|
|
1829
|
-
[updateControlValue]: (state, {
|
|
1830
|
-
formId,
|
|
1831
|
-
name,
|
|
1832
|
-
value
|
|
1833
|
-
}) => {
|
|
1834
|
-
return updateFormControl(state, formId, name, {
|
|
1835
|
-
value
|
|
1836
|
-
});
|
|
1837
|
-
},
|
|
1838
|
-
[updateControlTouched]: (state, {
|
|
1839
|
-
formId,
|
|
1840
|
-
name,
|
|
1841
|
-
touched
|
|
1842
|
-
}) => {
|
|
1843
|
-
return updateFormControl(state, formId, name, {
|
|
1844
|
-
touched
|
|
1560
|
+
const runExclusively = async task => {
|
|
1561
|
+
const prms = new Promise((resolve, reject) => {
|
|
1562
|
+
tasks.push(async () => {
|
|
1563
|
+
try {
|
|
1564
|
+
resolve(await task());
|
|
1565
|
+
} catch (e) {
|
|
1566
|
+
reject(e);
|
|
1567
|
+
}
|
|
1568
|
+
});
|
|
1845
1569
|
});
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1570
|
+
next();
|
|
1571
|
+
return prms;
|
|
1572
|
+
};
|
|
1854
1573
|
|
|
1855
|
-
|
|
1574
|
+
return {
|
|
1575
|
+
next,
|
|
1576
|
+
runExclusively
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1579
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/utils.js
|
|
1856
1580
|
|
|
1857
1581
|
const {
|
|
1858
|
-
|
|
1859
|
-
|
|
1582
|
+
createAction: i18n_utils_createAction,
|
|
1583
|
+
createThunk: i18n_utils_createThunk,
|
|
1584
|
+
createReducer: i18n_utils_createReducer,
|
|
1860
1585
|
selectState: utils_selectState
|
|
1861
|
-
} = createDomain('
|
|
1862
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/
|
|
1863
|
-
|
|
1864
|
-
const [enable, disable] = translations_utils_createActions('translate', {
|
|
1865
|
-
enable: locale => ({
|
|
1866
|
-
locale
|
|
1867
|
-
}),
|
|
1868
|
-
disable: () => ({})
|
|
1869
|
-
});
|
|
1870
|
-
const [enableEvent, disableEvent] = translations_utils_createActions('event', {
|
|
1871
|
-
enable: payloadId => ({
|
|
1872
|
-
payloadId
|
|
1873
|
-
}),
|
|
1874
|
-
disable: payloadId => ({
|
|
1875
|
-
payloadId
|
|
1876
|
-
})
|
|
1877
|
-
});
|
|
1878
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/selectors.js
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
const selectors_getState = utils_selectState;
|
|
1883
|
-
const getOriginalPayloadIds = createSelector(selectors_getState, state => state.originalPayloadIds);
|
|
1884
|
-
const getIsPayloadTranslated = createSelector(getOriginalPayloadIds, getPropSelector('payloadId'), (payloadIds, payloadId) => !payloadIds.includes(payloadId));
|
|
1885
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-api-context.js
|
|
1886
|
-
|
|
1887
|
-
const seamly_api_context_SeamlyApiContext = (0,external_preact_namespaceObject.createContext)(null);
|
|
1888
|
-
const seamly_api_context_SeamlyEventBusContext = (0,external_preact_namespaceObject.createContext)('');
|
|
1889
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-api-hooks.js
|
|
1586
|
+
} = createDomain('i18n');
|
|
1587
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.js
|
|
1890
1588
|
|
|
1891
1589
|
|
|
1892
|
-
const
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
return api.store || {};
|
|
1896
|
-
};
|
|
1897
|
-
const useSeamlyConversationUrl = () => {
|
|
1898
|
-
const {
|
|
1899
|
-
get
|
|
1900
|
-
} = seamly_api_hooks_useSeamlyObjectStore();
|
|
1590
|
+
const selectTranslations = createSelector(utils_selectState, state => state.translations);
|
|
1591
|
+
const selectInitialLocale = createSelector(utils_selectState, state => state.initialLocale);
|
|
1592
|
+
const selectLocale = createSelector(utils_selectState, state => state.locale);
|
|
1901
1593
|
|
|
1902
|
-
|
|
1903
|
-
return get('conversationUrl');
|
|
1904
|
-
}
|
|
1594
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/actions.js
|
|
1905
1595
|
|
|
1906
|
-
return null;
|
|
1907
|
-
};
|
|
1908
|
-
const seamly_api_hooks_useSeamlyHasConversation = () => {
|
|
1909
|
-
const url = useSeamlyConversationUrl();
|
|
1910
|
-
return !!url;
|
|
1911
|
-
};
|
|
1912
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/utils.js
|
|
1913
1596
|
|
|
1914
|
-
const {
|
|
1915
|
-
createAction: utils_createAction,
|
|
1916
|
-
createThunk: utils_createThunk,
|
|
1917
|
-
createReducer: config_utils_createReducer,
|
|
1918
|
-
selectState: config_utils_selectState
|
|
1919
|
-
} = createDomain('config');
|
|
1920
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
|
|
1921
1597
|
|
|
1922
|
-
const
|
|
1923
|
-
|
|
1924
|
-
}));
|
|
1925
|
-
const update = utils_createAction('update', config => ({
|
|
1926
|
-
config
|
|
1598
|
+
const setInitialLocale = i18n_utils_createAction('setInitialLocale', locale => ({
|
|
1599
|
+
locale
|
|
1927
1600
|
}));
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1601
|
+
const mutex = createMutex();
|
|
1602
|
+
const setLocale = i18n_utils_createThunk('setLocale', async (locale, {
|
|
1603
|
+
getState,
|
|
1604
|
+
extra: {
|
|
1605
|
+
api
|
|
1606
|
+
}
|
|
1607
|
+
}) => {
|
|
1608
|
+
return mutex.runExclusively(() => {
|
|
1609
|
+
if (locale === selectLocale(getState())) {
|
|
1610
|
+
return undefined;
|
|
1611
|
+
}
|
|
1934
1612
|
|
|
1613
|
+
return api.getTranslations(locale);
|
|
1614
|
+
});
|
|
1615
|
+
});
|
|
1616
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
1617
|
+
function _arrayWithHoles(arr) {
|
|
1618
|
+
if (Array.isArray(arr)) return arr;
|
|
1619
|
+
}
|
|
1620
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
1621
|
+
function _iterableToArrayLimit(arr, i) {
|
|
1622
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1935
1623
|
|
|
1624
|
+
if (_i == null) return;
|
|
1625
|
+
var _arr = [];
|
|
1626
|
+
var _n = true;
|
|
1627
|
+
var _d = false;
|
|
1936
1628
|
|
|
1629
|
+
var _s, _e;
|
|
1937
1630
|
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
appContainerClassNames: config.appContainerClassNames || []
|
|
1942
|
-
}, config);
|
|
1631
|
+
try {
|
|
1632
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
1633
|
+
_arr.push(_s.value);
|
|
1943
1634
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1635
|
+
if (i && _arr.length === i) break;
|
|
1636
|
+
}
|
|
1637
|
+
} catch (err) {
|
|
1638
|
+
_d = true;
|
|
1639
|
+
_e = err;
|
|
1640
|
+
} finally {
|
|
1641
|
+
try {
|
|
1642
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
1643
|
+
} finally {
|
|
1644
|
+
if (_d) throw _e;
|
|
1645
|
+
}
|
|
1948
1646
|
}
|
|
1949
1647
|
|
|
1950
|
-
return
|
|
1951
|
-
});
|
|
1952
|
-
|
|
1953
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
function hooks_useConfig() {
|
|
1957
|
-
return useSelector(Selectors.selectConfig);
|
|
1648
|
+
return _arr;
|
|
1958
1649
|
}
|
|
1959
|
-
;// CONCATENATED MODULE: ./
|
|
1650
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
1651
|
+
function _arrayLikeToArray(arr, len) {
|
|
1652
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1960
1653
|
|
|
1654
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
1655
|
+
arr2[i] = arr[i];
|
|
1656
|
+
}
|
|
1961
1657
|
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
}) => next => action => {
|
|
1966
|
-
var _action$config, _action$config$defaul;
|
|
1658
|
+
return arr2;
|
|
1659
|
+
}
|
|
1660
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
1967
1661
|
|
|
1968
|
-
|
|
1662
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
1663
|
+
if (!o) return;
|
|
1664
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
1665
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1666
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1667
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1668
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1669
|
+
}
|
|
1670
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
1671
|
+
function _nonIterableRest() {
|
|
1672
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1673
|
+
}
|
|
1674
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
1969
1675
|
|
|
1970
|
-
switch (action.type) {
|
|
1971
|
-
case String(Actions.initialize):
|
|
1972
|
-
case String(Actions.update):
|
|
1973
|
-
if (action !== null && action !== void 0 && (_action$config = action.config) !== null && _action$config !== void 0 && (_action$config$defaul = _action$config.defaults) !== null && _action$config$defaul !== void 0 && _action$config$defaul.agentName) {
|
|
1974
|
-
var _action$config2, _action$config2$defau;
|
|
1975
1676
|
|
|
1976
|
-
dispatch({
|
|
1977
|
-
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
1978
|
-
title: action === null || action === void 0 ? void 0 : (_action$config2 = action.config) === null || _action$config2 === void 0 ? void 0 : (_action$config2$defau = _action$config2.defaults) === null || _action$config2$defau === void 0 ? void 0 : _action$config2$defau.agentName
|
|
1979
|
-
});
|
|
1980
|
-
}
|
|
1981
1677
|
|
|
1982
|
-
}
|
|
1983
1678
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1679
|
+
function _slicedToArray(arr, i) {
|
|
1680
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
1681
|
+
}
|
|
1682
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
1683
|
+
function _classCallCheck(instance, Constructor) {
|
|
1684
|
+
if (!(instance instanceof Constructor)) {
|
|
1685
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
1689
|
+
function _defineProperties(target, props) {
|
|
1690
|
+
for (var i = 0; i < props.length; i++) {
|
|
1691
|
+
var descriptor = props[i];
|
|
1692
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1693
|
+
descriptor.configurable = true;
|
|
1694
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1695
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1696
|
+
}
|
|
1986
1697
|
}
|
|
1987
|
-
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
1988
|
-
const CSS_NAME = 'cvco';
|
|
1989
|
-
const apiVersion = '2';
|
|
1990
|
-
const config_userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
|
|
1991
|
-
// broadcasting to the screen reader. This is done to avoid verbosity.
|
|
1992
|
-
|
|
1993
|
-
const unreadScreenReaderWait = 2000;
|
|
1994
|
-
const newMessageScreenReaderWait = 1000;
|
|
1995
|
-
const config_screenReaderDebounceDelaySeconds = 10;
|
|
1996
|
-
const activitySendDelay = 15000;
|
|
1997
|
-
const maxCharacterWarningLimit = 50;
|
|
1998
|
-
const maxCharacterSrDebounceDelay = 300;
|
|
1999
|
-
const config_defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
|
|
2000
|
-
|
|
2001
|
-
const config_typingTimeout = 2000;
|
|
2002
|
-
const defaultConfig = {
|
|
2003
|
-
namespace: 'default',
|
|
2004
|
-
layoutMode: 'window',
|
|
2005
|
-
// "window", "inline" ("sidebar"), "modal"
|
|
2006
|
-
messages: {
|
|
2007
|
-
agent: {
|
|
2008
|
-
showAvatar: false,
|
|
2009
|
-
// true, "inline"
|
|
2010
|
-
showName: false
|
|
2011
|
-
},
|
|
2012
|
-
user: {
|
|
2013
|
-
showAvatar: false,
|
|
2014
|
-
// true, "inline"
|
|
2015
|
-
showName: false
|
|
2016
|
-
},
|
|
2017
|
-
timeIndicator: {
|
|
2018
|
-
enabled: false,
|
|
2019
|
-
threshold: 3600000 // Default threshold is an hour in milliseconds
|
|
2020
1698
|
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
1699
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
1700
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
1701
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1702
|
+
return Constructor;
|
|
1703
|
+
}
|
|
1704
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
1705
|
+
function defineProperty_defineProperty(obj, key, value) {
|
|
1706
|
+
if (key in obj) {
|
|
1707
|
+
Object.defineProperty(obj, key, {
|
|
1708
|
+
value: value,
|
|
1709
|
+
enumerable: true,
|
|
1710
|
+
configurable: true,
|
|
1711
|
+
writable: true
|
|
1712
|
+
});
|
|
1713
|
+
} else {
|
|
1714
|
+
obj[key] = value;
|
|
1715
|
+
}
|
|
2027
1716
|
|
|
2028
|
-
|
|
1717
|
+
return obj;
|
|
1718
|
+
}
|
|
1719
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/array-utils/array-utils.es.js
|
|
1720
|
+
/*
|
|
1721
|
+
* Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
1722
|
+
*
|
|
1723
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1724
|
+
* you may not use this file except in compliance with the License.
|
|
1725
|
+
* You may obtain a copy of the License at
|
|
1726
|
+
*
|
|
1727
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1728
|
+
*
|
|
1729
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1730
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1731
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1732
|
+
* See the License for the specific language governing permissions and
|
|
1733
|
+
* limitations under the License.
|
|
1734
|
+
*/
|
|
2029
1735
|
|
|
2030
|
-
|
|
1736
|
+
/**
|
|
1737
|
+
* Flattens an array of arrays of infinite depth into a single-dimension array.
|
|
1738
|
+
*
|
|
1739
|
+
* > This is now natively in JavaScript as the `flat` method on an Array
|
|
1740
|
+
* > instance. [Check MDN for which browsers have access to this feature](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat).
|
|
1741
|
+
* > If you can't use `flat`, then this method will do the job 🙂
|
|
1742
|
+
*
|
|
1743
|
+
* @param {Array} array
|
|
1744
|
+
* @return {Array} Flattened array.
|
|
1745
|
+
*/
|
|
1746
|
+
function flatten(array) {
|
|
1747
|
+
return array.reduce(function (accumulator, value) {
|
|
1748
|
+
return accumulator.concat(Array.isArray(value) ? flatten(value) : value);
|
|
1749
|
+
}, []);
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Creates an array of numbers from the starting value (inclusive) to the end
|
|
1753
|
+
* (exclusive), with an optional step (the gap between values).
|
|
1754
|
+
*
|
|
1755
|
+
* @param {Number} start
|
|
1756
|
+
* The value to start at, the first item in the returned array.
|
|
1757
|
+
* @param {Number} end
|
|
1758
|
+
* The value to end with, the last item in the returned array.
|
|
1759
|
+
* @param {Number} [step=1]
|
|
1760
|
+
* The increment/gap between values, defaults to 1.
|
|
1761
|
+
* @return {Array} An array encompassing the given range.
|
|
1762
|
+
*/
|
|
2031
1763
|
|
|
2032
|
-
function
|
|
1764
|
+
function range(start, end) {
|
|
1765
|
+
var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1766
|
+
return Array.apply(0, Array(Math.ceil((end - start) / step))).map(function (empty, index) {
|
|
1767
|
+
return index * step + start;
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
/**
|
|
1771
|
+
* Remove and return the first item from `array` that matches the predicate
|
|
1772
|
+
* function.
|
|
1773
|
+
*
|
|
1774
|
+
* @param {Array} array
|
|
1775
|
+
* @param {Function} predicate
|
|
1776
|
+
* Invoked with the array item.
|
|
1777
|
+
* @return {Object} The matching item, or `null` if no match was found.
|
|
1778
|
+
*/
|
|
2033
1779
|
|
|
2034
|
-
function
|
|
1780
|
+
function remove(array, predicate) {
|
|
1781
|
+
return array.find(function (item, index) {
|
|
1782
|
+
if (predicate(item)) {
|
|
1783
|
+
array.splice(index, 1);
|
|
1784
|
+
return item;
|
|
1785
|
+
}
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
2035
1788
|
|
|
2036
|
-
|
|
1789
|
+
//# sourceMappingURL=array-utils.es.js.map
|
|
1790
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/function-utils/function-utils.es.js
|
|
1791
|
+
/**
|
|
1792
|
+
* A higher-order function to apply [memoization](https://en.wikipedia.org/wiki/Memoization).
|
|
1793
|
+
*
|
|
1794
|
+
* If memoizing a recursive function, then memoize and define the function at
|
|
1795
|
+
* the same time so you can make a call to the memoized function, eg:
|
|
1796
|
+
*
|
|
1797
|
+
* ```javascript
|
|
1798
|
+
* const myFunction = memoize(() => myFunction());
|
|
1799
|
+
* ```
|
|
1800
|
+
*
|
|
1801
|
+
* @param {Function} func
|
|
1802
|
+
* @return {Function}
|
|
1803
|
+
*/
|
|
1804
|
+
function memoize(func) {
|
|
1805
|
+
var cache = {};
|
|
1806
|
+
return function () {
|
|
1807
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1808
|
+
args[_key] = arguments[_key];
|
|
1809
|
+
}
|
|
2037
1810
|
|
|
1811
|
+
var key = args.length ? args.map(function (arg) {
|
|
1812
|
+
return arg === null ? 'null' : arg === undefined ? 'undefined' : typeof arg === 'function' ? arg.toString() : arg instanceof Date ? arg.toISOString() : JSON.stringify(arg);
|
|
1813
|
+
}).join('|') : '_(no-args)_';
|
|
2038
1814
|
|
|
1815
|
+
if (Object.prototype.hasOwnProperty.call(cache, key)) {
|
|
1816
|
+
return cache[key];
|
|
1817
|
+
}
|
|
2039
1818
|
|
|
1819
|
+
var result = func.apply(void 0, args);
|
|
1820
|
+
cache[key] = result;
|
|
1821
|
+
return result;
|
|
1822
|
+
};
|
|
1823
|
+
}
|
|
2040
1824
|
|
|
1825
|
+
//# sourceMappingURL=function-utils.es.js.map
|
|
1826
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/lib/icu-message-formatter.es.js
|
|
2041
1827
|
|
|
2042
1828
|
|
|
2043
|
-
const config_reducer_initialState = config_reducer_objectSpread(config_reducer_objectSpread({}, defaultConfig), {}, {
|
|
2044
|
-
hideOnNoUserResponse: false,
|
|
2045
|
-
showDisclaimer: false,
|
|
2046
|
-
showFaq: false,
|
|
2047
|
-
customComponents: {},
|
|
2048
|
-
defaults: {}
|
|
2049
|
-
});
|
|
2050
1829
|
|
|
2051
|
-
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback'];
|
|
2052
1830
|
|
|
2053
|
-
const updateState = (state, {
|
|
2054
|
-
config
|
|
2055
|
-
}) => {
|
|
2056
|
-
const _pick = pick(config, configKeys),
|
|
2057
|
-
{
|
|
2058
|
-
messages
|
|
2059
|
-
} = _pick,
|
|
2060
|
-
partialConfig = reducer_objectWithoutProperties(_pick, reducer_excluded);
|
|
2061
1831
|
|
|
2062
|
-
let newState = state;
|
|
2063
1832
|
|
|
2064
|
-
if (Object.keys(partialConfig).length > 0) {
|
|
2065
|
-
newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), partialConfig);
|
|
2066
|
-
}
|
|
2067
1833
|
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
1834
|
+
/*
|
|
1835
|
+
* Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
1836
|
+
*
|
|
1837
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1838
|
+
* you may not use this file except in compliance with the License.
|
|
1839
|
+
* You may obtain a copy of the License at
|
|
1840
|
+
*
|
|
1841
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1842
|
+
*
|
|
1843
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1844
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1845
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1846
|
+
* See the License for the specific language governing permissions and
|
|
1847
|
+
* limitations under the License.
|
|
1848
|
+
*/
|
|
2073
1849
|
|
|
2074
|
-
|
|
2075
|
-
|
|
1850
|
+
/**
|
|
1851
|
+
* Most branch-based type handlers are based around "cases".
|
|
1852
|
+
* For example, `select` and `plural` compare compare a value
|
|
1853
|
+
* to "case keys" to choose a subtranslation.
|
|
1854
|
+
*
|
|
1855
|
+
* This util splits "matches" portions provided to the aforementioned
|
|
1856
|
+
* handlers into case strings, and extracts any prepended arguments
|
|
1857
|
+
* (for example, `plural` supports an `offset:n` argument used for
|
|
1858
|
+
* populating the magic `#` variable).
|
|
1859
|
+
*
|
|
1860
|
+
* @param {String} string
|
|
1861
|
+
* @return {Object} The `cases` key points to a map of all cases.
|
|
1862
|
+
* The `arguments` key points to a list of prepended arguments.
|
|
1863
|
+
*/
|
|
1864
|
+
function parseCases(string) {
|
|
1865
|
+
var isWhitespace = function isWhitespace(ch) {
|
|
1866
|
+
return /\s/.test(ch);
|
|
1867
|
+
};
|
|
2076
1868
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
}
|
|
2084
|
-
}, config_reducer_initialState));
|
|
2085
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
1869
|
+
var args = [];
|
|
1870
|
+
var cases = {};
|
|
1871
|
+
var currTermStart = 0;
|
|
1872
|
+
var latestTerm = null;
|
|
1873
|
+
var inTerm = false;
|
|
1874
|
+
var i = 0;
|
|
2086
1875
|
|
|
1876
|
+
while (i < string.length) {
|
|
1877
|
+
// Term ended
|
|
1878
|
+
if (inTerm && (isWhitespace(string[i]) || string[i] === '{')) {
|
|
1879
|
+
inTerm = false;
|
|
1880
|
+
latestTerm = string.slice(currTermStart, i); // We want to process the opening char again so the case will be properly registered.
|
|
2087
1881
|
|
|
1882
|
+
if (string[i] === '{') {
|
|
1883
|
+
i--;
|
|
1884
|
+
}
|
|
1885
|
+
} // New term
|
|
1886
|
+
else if (!inTerm && !isWhitespace(string[i])) {
|
|
1887
|
+
var caseBody = string[i] === '{'; // If there's a previous term, we can either handle a whole
|
|
1888
|
+
// case, or add that as an argument.
|
|
2088
1889
|
|
|
1890
|
+
if (latestTerm && caseBody) {
|
|
1891
|
+
var branchEndIndex = findClosingBracket(string, i);
|
|
2089
1892
|
|
|
1893
|
+
if (branchEndIndex === -1) {
|
|
1894
|
+
throw new Error("Unbalanced curly braces in string: \"".concat(string, "\""));
|
|
1895
|
+
}
|
|
2090
1896
|
|
|
1897
|
+
cases[latestTerm] = string.slice(i + 1, branchEndIndex); // Don't include the braces
|
|
2091
1898
|
|
|
2092
|
-
|
|
2093
|
-
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; }
|
|
1899
|
+
i = branchEndIndex; // Will be moved up where needed at end of loop.
|
|
2094
1900
|
|
|
2095
|
-
|
|
1901
|
+
latestTerm = null;
|
|
1902
|
+
} else {
|
|
1903
|
+
if (latestTerm) {
|
|
1904
|
+
args.push(latestTerm);
|
|
1905
|
+
latestTerm = null;
|
|
1906
|
+
}
|
|
2096
1907
|
|
|
2097
|
-
|
|
1908
|
+
inTerm = true;
|
|
1909
|
+
currTermStart = i;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
2098
1912
|
|
|
1913
|
+
i++;
|
|
1914
|
+
}
|
|
2099
1915
|
|
|
1916
|
+
if (inTerm) {
|
|
1917
|
+
latestTerm = string.slice(currTermStart);
|
|
1918
|
+
}
|
|
2100
1919
|
|
|
1920
|
+
if (latestTerm) {
|
|
1921
|
+
args.push(latestTerm);
|
|
1922
|
+
}
|
|
2101
1923
|
|
|
1924
|
+
return {
|
|
1925
|
+
args: args,
|
|
1926
|
+
cases: cases
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Finds the index of the matching closing curly bracket, including through
|
|
1931
|
+
* strings that could have nested brackets.
|
|
1932
|
+
*
|
|
1933
|
+
* @param {String} string
|
|
1934
|
+
* @param {Number} fromIndex
|
|
1935
|
+
* @return {Number} The index of the matching closing bracket, or -1 if no
|
|
1936
|
+
* closing bracket could be found.
|
|
1937
|
+
*/
|
|
2102
1938
|
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
|
|
2106
|
-
events
|
|
2107
|
-
}, config) => {
|
|
2108
|
-
var _config$messages;
|
|
1939
|
+
function findClosingBracket(string, fromIndex) {
|
|
1940
|
+
var depth = 0;
|
|
2109
1941
|
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
threshold
|
|
2113
|
-
} = (config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) ?? {};
|
|
1942
|
+
for (var i = fromIndex + 1; i < string.length; i++) {
|
|
1943
|
+
var char = string.charAt(i);
|
|
2114
1944
|
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
1945
|
+
if (char === '}') {
|
|
1946
|
+
if (depth === 0) {
|
|
1947
|
+
return i;
|
|
1948
|
+
}
|
|
2118
1949
|
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
// always add timeIndicator to first message
|
|
2123
|
-
if (idx === 0) {
|
|
2124
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2125
|
-
timeIndicator: event.payload.occurredAt
|
|
2126
|
-
})); // else check if diff is greater than threshold
|
|
2127
|
-
} else {
|
|
2128
|
-
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
2129
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2130
|
-
timeIndicator
|
|
2131
|
-
}));
|
|
1950
|
+
depth--;
|
|
1951
|
+
} else if (char === '{') {
|
|
1952
|
+
depth++;
|
|
2132
1953
|
}
|
|
1954
|
+
}
|
|
2133
1955
|
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2146
|
-
var _filteredEvents;
|
|
2147
|
-
|
|
2148
|
-
const filteredEvents = events.filter(event => event.type === 'message');
|
|
2149
|
-
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
2150
|
-
});
|
|
2151
|
-
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
2152
|
-
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
2153
|
-
const useSeamlyCurrentAgent = () => {
|
|
2154
|
-
const {
|
|
2155
|
-
participants,
|
|
2156
|
-
currentAgent
|
|
2157
|
-
} = seamly_state_hooks_useSeamlyStateContext().participantInfo;
|
|
2158
|
-
return currentAgent ? participants[currentAgent] : null;
|
|
2159
|
-
};
|
|
2160
|
-
const useSeamlyServiceData = key => seamly_state_hooks_useSeamlyStateContext().serviceData[key];
|
|
2161
|
-
const useEntryTextLimit = () => {
|
|
2162
|
-
const {
|
|
2163
|
-
entryMeta: {
|
|
2164
|
-
options: {
|
|
2165
|
-
text
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
} = seamly_state_hooks_useSeamlyStateContext();
|
|
2169
|
-
const {
|
|
2170
|
-
limit
|
|
2171
|
-
} = text || {};
|
|
2172
|
-
return {
|
|
2173
|
-
hasLimit: limit != null,
|
|
2174
|
-
limit: limit != null ? limit : null
|
|
2175
|
-
};
|
|
2176
|
-
};
|
|
2177
|
-
const useSeamlyLayoutMode = () => {
|
|
2178
|
-
const {
|
|
2179
|
-
layoutMode
|
|
2180
|
-
} = useConfig();
|
|
2181
|
-
return {
|
|
2182
|
-
isInline: layoutMode === 'inline',
|
|
2183
|
-
isModal: layoutMode === 'modal',
|
|
2184
|
-
isWindow: layoutMode === 'window',
|
|
2185
|
-
isResolving: !layoutMode
|
|
2186
|
-
};
|
|
2187
|
-
};
|
|
2188
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-dispatch.js
|
|
1956
|
+
return -1;
|
|
1957
|
+
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Split a `{key, type, format}` block into those 3 parts, taking into account
|
|
1960
|
+
* nested message syntax that can exist in the `format` part.
|
|
1961
|
+
*
|
|
1962
|
+
* @param {String} block
|
|
1963
|
+
* @return {Array}
|
|
1964
|
+
* An array with `key`, `type`, and `format` items in that order, if present
|
|
1965
|
+
* in the formatted argument block.
|
|
1966
|
+
*/
|
|
2189
1967
|
|
|
2190
|
-
|
|
2191
|
-
|
|
1968
|
+
function splitFormattedArgument(block) {
|
|
1969
|
+
return split(block.slice(1, -1), ',', 3);
|
|
1970
|
+
}
|
|
1971
|
+
/**
|
|
1972
|
+
* Like `String.prototype.split()` but where the limit parameter causes the
|
|
1973
|
+
* remainder of the string to be grouped together in a final entry.
|
|
1974
|
+
*
|
|
1975
|
+
* @private
|
|
1976
|
+
* @param {String} string
|
|
1977
|
+
* @param {String} separator
|
|
1978
|
+
* @param {Number} limit
|
|
1979
|
+
* @param {Array} [accumulator=[]]
|
|
1980
|
+
* @return {Array}
|
|
1981
|
+
*/
|
|
2192
1982
|
|
|
1983
|
+
function split(string, separator, limit) {
|
|
1984
|
+
var accumulator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
2193
1985
|
|
|
1986
|
+
if (!string) {
|
|
1987
|
+
return accumulator;
|
|
1988
|
+
}
|
|
2194
1989
|
|
|
1990
|
+
if (limit === 1) {
|
|
1991
|
+
accumulator.push(string);
|
|
1992
|
+
return accumulator;
|
|
1993
|
+
}
|
|
2195
1994
|
|
|
1995
|
+
var indexOfDelimiter = string.indexOf(separator);
|
|
2196
1996
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
1997
|
+
if (indexOfDelimiter === -1) {
|
|
1998
|
+
accumulator.push(string);
|
|
1999
|
+
return accumulator;
|
|
2000
|
+
}
|
|
2200
2001
|
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
});
|
|
2207
|
-
});
|
|
2208
|
-
};
|
|
2002
|
+
var head = string.substring(0, indexOfDelimiter).trim();
|
|
2003
|
+
var tail = string.substring(indexOfDelimiter + separator.length + 1).trim();
|
|
2004
|
+
accumulator.push(head);
|
|
2005
|
+
return split(tail, separator, limit - 1, accumulator);
|
|
2006
|
+
}
|
|
2209
2007
|
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
const setSeamlyContainerElement = useCallback(element => {
|
|
2216
|
-
dispatch({
|
|
2217
|
-
type: focus_helper_hooks_SET_SEAMLY_CONTAINER_ELEMENT,
|
|
2218
|
-
element
|
|
2219
|
-
});
|
|
2220
|
-
}, [dispatch]);
|
|
2221
|
-
return [seamlyContainerElement, setSeamlyContainerElement];
|
|
2222
|
-
};
|
|
2223
|
-
const focus_helper_hooks_useElementFocusingById = elementId => useCallback(() => {
|
|
2224
|
-
focusWithRaf(elementId);
|
|
2225
|
-
}, [elementId]);
|
|
2226
|
-
const focus_helper_hooks_useSkiplinkTargetFocusing = () => {
|
|
2227
|
-
const skiplinkTargetId = useSkiplink();
|
|
2228
|
-
return focus_helper_hooks_useElementFocusingById(skiplinkTargetId);
|
|
2229
|
-
};
|
|
2230
|
-
const useFocusIfSeamlyContainedFocus = () => {
|
|
2231
|
-
const containerElementRef = useRef(null);
|
|
2232
|
-
const [seamlyContainerElement] = useSeamlyContainerElement();
|
|
2233
|
-
containerElementRef.current = seamlyContainerElement;
|
|
2234
|
-
return useCallback(elementToFocus => {
|
|
2235
|
-
const focusFn = () => {
|
|
2236
|
-
focusWithRaf(elementToFocus);
|
|
2237
|
-
};
|
|
2008
|
+
/**
|
|
2009
|
+
* The main class for formatting messages.
|
|
2010
|
+
*
|
|
2011
|
+
* @author Emanuel Rabina
|
|
2012
|
+
*/
|
|
2238
2013
|
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2014
|
+
var MessageFormatter = /*#__PURE__*/function () {
|
|
2015
|
+
/**
|
|
2016
|
+
* Creates a new formatter that can work using any of the custom type handlers
|
|
2017
|
+
* you register.
|
|
2018
|
+
*
|
|
2019
|
+
* @param {String} locale
|
|
2020
|
+
* @param {Object} [typeHandlers={}]
|
|
2021
|
+
* Optional object where the keys are the names of the types to register,
|
|
2022
|
+
* their values being the functions that will return a nicely formatted
|
|
2023
|
+
* string for the data and locale they are given.
|
|
2024
|
+
*/
|
|
2025
|
+
function MessageFormatter(locale) {
|
|
2026
|
+
var _this = this;
|
|
2243
2027
|
|
|
2028
|
+
var typeHandlers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2244
2029
|
|
|
2030
|
+
_classCallCheck(this, MessageFormatter);
|
|
2245
2031
|
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
const {
|
|
2251
|
-
fromClient
|
|
2252
|
-
} = event.payload;
|
|
2253
|
-
const classNames = ['message'];
|
|
2032
|
+
defineProperty_defineProperty(this, "format", memoize(function (message) {
|
|
2033
|
+
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2034
|
+
return flatten(_this.process(message, values)).join('');
|
|
2035
|
+
}));
|
|
2254
2036
|
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
} else if (!fromClient) {
|
|
2258
|
-
classNames.push('message--source-agent');
|
|
2259
|
-
} else {
|
|
2260
|
-
classNames.push('message--source-user');
|
|
2037
|
+
this.locale = locale;
|
|
2038
|
+
this.typeHandlers = typeHandlers;
|
|
2261
2039
|
}
|
|
2040
|
+
/**
|
|
2041
|
+
* Formats an ICU message syntax string using `values` for placeholder data
|
|
2042
|
+
* and any currently-registered type handlers.
|
|
2043
|
+
*
|
|
2044
|
+
* @param {String} message
|
|
2045
|
+
* @param {Object} [values={}]
|
|
2046
|
+
* @return {String}
|
|
2047
|
+
*/
|
|
2262
2048
|
|
|
2263
|
-
return classNames;
|
|
2264
|
-
};
|
|
2265
|
-
const useCobrowsingContainer = () => {
|
|
2266
|
-
const {
|
|
2267
|
-
cobrowsingContainerId: id
|
|
2268
|
-
} = useSeamlyStateContext();
|
|
2269
|
-
const focusContainer = useElementFocusingById(id);
|
|
2270
|
-
return {
|
|
2271
|
-
id,
|
|
2272
|
-
focusContainer
|
|
2273
|
-
};
|
|
2274
|
-
};
|
|
2275
|
-
;// CONCATENATED MODULE: ./src/javascripts/lib/mutex.js
|
|
2276
|
-
function createMutex() {
|
|
2277
|
-
let isRunning = false;
|
|
2278
|
-
const tasks = [];
|
|
2279
2049
|
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2050
|
+
_createClass(MessageFormatter, [{
|
|
2051
|
+
key: "process",
|
|
2052
|
+
value:
|
|
2053
|
+
/**
|
|
2054
|
+
* Process an ICU message syntax string using `values` for placeholder data
|
|
2055
|
+
* and any currently-registered type handlers. The result of this method is
|
|
2056
|
+
* an array of the component parts after they have been processed in turn by
|
|
2057
|
+
* their own type handlers. This raw output is useful for other renderers,
|
|
2058
|
+
* eg: React where components can be used instead of being forced to return
|
|
2059
|
+
* raw strings.
|
|
2060
|
+
*
|
|
2061
|
+
* This method is used by {@link MessageFormatter#format} where it acts as a
|
|
2062
|
+
* string renderer.
|
|
2063
|
+
*
|
|
2064
|
+
* @param {String} message
|
|
2065
|
+
* @param {Object} [values={}]
|
|
2066
|
+
* @return {Array}
|
|
2067
|
+
*/
|
|
2068
|
+
function process(message) {
|
|
2069
|
+
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2285
2070
|
|
|
2286
|
-
|
|
2287
|
-
|
|
2071
|
+
if (!message) {
|
|
2072
|
+
return [];
|
|
2288
2073
|
}
|
|
2289
|
-
}
|
|
2290
|
-
};
|
|
2291
2074
|
|
|
2292
|
-
|
|
2293
|
-
const prms = new Promise((resolve, reject) => {
|
|
2294
|
-
tasks.push(async () => {
|
|
2295
|
-
try {
|
|
2296
|
-
resolve(await task());
|
|
2297
|
-
} catch (e) {
|
|
2298
|
-
reject(e);
|
|
2299
|
-
}
|
|
2300
|
-
});
|
|
2301
|
-
});
|
|
2302
|
-
next();
|
|
2303
|
-
return prms;
|
|
2304
|
-
};
|
|
2075
|
+
var blockStartIndex = message.indexOf('{');
|
|
2305
2076
|
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
runExclusively
|
|
2309
|
-
};
|
|
2310
|
-
}
|
|
2311
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/utils.js
|
|
2077
|
+
if (blockStartIndex !== -1) {
|
|
2078
|
+
var blockEndIndex = findClosingBracket(message, blockStartIndex);
|
|
2312
2079
|
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
createThunk: i18n_utils_createThunk,
|
|
2316
|
-
createReducer: i18n_utils_createReducer,
|
|
2317
|
-
selectState: i18n_utils_selectState
|
|
2318
|
-
} = createDomain('i18n');
|
|
2319
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.js
|
|
2080
|
+
if (blockEndIndex !== -1) {
|
|
2081
|
+
var block = message.substring(blockStartIndex, blockEndIndex + 1);
|
|
2320
2082
|
|
|
2083
|
+
if (block) {
|
|
2084
|
+
var result = [];
|
|
2085
|
+
var head = message.substring(0, blockStartIndex);
|
|
2321
2086
|
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2087
|
+
if (head) {
|
|
2088
|
+
result.push(head);
|
|
2089
|
+
}
|
|
2325
2090
|
|
|
2326
|
-
|
|
2091
|
+
var _splitFormattedArgume = splitFormattedArgument(block),
|
|
2092
|
+
_splitFormattedArgume2 = _slicedToArray(_splitFormattedArgume, 3),
|
|
2093
|
+
key = _splitFormattedArgume2[0],
|
|
2094
|
+
type = _splitFormattedArgume2[1],
|
|
2095
|
+
format = _splitFormattedArgume2[2];
|
|
2327
2096
|
|
|
2097
|
+
var body = values[key];
|
|
2328
2098
|
|
|
2099
|
+
if (body === null || body === undefined) {
|
|
2100
|
+
body = '';
|
|
2101
|
+
}
|
|
2329
2102
|
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
}
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2103
|
+
var typeHandler = type && this.typeHandlers[type];
|
|
2104
|
+
result.push(typeHandler ? typeHandler(body, format, this.locale, values, this.process.bind(this)) : body);
|
|
2105
|
+
var tail = message.substring(blockEndIndex + 1);
|
|
2106
|
+
|
|
2107
|
+
if (tail) {
|
|
2108
|
+
result.push(this.process(tail, values));
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
return result;
|
|
2112
|
+
}
|
|
2113
|
+
} else {
|
|
2114
|
+
throw new Error("Unbalanced curly braces in string: \"".concat(message, "\""));
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
return [message];
|
|
2343
2119
|
}
|
|
2120
|
+
}]);
|
|
2344
2121
|
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
});
|
|
2348
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
2349
|
-
function _arrayWithHoles(arr) {
|
|
2350
|
-
if (Array.isArray(arr)) return arr;
|
|
2351
|
-
}
|
|
2352
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
2353
|
-
function _iterableToArrayLimit(arr, i) {
|
|
2354
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
2122
|
+
return MessageFormatter;
|
|
2123
|
+
}();
|
|
2355
2124
|
|
|
2356
|
-
|
|
2357
|
-
var _arr = [];
|
|
2358
|
-
var _n = true;
|
|
2359
|
-
var _d = false;
|
|
2125
|
+
function icu_message_formatter_es_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2360
2126
|
|
|
2361
|
-
|
|
2127
|
+
function icu_message_formatter_es_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { icu_message_formatter_es_ownKeys(Object(source), true).forEach(function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { icu_message_formatter_es_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2128
|
+
var pluralFormatter;
|
|
2129
|
+
var keyCounter = 0; // All the special keywords that can be used in `plural` blocks for the various branches
|
|
2362
2130
|
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2131
|
+
var ONE = 'one';
|
|
2132
|
+
var OTHER$1 = 'other';
|
|
2133
|
+
/**
|
|
2134
|
+
* @private
|
|
2135
|
+
* @param {String} caseBody
|
|
2136
|
+
* @param {Number} value
|
|
2137
|
+
* @return {Object} {caseBody: string, numberValues: object}
|
|
2138
|
+
*/
|
|
2366
2139
|
|
|
2367
|
-
|
|
2140
|
+
function replaceNumberSign(caseBody, value) {
|
|
2141
|
+
var i = 0;
|
|
2142
|
+
var output = '';
|
|
2143
|
+
var numBraces = 0;
|
|
2144
|
+
var numberValues = {};
|
|
2145
|
+
|
|
2146
|
+
while (i < caseBody.length) {
|
|
2147
|
+
if (caseBody[i] === '#' && !numBraces) {
|
|
2148
|
+
var keyParam = "__hashToken".concat(keyCounter++);
|
|
2149
|
+
output += "{".concat(keyParam, ", number}");
|
|
2150
|
+
numberValues[keyParam] = value;
|
|
2151
|
+
} else {
|
|
2152
|
+
output += caseBody[i];
|
|
2368
2153
|
}
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
2375
|
-
} finally {
|
|
2376
|
-
if (_d) throw _e;
|
|
2154
|
+
|
|
2155
|
+
if (caseBody[i] === '{') {
|
|
2156
|
+
numBraces++;
|
|
2157
|
+
} else if (caseBody[i] === '}') {
|
|
2158
|
+
numBraces--;
|
|
2377
2159
|
}
|
|
2160
|
+
|
|
2161
|
+
i++;
|
|
2378
2162
|
}
|
|
2379
2163
|
|
|
2380
|
-
return
|
|
2164
|
+
return {
|
|
2165
|
+
caseBody: output,
|
|
2166
|
+
numberValues: numberValues
|
|
2167
|
+
};
|
|
2381
2168
|
}
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2169
|
+
/**
|
|
2170
|
+
* Handler for `plural` statements within ICU message syntax strings. Returns
|
|
2171
|
+
* a formatted string for the branch that closely matches the current value.
|
|
2172
|
+
*
|
|
2173
|
+
* See https://formatjs.io/docs/core-concepts/icu-syntax#plural-format for more
|
|
2174
|
+
* details on how the `plural` statement works.
|
|
2175
|
+
*
|
|
2176
|
+
* @param {String} value
|
|
2177
|
+
* @param {String} matches
|
|
2178
|
+
* @param {String} locale
|
|
2179
|
+
* @param {String} values
|
|
2180
|
+
* @param {Function} format
|
|
2181
|
+
* @return {String}
|
|
2182
|
+
*/
|
|
2385
2183
|
|
|
2386
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
2387
|
-
arr2[i] = arr[i];
|
|
2388
|
-
}
|
|
2389
2184
|
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2185
|
+
function pluralTypeHandler(value) {
|
|
2186
|
+
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
2187
|
+
var locale = arguments.length > 2 ? arguments[2] : undefined;
|
|
2188
|
+
var values = arguments.length > 3 ? arguments[3] : undefined;
|
|
2189
|
+
var format = arguments.length > 4 ? arguments[4] : undefined;
|
|
2393
2190
|
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2398
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2399
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
2400
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
2401
|
-
}
|
|
2402
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
2403
|
-
function _nonIterableRest() {
|
|
2404
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2405
|
-
}
|
|
2406
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
2191
|
+
var _parseCases = parseCases(matches),
|
|
2192
|
+
args = _parseCases.args,
|
|
2193
|
+
cases = _parseCases.cases;
|
|
2407
2194
|
|
|
2195
|
+
var intValue = parseInt(value);
|
|
2196
|
+
args.forEach(function (arg) {
|
|
2197
|
+
if (arg.startsWith('offset:')) {
|
|
2198
|
+
intValue -= parseInt(arg.slice('offset:'.length));
|
|
2199
|
+
}
|
|
2200
|
+
});
|
|
2201
|
+
var keywordPossibilities = [];
|
|
2408
2202
|
|
|
2203
|
+
if ('PluralRules' in Intl) {
|
|
2204
|
+
// Effectively memoize because instantiation of `Int.*` objects is expensive.
|
|
2205
|
+
if (pluralFormatter === undefined || pluralFormatter.resolvedOptions().locale !== locale) {
|
|
2206
|
+
pluralFormatter = new Intl.PluralRules(locale);
|
|
2207
|
+
}
|
|
2409
2208
|
|
|
2209
|
+
var pluralKeyword = pluralFormatter.select(intValue); // Other is always added last with least priority, so we don't want to add it here.
|
|
2410
2210
|
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
}
|
|
2414
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
2415
|
-
function _classCallCheck(instance, Constructor) {
|
|
2416
|
-
if (!(instance instanceof Constructor)) {
|
|
2417
|
-
throw new TypeError("Cannot call a class as a function");
|
|
2211
|
+
if (pluralKeyword !== OTHER$1) {
|
|
2212
|
+
keywordPossibilities.push(pluralKeyword);
|
|
2213
|
+
}
|
|
2418
2214
|
}
|
|
2419
|
-
}
|
|
2420
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
2421
|
-
function _defineProperties(target, props) {
|
|
2422
|
-
for (var i = 0; i < props.length; i++) {
|
|
2423
|
-
var descriptor = props[i];
|
|
2424
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
2425
|
-
descriptor.configurable = true;
|
|
2426
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
2427
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2428
|
-
}
|
|
2429
|
-
}
|
|
2430
2215
|
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
2434
|
-
return Constructor;
|
|
2435
|
-
}
|
|
2436
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
2437
|
-
function defineProperty_defineProperty(obj, key, value) {
|
|
2438
|
-
if (key in obj) {
|
|
2439
|
-
Object.defineProperty(obj, key, {
|
|
2440
|
-
value: value,
|
|
2441
|
-
enumerable: true,
|
|
2442
|
-
configurable: true,
|
|
2443
|
-
writable: true
|
|
2444
|
-
});
|
|
2445
|
-
} else {
|
|
2446
|
-
obj[key] = value;
|
|
2216
|
+
if (intValue === 1) {
|
|
2217
|
+
keywordPossibilities.push(ONE);
|
|
2447
2218
|
}
|
|
2448
2219
|
|
|
2449
|
-
|
|
2450
|
-
}
|
|
2451
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/array-utils/array-utils.es.js
|
|
2452
|
-
/*
|
|
2453
|
-
* Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
2454
|
-
*
|
|
2455
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2456
|
-
* you may not use this file except in compliance with the License.
|
|
2457
|
-
* You may obtain a copy of the License at
|
|
2458
|
-
*
|
|
2459
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2460
|
-
*
|
|
2461
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2462
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2463
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2464
|
-
* See the License for the specific language governing permissions and
|
|
2465
|
-
* limitations under the License.
|
|
2466
|
-
*/
|
|
2467
|
-
|
|
2468
|
-
/**
|
|
2469
|
-
* Flattens an array of arrays of infinite depth into a single-dimension array.
|
|
2470
|
-
*
|
|
2471
|
-
* > This is now natively in JavaScript as the `flat` method on an Array
|
|
2472
|
-
* > instance. [Check MDN for which browsers have access to this feature](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat).
|
|
2473
|
-
* > If you can't use `flat`, then this method will do the job 🙂
|
|
2474
|
-
*
|
|
2475
|
-
* @param {Array} array
|
|
2476
|
-
* @return {Array} Flattened array.
|
|
2477
|
-
*/
|
|
2478
|
-
function flatten(array) {
|
|
2479
|
-
return array.reduce(function (accumulator, value) {
|
|
2480
|
-
return accumulator.concat(Array.isArray(value) ? flatten(value) : value);
|
|
2481
|
-
}, []);
|
|
2482
|
-
}
|
|
2483
|
-
/**
|
|
2484
|
-
* Creates an array of numbers from the starting value (inclusive) to the end
|
|
2485
|
-
* (exclusive), with an optional step (the gap between values).
|
|
2486
|
-
*
|
|
2487
|
-
* @param {Number} start
|
|
2488
|
-
* The value to start at, the first item in the returned array.
|
|
2489
|
-
* @param {Number} end
|
|
2490
|
-
* The value to end with, the last item in the returned array.
|
|
2491
|
-
* @param {Number} [step=1]
|
|
2492
|
-
* The increment/gap between values, defaults to 1.
|
|
2493
|
-
* @return {Array} An array encompassing the given range.
|
|
2494
|
-
*/
|
|
2495
|
-
|
|
2496
|
-
function range(start, end) {
|
|
2497
|
-
var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
2498
|
-
return Array.apply(0, Array(Math.ceil((end - start) / step))).map(function (empty, index) {
|
|
2499
|
-
return index * step + start;
|
|
2500
|
-
});
|
|
2501
|
-
}
|
|
2502
|
-
/**
|
|
2503
|
-
* Remove and return the first item from `array` that matches the predicate
|
|
2504
|
-
* function.
|
|
2505
|
-
*
|
|
2506
|
-
* @param {Array} array
|
|
2507
|
-
* @param {Function} predicate
|
|
2508
|
-
* Invoked with the array item.
|
|
2509
|
-
* @return {Object} The matching item, or `null` if no match was found.
|
|
2510
|
-
*/
|
|
2511
|
-
|
|
2512
|
-
function remove(array, predicate) {
|
|
2513
|
-
return array.find(function (item, index) {
|
|
2514
|
-
if (predicate(item)) {
|
|
2515
|
-
array.splice(index, 1);
|
|
2516
|
-
return item;
|
|
2517
|
-
}
|
|
2518
|
-
});
|
|
2519
|
-
}
|
|
2220
|
+
keywordPossibilities.push("=".concat(intValue), OTHER$1);
|
|
2520
2221
|
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
/**
|
|
2524
|
-
* A higher-order function to apply [memoization](https://en.wikipedia.org/wiki/Memoization).
|
|
2525
|
-
*
|
|
2526
|
-
* If memoizing a recursive function, then memoize and define the function at
|
|
2527
|
-
* the same time so you can make a call to the memoized function, eg:
|
|
2528
|
-
*
|
|
2529
|
-
* ```javascript
|
|
2530
|
-
* const myFunction = memoize(() => myFunction());
|
|
2531
|
-
* ```
|
|
2532
|
-
*
|
|
2533
|
-
* @param {Function} func
|
|
2534
|
-
* @return {Function}
|
|
2535
|
-
*/
|
|
2536
|
-
function memoize(func) {
|
|
2537
|
-
var cache = {};
|
|
2538
|
-
return function () {
|
|
2539
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2540
|
-
args[_key] = arguments[_key];
|
|
2541
|
-
}
|
|
2222
|
+
for (var i = 0; i < keywordPossibilities.length; i++) {
|
|
2223
|
+
var keyword = keywordPossibilities[i];
|
|
2542
2224
|
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2225
|
+
if (keyword in cases) {
|
|
2226
|
+
var _replaceNumberSign = replaceNumberSign(cases[keyword], intValue),
|
|
2227
|
+
caseBody = _replaceNumberSign.caseBody,
|
|
2228
|
+
numberValues = _replaceNumberSign.numberValues;
|
|
2546
2229
|
|
|
2547
|
-
|
|
2548
|
-
return cache[key];
|
|
2230
|
+
return format(caseBody, icu_message_formatter_es_objectSpread(icu_message_formatter_es_objectSpread({}, values), numberValues));
|
|
2549
2231
|
}
|
|
2232
|
+
}
|
|
2550
2233
|
|
|
2551
|
-
|
|
2552
|
-
cache[key] = result;
|
|
2553
|
-
return result;
|
|
2554
|
-
};
|
|
2234
|
+
return value;
|
|
2555
2235
|
}
|
|
2556
2236
|
|
|
2557
|
-
//# sourceMappingURL=function-utils.es.js.map
|
|
2558
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/lib/icu-message-formatter.es.js
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
2237
|
/*
|
|
2567
2238
|
* Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
2568
2239
|
*
|
|
@@ -2578,540 +2249,1129 @@ function memoize(func) {
|
|
|
2578
2249
|
* See the License for the specific language governing permissions and
|
|
2579
2250
|
* limitations under the License.
|
|
2580
2251
|
*/
|
|
2581
|
-
|
|
2252
|
+
var OTHER = 'other';
|
|
2582
2253
|
/**
|
|
2583
|
-
*
|
|
2584
|
-
*
|
|
2585
|
-
* to "case keys" to choose a subtranslation.
|
|
2254
|
+
* Handler for `select` statements within ICU message syntax strings. Returns
|
|
2255
|
+
* a formatted string for the branch that closely matches the current value.
|
|
2586
2256
|
*
|
|
2587
|
-
*
|
|
2588
|
-
*
|
|
2589
|
-
* (for example, `plural` supports an `offset:n` argument used for
|
|
2590
|
-
* populating the magic `#` variable).
|
|
2257
|
+
* See https://formatjs.io/docs/core-concepts/icu-syntax#select-format for more
|
|
2258
|
+
* details on how the `select` statement works.
|
|
2591
2259
|
*
|
|
2592
|
-
* @param {String}
|
|
2593
|
-
* @
|
|
2594
|
-
*
|
|
2260
|
+
* @param {String} value
|
|
2261
|
+
* @param {String} matches
|
|
2262
|
+
* @param {String} locale
|
|
2263
|
+
* @param {String} values
|
|
2264
|
+
* @param {Function} format
|
|
2265
|
+
* @return {String}
|
|
2595
2266
|
*/
|
|
2596
|
-
function parseCases(string) {
|
|
2597
|
-
var isWhitespace = function isWhitespace(ch) {
|
|
2598
|
-
return /\s/.test(ch);
|
|
2599
|
-
};
|
|
2600
2267
|
|
|
2601
|
-
|
|
2602
|
-
var
|
|
2603
|
-
var
|
|
2604
|
-
var
|
|
2605
|
-
var inTerm = false;
|
|
2606
|
-
var i = 0;
|
|
2268
|
+
function selectTypeHandler(value) {
|
|
2269
|
+
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
2270
|
+
var values = arguments.length > 3 ? arguments[3] : undefined;
|
|
2271
|
+
var format = arguments.length > 4 ? arguments[4] : undefined;
|
|
2607
2272
|
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
if (inTerm && (isWhitespace(string[i]) || string[i] === '{')) {
|
|
2611
|
-
inTerm = false;
|
|
2612
|
-
latestTerm = string.slice(currTermStart, i); // We want to process the opening char again so the case will be properly registered.
|
|
2273
|
+
var _parseCases = parseCases(matches),
|
|
2274
|
+
cases = _parseCases.cases;
|
|
2613
2275
|
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
var caseBody = string[i] === '{'; // If there's a previous term, we can either handle a whole
|
|
2620
|
-
// case, or add that as an argument.
|
|
2276
|
+
if (value in cases) {
|
|
2277
|
+
return format(cases[value], values);
|
|
2278
|
+
} else if (OTHER in cases) {
|
|
2279
|
+
return format(cases[OTHER], values);
|
|
2280
|
+
}
|
|
2621
2281
|
|
|
2622
|
-
|
|
2623
|
-
|
|
2282
|
+
return value;
|
|
2283
|
+
}
|
|
2624
2284
|
|
|
2625
|
-
if (branchEndIndex === -1) {
|
|
2626
|
-
throw new Error("Unbalanced curly braces in string: \"".concat(string, "\""));
|
|
2627
|
-
}
|
|
2628
2285
|
|
|
2629
|
-
|
|
2286
|
+
//# sourceMappingURL=icu-message-formatter.es.js.map
|
|
2630
2287
|
|
|
2631
|
-
|
|
2288
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/hooks.js
|
|
2632
2289
|
|
|
2633
|
-
latestTerm = null;
|
|
2634
|
-
} else {
|
|
2635
|
-
if (latestTerm) {
|
|
2636
|
-
args.push(latestTerm);
|
|
2637
|
-
latestTerm = null;
|
|
2638
|
-
}
|
|
2639
2290
|
|
|
2640
|
-
inTerm = true;
|
|
2641
|
-
currTermStart = i;
|
|
2642
|
-
}
|
|
2643
|
-
}
|
|
2644
2291
|
|
|
2645
|
-
|
|
2646
|
-
|
|
2292
|
+
// The passed in locale (en-GB) is only used to call Intl.PluralRules.select() in
|
|
2293
|
+
// pluralTypeHandler. Since we only use exact plural matches (=0, =1 etc) we can
|
|
2294
|
+
// safely use en-GB all the time.
|
|
2647
2295
|
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2296
|
+
const formatter = new MessageFormatter('en-GB', {
|
|
2297
|
+
plural: pluralTypeHandler,
|
|
2298
|
+
select: selectTypeHandler
|
|
2299
|
+
});
|
|
2300
|
+
function hooks_useI18n() {
|
|
2301
|
+
const translations = useSelector(Selectors.selectTranslations);
|
|
2302
|
+
const locale = useSelector(Selectors.selectLocale);
|
|
2303
|
+
const initialLocale = useSelector(Selectors.selectInitialLocale);
|
|
2304
|
+
const t = useCallback((key, values = {}) => {
|
|
2305
|
+
const translation = translations[key];
|
|
2651
2306
|
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2307
|
+
if (!translation) {
|
|
2308
|
+
return null;
|
|
2309
|
+
}
|
|
2655
2310
|
|
|
2311
|
+
return formatter.format(translation, values);
|
|
2312
|
+
}, [translations]);
|
|
2656
2313
|
return {
|
|
2657
|
-
|
|
2658
|
-
|
|
2314
|
+
t,
|
|
2315
|
+
locale,
|
|
2316
|
+
initialLocale
|
|
2659
2317
|
};
|
|
2660
2318
|
}
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
* strings that could have nested brackets.
|
|
2664
|
-
*
|
|
2665
|
-
* @param {String} string
|
|
2666
|
-
* @param {Number} fromIndex
|
|
2667
|
-
* @return {Number} The index of the matching closing bracket, or -1 if no
|
|
2668
|
-
* closing bracket could be found.
|
|
2669
|
-
*/
|
|
2319
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/reducer.js
|
|
2320
|
+
function i18n_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2670
2321
|
|
|
2671
|
-
function
|
|
2672
|
-
var depth = 0;
|
|
2322
|
+
function i18n_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { i18n_reducer_ownKeys(Object(source), true).forEach(function (key) { i18n_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { i18n_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2673
2323
|
|
|
2674
|
-
|
|
2675
|
-
var char = string.charAt(i);
|
|
2324
|
+
function i18n_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2676
2325
|
|
|
2677
|
-
if (char === '}') {
|
|
2678
|
-
if (depth === 0) {
|
|
2679
|
-
return i;
|
|
2680
|
-
}
|
|
2681
2326
|
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2327
|
+
|
|
2328
|
+
const defaultState = {
|
|
2329
|
+
translations: {
|
|
2330
|
+
'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
|
|
2331
|
+
'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
|
|
2332
|
+
'errors.configError.title': 'Chat configuration error.',
|
|
2333
|
+
'errors.general.buttonText': 'Restart chat',
|
|
2334
|
+
'errors.general.message': 'Do you want to start a new chat session?',
|
|
2335
|
+
'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
|
|
2336
|
+
'errors.general.title': 'Something went wrong',
|
|
2337
|
+
'errors.seamlyOffline.message': 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
|
|
2338
|
+
'errors.seamlyOffline.srText': 'The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.',
|
|
2339
|
+
'errors.seamlyOffline.title': 'Connection issues',
|
|
2340
|
+
'errors.seamlyUnavailable.buttonText': 'Try again',
|
|
2341
|
+
'errors.seamlyUnavailable.message': 'The server could not be reached. Try again in a little while.',
|
|
2342
|
+
'errors.seamlyUnavailable.srText': 'The chat server could not be reached. Try again in a little while.',
|
|
2343
|
+
'errors.seamlyUnavailable.title': 'Server unavailable'
|
|
2344
|
+
},
|
|
2345
|
+
isLoading: false,
|
|
2346
|
+
initialLocale: undefined
|
|
2347
|
+
};
|
|
2348
|
+
/* harmony default export */ const i18n_reducer = (i18n_utils_createReducer({
|
|
2349
|
+
[setInitialLocale]: (state, {
|
|
2350
|
+
locale
|
|
2351
|
+
}) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
2352
|
+
initialLocale: locale
|
|
2353
|
+
}),
|
|
2354
|
+
[setLocale.pending]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
2355
|
+
isLoading: true
|
|
2356
|
+
}),
|
|
2357
|
+
[setLocale.fulfilled]: (state, {
|
|
2358
|
+
payload: translations,
|
|
2359
|
+
meta: {
|
|
2360
|
+
arg: locale
|
|
2361
|
+
}
|
|
2362
|
+
}) => {
|
|
2363
|
+
if (!translations) {
|
|
2364
|
+
return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
2365
|
+
isLoading: false
|
|
2366
|
+
});
|
|
2685
2367
|
}
|
|
2686
|
-
}
|
|
2687
2368
|
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2369
|
+
return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
2370
|
+
isLoading: false,
|
|
2371
|
+
locale,
|
|
2372
|
+
translations: Object.keys(translations).sort().reduce((accum, key) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, accum), {}, {
|
|
2373
|
+
[key]: translations[key]
|
|
2374
|
+
}), {})
|
|
2375
|
+
});
|
|
2376
|
+
},
|
|
2377
|
+
[setLocale.rejected]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
2378
|
+
isLoading: false
|
|
2379
|
+
})
|
|
2380
|
+
}, defaultState));
|
|
2381
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/index.js
|
|
2699
2382
|
|
|
2700
|
-
function splitFormattedArgument(block) {
|
|
2701
|
-
return split(block.slice(1, -1), ',', 3);
|
|
2702
|
-
}
|
|
2703
|
-
/**
|
|
2704
|
-
* Like `String.prototype.split()` but where the limit parameter causes the
|
|
2705
|
-
* remainder of the string to be grouped together in a final entry.
|
|
2706
|
-
*
|
|
2707
|
-
* @private
|
|
2708
|
-
* @param {String} string
|
|
2709
|
-
* @param {String} separator
|
|
2710
|
-
* @param {Number} limit
|
|
2711
|
-
* @param {Array} [accumulator=[]]
|
|
2712
|
-
* @return {Array}
|
|
2713
|
-
*/
|
|
2714
2383
|
|
|
2715
|
-
function split(string, separator, limit) {
|
|
2716
|
-
var accumulator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
2717
2384
|
|
|
2718
|
-
if (!string) {
|
|
2719
|
-
return accumulator;
|
|
2720
|
-
}
|
|
2721
2385
|
|
|
2722
|
-
if (limit === 1) {
|
|
2723
|
-
accumulator.push(string);
|
|
2724
|
-
return accumulator;
|
|
2725
|
-
}
|
|
2726
2386
|
|
|
2727
|
-
|
|
2387
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
|
|
2728
2388
|
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2389
|
+
const {
|
|
2390
|
+
createAction: app_utils_createAction,
|
|
2391
|
+
createThunk: app_utils_createThunk,
|
|
2392
|
+
createReducer: app_utils_createReducer,
|
|
2393
|
+
selectState: app_utils_selectState
|
|
2394
|
+
} = createDomain('app');
|
|
2395
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
|
|
2396
|
+
|
|
2397
|
+
|
|
2398
|
+
const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
|
|
2399
|
+
|
|
2400
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/utils.js
|
|
2401
|
+
|
|
2402
|
+
|
|
2403
|
+
const {
|
|
2404
|
+
createAction: visibility_utils_createAction,
|
|
2405
|
+
createActions: utils_createActions,
|
|
2406
|
+
createThunk: visibility_utils_createThunk,
|
|
2407
|
+
createReducer: visibility_utils_createReducer,
|
|
2408
|
+
selectState: visibility_utils_selectState
|
|
2409
|
+
} = createDomain('visibility');
|
|
2410
|
+
const calculateVisibility = ({
|
|
2411
|
+
hasResponded,
|
|
2412
|
+
previousVisibility,
|
|
2413
|
+
requestedVisibility,
|
|
2414
|
+
config
|
|
2415
|
+
}) => {
|
|
2416
|
+
const {
|
|
2417
|
+
defaults,
|
|
2418
|
+
layoutMode,
|
|
2419
|
+
hideOnNoUserResponse
|
|
2420
|
+
} = config;
|
|
2421
|
+
const {
|
|
2422
|
+
visible: defaultVisibility
|
|
2423
|
+
} = defaults || {}; // Requesting open should override the responded check.
|
|
2424
|
+
|
|
2425
|
+
if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== constants_visibilityStates.open) {
|
|
2426
|
+
return hasResponded ? requestedVisibility || previousVisibility || constants_visibilityStates.open : constants_visibilityStates.hidden;
|
|
2732
2427
|
}
|
|
2733
2428
|
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
}
|
|
2429
|
+
const baseVisibility = layoutMode === 'inline' ? constants_visibilityStates.open : constants_visibilityStates.minimized;
|
|
2430
|
+
return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
|
|
2431
|
+
};
|
|
2432
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/selectors.js
|
|
2739
2433
|
|
|
2740
|
-
/**
|
|
2741
|
-
* The main class for formatting messages.
|
|
2742
|
-
*
|
|
2743
|
-
* @author Emanuel Rabina
|
|
2744
|
-
*/
|
|
2745
2434
|
|
|
2746
|
-
|
|
2747
|
-
/**
|
|
2748
|
-
* Creates a new formatter that can work using any of the custom type handlers
|
|
2749
|
-
* you register.
|
|
2750
|
-
*
|
|
2751
|
-
* @param {String} locale
|
|
2752
|
-
* @param {Object} [typeHandlers={}]
|
|
2753
|
-
* Optional object where the keys are the names of the types to register,
|
|
2754
|
-
* their values being the functions that will return a nicely formatted
|
|
2755
|
-
* string for the data and locale they are given.
|
|
2756
|
-
*/
|
|
2757
|
-
function MessageFormatter(locale) {
|
|
2758
|
-
var _this = this;
|
|
2435
|
+
const selectVisibility = createSelector(visibility_utils_selectState, state => state.visibility);
|
|
2759
2436
|
|
|
2760
|
-
|
|
2437
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
2438
|
+
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; }
|
|
2761
2439
|
|
|
2762
|
-
|
|
2440
|
+
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; }
|
|
2763
2441
|
|
|
2764
|
-
|
|
2765
|
-
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2766
|
-
return flatten(_this.process(message, values)).join('');
|
|
2767
|
-
}));
|
|
2442
|
+
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; }
|
|
2768
2443
|
|
|
2769
|
-
|
|
2770
|
-
|
|
2444
|
+
|
|
2445
|
+
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
const seamly_state_hooks_selectState = state => state.state;
|
|
2449
|
+
const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
|
|
2450
|
+
const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
|
|
2451
|
+
events
|
|
2452
|
+
}, config) => {
|
|
2453
|
+
var _config$messages;
|
|
2454
|
+
|
|
2455
|
+
const {
|
|
2456
|
+
enabled,
|
|
2457
|
+
threshold
|
|
2458
|
+
} = (config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) ?? {};
|
|
2459
|
+
|
|
2460
|
+
if (!enabled) {
|
|
2461
|
+
return events;
|
|
2771
2462
|
}
|
|
2772
|
-
/**
|
|
2773
|
-
* Formats an ICU message syntax string using `values` for placeholder data
|
|
2774
|
-
* and any currently-registered type handlers.
|
|
2775
|
-
*
|
|
2776
|
-
* @param {String} message
|
|
2777
|
-
* @param {Object} [values={}]
|
|
2778
|
-
* @return {String}
|
|
2779
|
-
*/
|
|
2780
2463
|
|
|
2464
|
+
const mappedEvents = [];
|
|
2465
|
+
let previousEvent = null;
|
|
2466
|
+
events.forEach((event, idx) => {
|
|
2467
|
+
// always add timeIndicator to first message
|
|
2468
|
+
if (idx === 0) {
|
|
2469
|
+
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2470
|
+
timeIndicator: event.payload.occurredAt
|
|
2471
|
+
})); // else check if diff is greater than threshold
|
|
2472
|
+
} else {
|
|
2473
|
+
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
2474
|
+
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2475
|
+
timeIndicator
|
|
2476
|
+
}));
|
|
2477
|
+
}
|
|
2781
2478
|
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
*
|
|
2796
|
-
* @param {String} message
|
|
2797
|
-
* @param {Object} [values={}]
|
|
2798
|
-
* @return {Array}
|
|
2799
|
-
*/
|
|
2800
|
-
function process(message) {
|
|
2801
|
-
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2479
|
+
previousEvent = event;
|
|
2480
|
+
});
|
|
2481
|
+
return mappedEvents;
|
|
2482
|
+
});
|
|
2483
|
+
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
2484
|
+
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
2485
|
+
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
2486
|
+
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
2487
|
+
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
2488
|
+
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
2489
|
+
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
2490
|
+
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2491
|
+
var _filteredEvents;
|
|
2802
2492
|
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2493
|
+
const filteredEvents = events.filter(event => event.type === 'message');
|
|
2494
|
+
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
2495
|
+
});
|
|
2496
|
+
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
2497
|
+
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
2498
|
+
const useSeamlyCurrentAgent = () => {
|
|
2499
|
+
const {
|
|
2500
|
+
participants,
|
|
2501
|
+
currentAgent
|
|
2502
|
+
} = seamly_state_hooks_useSeamlyStateContext().participantInfo;
|
|
2503
|
+
return currentAgent ? participants[currentAgent] : null;
|
|
2504
|
+
};
|
|
2505
|
+
const useSeamlyServiceData = key => seamly_state_hooks_useSeamlyStateContext().serviceData[key];
|
|
2506
|
+
const useEntryTextLimit = () => {
|
|
2507
|
+
const {
|
|
2508
|
+
entryMeta: {
|
|
2509
|
+
options: {
|
|
2510
|
+
text
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
} = seamly_state_hooks_useSeamlyStateContext();
|
|
2514
|
+
const {
|
|
2515
|
+
limit
|
|
2516
|
+
} = text || {};
|
|
2517
|
+
return {
|
|
2518
|
+
hasLimit: limit != null,
|
|
2519
|
+
limit: limit != null ? limit : null
|
|
2520
|
+
};
|
|
2521
|
+
};
|
|
2522
|
+
const useSeamlyLayoutMode = () => {
|
|
2523
|
+
const {
|
|
2524
|
+
layoutMode
|
|
2525
|
+
} = useConfig();
|
|
2526
|
+
return {
|
|
2527
|
+
isInline: layoutMode === 'inline',
|
|
2528
|
+
isModal: layoutMode === 'modal',
|
|
2529
|
+
isWindow: layoutMode === 'window',
|
|
2530
|
+
isResolving: !layoutMode
|
|
2531
|
+
};
|
|
2532
|
+
};
|
|
2533
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/actions.js
|
|
2534
|
+
function actions_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; }
|
|
2535
|
+
|
|
2536
|
+
function actions_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { actions_ownKeys(Object(source), true).forEach(function (key) { actions_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { actions_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2537
|
+
|
|
2538
|
+
function actions_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; }
|
|
2539
|
+
|
|
2540
|
+
|
|
2541
|
+
|
|
2542
|
+
|
|
2543
|
+
|
|
2544
|
+
|
|
2545
|
+
|
|
2546
|
+
const setFromStorage = visibility_utils_createAction('setFromStorage', visibility => ({
|
|
2547
|
+
visibility
|
|
2548
|
+
}));
|
|
2549
|
+
const validVisibilityStates = [constants_visibilityStates.open, constants_visibilityStates.minimized, constants_visibilityStates.hidden];
|
|
2550
|
+
const setVisibility = visibility_utils_createThunk('set', (requestedVisibility, {
|
|
2551
|
+
getState,
|
|
2552
|
+
extra: {
|
|
2553
|
+
api,
|
|
2554
|
+
eventBus
|
|
2555
|
+
}
|
|
2556
|
+
}) => {
|
|
2557
|
+
const state = getState();
|
|
2558
|
+
const previousVisibility = selectVisibility(state);
|
|
2559
|
+
const hasResponded = selectUserHasResponded(state);
|
|
2560
|
+
const hasConversation = api.hasConversation();
|
|
2561
|
+
const config = selectConfig(state);
|
|
2562
|
+
const {
|
|
2563
|
+
visibilityCallback = calculateVisibility,
|
|
2564
|
+
layoutMode
|
|
2565
|
+
} = config;
|
|
2566
|
+
const {
|
|
2567
|
+
unreadEvents: unreadMessageCount
|
|
2568
|
+
} = seamly_state_hooks_selectState(state);
|
|
2569
|
+
const calculatedVisibility = visibilityCallback({
|
|
2570
|
+
hasConversation,
|
|
2571
|
+
hasResponded,
|
|
2572
|
+
previousVisibility,
|
|
2573
|
+
requestedVisibility,
|
|
2574
|
+
config
|
|
2575
|
+
});
|
|
2576
|
+
|
|
2577
|
+
if (!validVisibilityStates.includes(calculatedVisibility)) {
|
|
2578
|
+
console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
|
|
2579
|
+
return undefined;
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
if (previousVisibility === calculatedVisibility) {
|
|
2583
|
+
return undefined;
|
|
2584
|
+
} // Store the user-requested visibility in order to reinitialize after refresh
|
|
2585
|
+
|
|
2586
|
+
|
|
2587
|
+
api.store.set(StoreKey, actions_objectSpread(actions_objectSpread({}, api.store.get(StoreKey) || {}), {}, {
|
|
2588
|
+
[layoutMode]: requestedVisibility
|
|
2589
|
+
}));
|
|
2590
|
+
|
|
2591
|
+
if (requestedVisibility) {
|
|
2592
|
+
eventBus.emit('ui.visible', requestedVisibility, {
|
|
2593
|
+
visibility: requestedVisibility,
|
|
2594
|
+
hasConversation,
|
|
2595
|
+
hasResponded,
|
|
2596
|
+
unreadMessageCount
|
|
2597
|
+
});
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
return calculatedVisibility;
|
|
2601
|
+
});
|
|
2602
|
+
const actions_initialize = visibility_utils_createThunk('initialize', async (locale, {
|
|
2603
|
+
dispatch,
|
|
2604
|
+
getState,
|
|
2605
|
+
extra: {
|
|
2606
|
+
api
|
|
2607
|
+
}
|
|
2608
|
+
}) => {
|
|
2609
|
+
var _api$store$get;
|
|
2610
|
+
|
|
2611
|
+
// initialize stored visibility
|
|
2612
|
+
const {
|
|
2613
|
+
layoutMode
|
|
2614
|
+
} = selectConfig(getState());
|
|
2615
|
+
const storedVisibility = (_api$store$get = api.store.get(StoreKey)) === null || _api$store$get === void 0 ? void 0 : _api$store$get[layoutMode];
|
|
2616
|
+
|
|
2617
|
+
if (storedVisibility) {
|
|
2618
|
+
dispatch(setFromStorage(storedVisibility));
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
dispatch(setVisibility(constants_visibilityStates.initialize));
|
|
2622
|
+
});
|
|
2623
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unavailable-error.js
|
|
2624
|
+
/**
|
|
2625
|
+
* This error is used to alert the user that there's a problem with the connection
|
|
2626
|
+
* when initialising the application because of a connection issue on either the server
|
|
2627
|
+
* or the client side.
|
|
2628
|
+
*/
|
|
2629
|
+
class SeamlyUnavailableError extends Error {
|
|
2630
|
+
constructor(params) {
|
|
2631
|
+
super(params);
|
|
2632
|
+
|
|
2633
|
+
if (Error.captureStackTrace) {
|
|
2634
|
+
Error.captureStackTrace(this, SeamlyUnavailableError);
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
this.name = 'SeamlyUnavailableError';
|
|
2638
|
+
this.langKey = 'errors.seamlyUnavailable';
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
}
|
|
2642
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-base-error.js
|
|
2643
|
+
class SeamlyBaseError extends Error {
|
|
2644
|
+
constructor(originalError, ...params) {
|
|
2645
|
+
super(...params);
|
|
2646
|
+
|
|
2647
|
+
if (Error.captureStackTrace) {
|
|
2648
|
+
Error.captureStackTrace(this, Object.getPrototypeOf(this));
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
this.originalError = originalError;
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
}
|
|
2655
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-session-expired-error.js
|
|
2656
|
+
|
|
2657
|
+
class SeamlySessionExpiredError extends SeamlyBaseError {
|
|
2658
|
+
constructor(originalError, ...params) {
|
|
2659
|
+
super(originalError, ...params);
|
|
2660
|
+
this.name = 'SeamlySessionExpiredError';
|
|
2661
|
+
this.action = 'reset';
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
}
|
|
2665
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
|
|
2666
|
+
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
|
|
2674
|
+
hasResponded
|
|
2675
|
+
}));
|
|
2676
|
+
const app_actions_initialize = app_utils_createThunk('initialize', async (config, {
|
|
2677
|
+
dispatch,
|
|
2678
|
+
extra: {
|
|
2679
|
+
api
|
|
2680
|
+
}
|
|
2681
|
+
}) => {
|
|
2682
|
+
var _config$context;
|
|
2683
|
+
|
|
2684
|
+
dispatch(initialize(config));
|
|
2685
|
+
let locale = config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale;
|
|
2686
|
+
|
|
2687
|
+
try {
|
|
2688
|
+
const {
|
|
2689
|
+
features,
|
|
2690
|
+
defaultLocale
|
|
2691
|
+
} = await api.getConfig();
|
|
2692
|
+
dispatch({
|
|
2693
|
+
type: seamly_utils_seamlyActions.SET_FEATURES,
|
|
2694
|
+
features
|
|
2695
|
+
});
|
|
2696
|
+
locale = locale || defaultLocale;
|
|
2697
|
+
dispatch(setInitialLocale(locale));
|
|
2698
|
+
} catch (e) {
|
|
2699
|
+
throw new SeamlyUnavailableError();
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
try {
|
|
2703
|
+
if (api.hasConversation()) {
|
|
2704
|
+
var _initialState$transla;
|
|
2705
|
+
|
|
2706
|
+
const initialState = await api.getConversationIntitialState();
|
|
2707
|
+
dispatch({
|
|
2708
|
+
type: seamly_utils_seamlyActions.SET_INITIAL_STATE,
|
|
2709
|
+
initialState
|
|
2710
|
+
});
|
|
2711
|
+
locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
|
|
2712
|
+
|
|
2713
|
+
if ('userResponded' in initialState) {
|
|
2714
|
+
dispatch(setHasResponded(initialState.userResponded));
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
} catch (e) {
|
|
2718
|
+
if (e instanceof SeamlySessionExpiredError) {
|
|
2719
|
+
throw e;
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
throw new SeamlyUnavailableError();
|
|
2723
|
+
} finally {
|
|
2724
|
+
await dispatch(setLocale(locale));
|
|
2725
|
+
dispatch(actions_initialize());
|
|
2726
|
+
}
|
|
2727
|
+
});
|
|
2728
|
+
const actions_reset = app_utils_createAction('reset', () => {});
|
|
2729
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
|
|
2730
|
+
|
|
2731
|
+
|
|
2732
|
+
function hooks_useUserHasResponded() {
|
|
2733
|
+
return useSelector(Selectors.selectUserHasResponded);
|
|
2734
|
+
}
|
|
2735
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/reducer.js
|
|
2736
|
+
function app_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2737
|
+
|
|
2738
|
+
function app_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { app_reducer_ownKeys(Object(source), true).forEach(function (key) { app_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { app_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2739
|
+
|
|
2740
|
+
function app_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2741
|
+
|
|
2742
|
+
|
|
2743
|
+
|
|
2744
|
+
const reducer_initialState = {
|
|
2745
|
+
userHasResponded: false
|
|
2746
|
+
};
|
|
2747
|
+
/* harmony default export */ const app_reducer = (app_utils_createReducer({
|
|
2748
|
+
[setHasResponded]: (state, {
|
|
2749
|
+
hasResponded
|
|
2750
|
+
}) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
|
|
2751
|
+
userHasResponded: hasResponded
|
|
2752
|
+
})
|
|
2753
|
+
}, reducer_initialState));
|
|
2754
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
|
|
2755
|
+
|
|
2756
|
+
|
|
2757
|
+
|
|
2758
|
+
|
|
2759
|
+
|
|
2760
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/store/state-reducer.js
|
|
2761
|
+
function state_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; }
|
|
2762
|
+
|
|
2763
|
+
function state_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { state_reducer_ownKeys(Object(source), true).forEach(function (key) { state_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { state_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2764
|
+
|
|
2765
|
+
function state_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; }
|
|
2766
|
+
|
|
2767
|
+
// Legacy state reducer. Do not add new features here but extract/create new reducers as needed
|
|
2768
|
+
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
const state_reducer_initialState = {
|
|
2772
|
+
events: [],
|
|
2773
|
+
initialState: {},
|
|
2774
|
+
unreadEvents: 0,
|
|
2775
|
+
isLoading: false,
|
|
2776
|
+
idleDetachCountdown: {
|
|
2777
|
+
hasCountdown: false,
|
|
2778
|
+
isActive: false
|
|
2779
|
+
},
|
|
2780
|
+
resumeConversationPrompt: false,
|
|
2781
|
+
serviceInfo: {
|
|
2782
|
+
activeServiceSessionId: ''
|
|
2783
|
+
},
|
|
2784
|
+
participantInfo: {
|
|
2785
|
+
participants: {},
|
|
2786
|
+
currentAgent: ''
|
|
2787
|
+
},
|
|
2788
|
+
headerTitles: {
|
|
2789
|
+
title: null,
|
|
2790
|
+
subTitle: ''
|
|
2791
|
+
},
|
|
2792
|
+
historyLoaded: false,
|
|
2793
|
+
skiplinkTargetId: id_randomId(),
|
|
2794
|
+
optionsButtonId: id_randomId(),
|
|
2795
|
+
cobrowsingContainerId: id_randomId(),
|
|
2796
|
+
headerCollapseButtonId: id_randomId(),
|
|
2797
|
+
serviceData: {},
|
|
2798
|
+
options: {
|
|
2799
|
+
features: {},
|
|
2800
|
+
panelActive: false,
|
|
2801
|
+
optionActive: '',
|
|
2802
|
+
userSelectedOptions: {}
|
|
2803
|
+
},
|
|
2804
|
+
showFileUpload: false,
|
|
2805
|
+
currentUploads: [],
|
|
2806
|
+
entryMeta: {
|
|
2807
|
+
default: entryTypes.text,
|
|
2808
|
+
active: entryTypes.text,
|
|
2809
|
+
userSelected: null,
|
|
2810
|
+
blockAutoEntrySwitch: false,
|
|
2811
|
+
options: {},
|
|
2812
|
+
optionsOverride: {}
|
|
2813
|
+
},
|
|
2814
|
+
seamlyContainerElement: null
|
|
2815
|
+
};
|
|
2816
|
+
function stateReducer(state = state_reducer_initialState, action) {
|
|
2817
|
+
if (action.type === String(actions_reset)) {
|
|
2818
|
+
const {
|
|
2819
|
+
visible
|
|
2820
|
+
} = state;
|
|
2821
|
+
return state_reducer_objectSpread(state_reducer_objectSpread({}, state_reducer_initialState), {}, {
|
|
2822
|
+
visible
|
|
2823
|
+
});
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
return seamlyStateReducer(state, action);
|
|
2827
|
+
}
|
|
2828
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/utils.js
|
|
2829
|
+
|
|
2830
|
+
const {
|
|
2831
|
+
createActions: forms_utils_createActions,
|
|
2832
|
+
createReducer: forms_utils_createReducer,
|
|
2833
|
+
selectState: forms_utils_selectState
|
|
2834
|
+
} = createDomain('forms');
|
|
2835
|
+
function utils_validate(values, schema = {}) {
|
|
2836
|
+
return Object.entries(schema).reduce((errors, [key, validations]) => {
|
|
2837
|
+
if (validations && !Array.isArray(validations)) {
|
|
2838
|
+
// eslint-disable-next-line no-param-reassign
|
|
2839
|
+
validations = [validations];
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
for (let i = 0; i < ((_validations = validations) === null || _validations === void 0 ? void 0 : _validations.length) ?? 0; i++) {
|
|
2843
|
+
var _validations;
|
|
2844
|
+
|
|
2845
|
+
if (!validations[i].fn(values[key], validations[i].compareValue)) {
|
|
2846
|
+
errors[key] = validations[i].errorText;
|
|
2847
|
+
break;
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
return errors;
|
|
2852
|
+
}, {});
|
|
2853
|
+
}
|
|
2854
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/actions.js
|
|
2855
|
+
|
|
2856
|
+
const [registerForm, deregisterForm] = forms_utils_createActions('form', {
|
|
2857
|
+
register: (formId, persistData) => ({
|
|
2858
|
+
formId,
|
|
2859
|
+
persistData
|
|
2860
|
+
}),
|
|
2861
|
+
deregister: formId => ({
|
|
2862
|
+
formId
|
|
2863
|
+
})
|
|
2864
|
+
});
|
|
2865
|
+
const [registerControl, deregisterControl, updateControlValue, updateControlTouched] = forms_utils_createActions('control', {
|
|
2866
|
+
register: (formId, name) => ({
|
|
2867
|
+
formId,
|
|
2868
|
+
name
|
|
2869
|
+
}),
|
|
2870
|
+
deregister: (formId, name) => ({
|
|
2871
|
+
formId,
|
|
2872
|
+
name
|
|
2873
|
+
}),
|
|
2874
|
+
updateValue: (formId, name, value) => ({
|
|
2875
|
+
formId,
|
|
2876
|
+
name,
|
|
2877
|
+
value
|
|
2878
|
+
}),
|
|
2879
|
+
updateTouched: (formId, name, touched) => ({
|
|
2880
|
+
formId,
|
|
2881
|
+
name,
|
|
2882
|
+
touched
|
|
2883
|
+
})
|
|
2884
|
+
});
|
|
2885
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/redux/utils.js
|
|
2886
|
+
const arrayContentEquals = (a, b) => {
|
|
2887
|
+
if (a === b) {
|
|
2888
|
+
return true;
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {
|
|
2892
|
+
return false;
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
return a.every((value, idx) => b[idx] === value);
|
|
2896
|
+
};
|
|
2897
|
+
const getPropSelector = (propName, orDefault) => (_, props) => props[propName] || orDefault;
|
|
2898
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/selectors.js
|
|
2899
|
+
|
|
2900
|
+
|
|
2901
|
+
|
|
2902
|
+
const getState = forms_utils_selectState;
|
|
2903
|
+
const selectors_getFormById = createSelector(getState, getPropSelector('formId'), (forms, formId) => forms[formId]);
|
|
2904
|
+
const getFormControlsByFormId = createSelector(selectors_getFormById, form => (form === null || form === void 0 ? void 0 : form.controls) || {});
|
|
2905
|
+
const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId, controls => {
|
|
2906
|
+
const valuesObj = {};
|
|
2907
|
+
Object.entries(controls).forEach(([key, {
|
|
2908
|
+
value
|
|
2909
|
+
}]) => {
|
|
2910
|
+
valuesObj[key] = value;
|
|
2911
|
+
});
|
|
2912
|
+
return valuesObj;
|
|
2913
|
+
});
|
|
2914
|
+
const selectors_getControlValueByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) => {
|
|
2915
|
+
var _controls$name;
|
|
2916
|
+
|
|
2917
|
+
return (_controls$name = controls[name]) === null || _controls$name === void 0 ? void 0 : _controls$name.value;
|
|
2918
|
+
});
|
|
2919
|
+
const selectors_getControlTouchedByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) => {
|
|
2920
|
+
var _controls$name2;
|
|
2921
|
+
|
|
2922
|
+
return (_controls$name2 = controls[name]) === null || _controls$name2 === void 0 ? void 0 : _controls$name2.touched;
|
|
2923
|
+
});
|
|
2924
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/context.js
|
|
2925
|
+
|
|
2926
|
+
const context_FormContext = (0,external_preact_namespaceObject.createContext)({});
|
|
2927
|
+
/* harmony default export */ const forms_context = ((/* unused pure expression or super */ null && (context_FormContext)));
|
|
2928
|
+
const {
|
|
2929
|
+
Provider: forms_context_Provider,
|
|
2930
|
+
Consumer: context_Consumer
|
|
2931
|
+
} = context_FormContext;
|
|
2932
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/hooks.js
|
|
2933
|
+
|
|
2934
|
+
|
|
2935
|
+
|
|
2936
|
+
|
|
2937
|
+
|
|
2938
|
+
|
|
2939
|
+
function hooks_useFormContext() {
|
|
2940
|
+
return useContext(FormContext);
|
|
2941
|
+
}
|
|
2942
|
+
function hooks_useForm() {
|
|
2943
|
+
const {
|
|
2944
|
+
handleSubmit
|
|
2945
|
+
} = hooks_useFormContext();
|
|
2946
|
+
return {
|
|
2947
|
+
handleSubmit
|
|
2948
|
+
};
|
|
2949
|
+
}
|
|
2950
|
+
function hooks_useValidations(values, validationSchema) {
|
|
2951
|
+
const errors = useMemo(() => validate(values, validationSchema), [values, validationSchema]);
|
|
2952
|
+
return {
|
|
2953
|
+
isValid: Object.keys(errors).length === 0,
|
|
2954
|
+
errors
|
|
2955
|
+
};
|
|
2956
|
+
}
|
|
2957
|
+
function hooks_useFormControl(name) {
|
|
2958
|
+
const dispatch = useStoreDispatch();
|
|
2959
|
+
const {
|
|
2960
|
+
formId,
|
|
2961
|
+
updateControlValue,
|
|
2962
|
+
updateControlTouched,
|
|
2963
|
+
errors
|
|
2964
|
+
} = hooks_useFormContext();
|
|
2965
|
+
const form = useSelectorWithProps(getFormById, {
|
|
2966
|
+
formId
|
|
2967
|
+
}, [formId]);
|
|
2968
|
+
const isRegistered = !!form;
|
|
2969
|
+
const isRegisteredRef = useRef();
|
|
2970
|
+
isRegisteredRef.current = isRegistered;
|
|
2971
|
+
const value = useSelectorWithProps(getControlValueByName, {
|
|
2972
|
+
formId,
|
|
2973
|
+
name
|
|
2974
|
+
}, [formId, name]);
|
|
2975
|
+
const touched = useSelectorWithProps(getControlTouchedByName, {
|
|
2976
|
+
formId,
|
|
2977
|
+
name
|
|
2978
|
+
}, [formId, name]);
|
|
2979
|
+
const error = errors === null || errors === void 0 ? void 0 : errors[name];
|
|
2980
|
+
const isValid = !error;
|
|
2981
|
+
useEffect(() => {
|
|
2982
|
+
// Make sure the form is registered
|
|
2983
|
+
// Since child useEffect runs before FormProvider useEffect
|
|
2984
|
+
if (isRegisteredRef.current) {
|
|
2985
|
+
dispatch(Actions.registerControl(formId, name));
|
|
2986
|
+
}
|
|
2987
|
+
}, [isRegistered, formId, name, dispatch]);
|
|
2988
|
+
useLayoutEffect(() => {
|
|
2989
|
+
return () => {
|
|
2990
|
+
dispatch(Actions.deregisterControl(formId, name));
|
|
2991
|
+
};
|
|
2992
|
+
}, [isRegistered, formId, name, dispatch]); // preact uses onInput instead of onChange
|
|
2993
|
+
|
|
2994
|
+
const onInput = useCallback(e => updateControlValue(name, e.target.value), [name, updateControlValue]);
|
|
2995
|
+
const onBlur = useCallback(() => {
|
|
2996
|
+
updateControlTouched(name, true);
|
|
2997
|
+
}, [updateControlTouched, name]);
|
|
2998
|
+
const field = useMemo(() => ({
|
|
2999
|
+
name,
|
|
3000
|
+
onInput,
|
|
3001
|
+
onBlur,
|
|
3002
|
+
value
|
|
3003
|
+
}), [name, onInput, onBlur, value]);
|
|
3004
|
+
const meta = useMemo(() => ({
|
|
3005
|
+
isValid,
|
|
3006
|
+
error,
|
|
3007
|
+
touched
|
|
3008
|
+
}), [isValid, error, touched]);
|
|
3009
|
+
return [field, meta];
|
|
3010
|
+
}
|
|
3011
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/provider.js
|
|
3012
|
+
const provider_excluded = (/* unused pure expression or super */ null && (["children", "formId", "persistData", "onSubmit", "validationSchema"]));
|
|
2806
3013
|
|
|
2807
|
-
|
|
3014
|
+
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; }
|
|
2808
3015
|
|
|
2809
|
-
|
|
2810
|
-
var blockEndIndex = findClosingBracket(message, blockStartIndex);
|
|
3016
|
+
function provider_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { provider_ownKeys(Object(source), true).forEach(function (key) { provider_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { provider_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2811
3017
|
|
|
2812
|
-
|
|
2813
|
-
var block = message.substring(blockStartIndex, blockEndIndex + 1);
|
|
3018
|
+
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; }
|
|
2814
3019
|
|
|
2815
|
-
|
|
2816
|
-
var result = [];
|
|
2817
|
-
var head = message.substring(0, blockStartIndex);
|
|
3020
|
+
function provider_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = provider_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
2818
3021
|
|
|
2819
|
-
|
|
2820
|
-
result.push(head);
|
|
2821
|
-
}
|
|
3022
|
+
function provider_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
2822
3023
|
|
|
2823
|
-
var _splitFormattedArgume = splitFormattedArgument(block),
|
|
2824
|
-
_splitFormattedArgume2 = _slicedToArray(_splitFormattedArgume, 3),
|
|
2825
|
-
key = _splitFormattedArgume2[0],
|
|
2826
|
-
type = _splitFormattedArgume2[1],
|
|
2827
|
-
format = _splitFormattedArgume2[2];
|
|
2828
3024
|
|
|
2829
|
-
var body = values[key];
|
|
2830
3025
|
|
|
2831
|
-
if (body === null || body === undefined) {
|
|
2832
|
-
body = '';
|
|
2833
|
-
}
|
|
2834
3026
|
|
|
2835
|
-
var typeHandler = type && this.typeHandlers[type];
|
|
2836
|
-
result.push(typeHandler ? typeHandler(body, format, this.locale, values, this.process.bind(this)) : body);
|
|
2837
|
-
var tail = message.substring(blockEndIndex + 1);
|
|
2838
3027
|
|
|
2839
|
-
if (tail) {
|
|
2840
|
-
result.push(this.process(tail, values));
|
|
2841
|
-
}
|
|
2842
3028
|
|
|
2843
|
-
return result;
|
|
2844
|
-
}
|
|
2845
|
-
} else {
|
|
2846
|
-
throw new Error("Unbalanced curly braces in string: \"".concat(message, "\""));
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
3029
|
|
|
2850
|
-
return [message];
|
|
2851
|
-
}
|
|
2852
|
-
}]);
|
|
2853
3030
|
|
|
2854
|
-
|
|
2855
|
-
|
|
3031
|
+
function provider_FormProvider(_ref) {
|
|
3032
|
+
let {
|
|
3033
|
+
children,
|
|
3034
|
+
formId,
|
|
3035
|
+
persistData,
|
|
3036
|
+
onSubmit,
|
|
3037
|
+
validationSchema
|
|
3038
|
+
} = _ref,
|
|
3039
|
+
props = provider_objectWithoutProperties(_ref, provider_excluded);
|
|
2856
3040
|
|
|
2857
|
-
|
|
3041
|
+
const dispatch = useStoreDispatch();
|
|
3042
|
+
const values = useSelectorWithProps(getFormValuesByFormId, {
|
|
3043
|
+
formId
|
|
3044
|
+
}, [formId]);
|
|
3045
|
+
const [isSubmitted, setIsSubmitted] = useState(false);
|
|
3046
|
+
const [externalErrors, setExternalErrors] = useState({});
|
|
3047
|
+
const {
|
|
3048
|
+
isValid: validationIsValid,
|
|
3049
|
+
errors: validationErrors
|
|
3050
|
+
} = useValidations(values, validationSchema);
|
|
3051
|
+
const errors = useMemo(() => provider_objectSpread(provider_objectSpread({}, validationErrors), externalErrors), [validationErrors, externalErrors]); // register
|
|
2858
3052
|
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
3053
|
+
useLayoutEffect(() => {
|
|
3054
|
+
// register form in redux store
|
|
3055
|
+
dispatch(Actions.registerForm(formId, persistData));
|
|
3056
|
+
}, [formId, persistData, dispatch]); // deregister
|
|
2862
3057
|
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
3058
|
+
useEffect(() => {
|
|
3059
|
+
return () => {
|
|
3060
|
+
// deregister form from redux store
|
|
3061
|
+
dispatch(Actions.deregisterForm(formId));
|
|
3062
|
+
};
|
|
3063
|
+
}, [formId, persistData, dispatch]);
|
|
3064
|
+
const updateControlValue = useCallback((name, value) => {
|
|
3065
|
+
dispatch(Actions.updateControlValue(formId, name, value));
|
|
3066
|
+
}, [formId, dispatch]);
|
|
3067
|
+
const updateControlTouched = useCallback((name, touched) => {
|
|
3068
|
+
dispatch(Actions.updateControlTouched(formId, name, touched));
|
|
3069
|
+
}, [dispatch, formId]); // Function to manually set an error
|
|
2871
3070
|
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
3071
|
+
const setError = useCallback((name, error) => {
|
|
3072
|
+
setExternalErrors(val => {
|
|
3073
|
+
return provider_objectSpread(provider_objectSpread({}, val), {}, {
|
|
3074
|
+
[name]: error
|
|
3075
|
+
});
|
|
3076
|
+
});
|
|
3077
|
+
}, [setExternalErrors]);
|
|
3078
|
+
const handleSubmit = useCallback(e => {
|
|
3079
|
+
e.preventDefault();
|
|
3080
|
+
setIsSubmitted(true);
|
|
2877
3081
|
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
} else {
|
|
2884
|
-
output += caseBody[i];
|
|
3082
|
+
if (validationIsValid) {
|
|
3083
|
+
onSubmit(values, {
|
|
3084
|
+
updateControlValue,
|
|
3085
|
+
setError
|
|
3086
|
+
});
|
|
2885
3087
|
}
|
|
3088
|
+
}, [validationIsValid, onSubmit, values, updateControlValue, setError]);
|
|
3089
|
+
const contextValue = useMemo(() => ({
|
|
3090
|
+
formId,
|
|
3091
|
+
values,
|
|
3092
|
+
errors,
|
|
3093
|
+
isValid: Object.keys(errors).length === 0,
|
|
3094
|
+
isSubmitted,
|
|
3095
|
+
handleSubmit,
|
|
3096
|
+
validationSchema,
|
|
3097
|
+
updateControlValue,
|
|
3098
|
+
updateControlTouched
|
|
3099
|
+
}), [formId, values, errors, isSubmitted, handleSubmit, validationSchema, updateControlValue, updateControlTouched]);
|
|
2886
3100
|
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
}
|
|
3101
|
+
if (!formId) {
|
|
3102
|
+
console.error('"formId" is required.');
|
|
3103
|
+
return null;
|
|
3104
|
+
}
|
|
2892
3105
|
|
|
2893
|
-
|
|
3106
|
+
if (!onSubmit) {
|
|
3107
|
+
console.error('"onSubmit" is required.');
|
|
3108
|
+
return null;
|
|
2894
3109
|
}
|
|
2895
3110
|
|
|
2896
|
-
return {
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
};
|
|
3111
|
+
return _jsx(Provider, provider_objectSpread(provider_objectSpread({}, props), {}, {
|
|
3112
|
+
value: contextValue,
|
|
3113
|
+
children: children
|
|
3114
|
+
}));
|
|
2900
3115
|
}
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
* a formatted string for the branch that closely matches the current value.
|
|
2904
|
-
*
|
|
2905
|
-
* See https://formatjs.io/docs/core-concepts/icu-syntax#plural-format for more
|
|
2906
|
-
* details on how the `plural` statement works.
|
|
2907
|
-
*
|
|
2908
|
-
* @param {String} value
|
|
2909
|
-
* @param {String} matches
|
|
2910
|
-
* @param {String} locale
|
|
2911
|
-
* @param {String} values
|
|
2912
|
-
* @param {Function} format
|
|
2913
|
-
* @return {String}
|
|
2914
|
-
*/
|
|
3116
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/reducer.js
|
|
3117
|
+
function forms_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; }
|
|
2915
3118
|
|
|
3119
|
+
function forms_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { forms_reducer_ownKeys(Object(source), true).forEach(function (key) { forms_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { forms_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2916
3120
|
|
|
2917
|
-
function
|
|
2918
|
-
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
2919
|
-
var locale = arguments.length > 2 ? arguments[2] : undefined;
|
|
2920
|
-
var values = arguments.length > 3 ? arguments[3] : undefined;
|
|
2921
|
-
var format = arguments.length > 4 ? arguments[4] : undefined;
|
|
3121
|
+
function forms_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; }
|
|
2922
3122
|
|
|
2923
|
-
var _parseCases = parseCases(matches),
|
|
2924
|
-
args = _parseCases.args,
|
|
2925
|
-
cases = _parseCases.cases;
|
|
2926
3123
|
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
3124
|
+
|
|
3125
|
+
const forms_reducer_initialState = {};
|
|
3126
|
+
const initialFormState = {
|
|
3127
|
+
controls: {}
|
|
3128
|
+
};
|
|
3129
|
+
const initialControlState = {
|
|
3130
|
+
value: '',
|
|
3131
|
+
touched: false
|
|
3132
|
+
};
|
|
3133
|
+
|
|
3134
|
+
function updateFormControl(state, formId, name, controlState) {
|
|
3135
|
+
var _state$formId;
|
|
3136
|
+
|
|
3137
|
+
const currentControlState = ((_state$formId = state[formId]) === null || _state$formId === void 0 ? void 0 : _state$formId.controls[name]) || initialControlState;
|
|
3138
|
+
return forms_reducer_objectSpread(forms_reducer_objectSpread({}, state), {}, {
|
|
3139
|
+
[formId]: forms_reducer_objectSpread(forms_reducer_objectSpread({}, state[formId]), {}, {
|
|
3140
|
+
controls: forms_reducer_objectSpread(forms_reducer_objectSpread({}, state[formId].controls), {}, {
|
|
3141
|
+
[name]: forms_reducer_objectSpread(forms_reducer_objectSpread({}, currentControlState), controlState)
|
|
3142
|
+
})
|
|
3143
|
+
})
|
|
2932
3144
|
});
|
|
2933
|
-
|
|
3145
|
+
}
|
|
2934
3146
|
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
3147
|
+
/* harmony default export */ const forms_reducer = (forms_utils_createReducer({
|
|
3148
|
+
// Form handlers
|
|
3149
|
+
[registerForm]: (state, {
|
|
3150
|
+
formId,
|
|
3151
|
+
persistData
|
|
3152
|
+
}) => {
|
|
3153
|
+
const formState = persistData ? state[formId] ?? forms_reducer_objectSpread(forms_reducer_objectSpread({}, initialFormState), {}, {
|
|
3154
|
+
persistData
|
|
3155
|
+
}) : forms_reducer_objectSpread(forms_reducer_objectSpread({}, initialFormState), {}, {
|
|
3156
|
+
persistData
|
|
3157
|
+
});
|
|
3158
|
+
return forms_reducer_objectSpread(forms_reducer_objectSpread({}, state), {}, {
|
|
3159
|
+
[formId]: formState
|
|
3160
|
+
});
|
|
3161
|
+
},
|
|
3162
|
+
[deregisterForm]: (state, {
|
|
3163
|
+
formId
|
|
3164
|
+
}) => {
|
|
3165
|
+
var _newState$formId;
|
|
3166
|
+
|
|
3167
|
+
const newState = forms_reducer_objectSpread({}, state);
|
|
3168
|
+
|
|
3169
|
+
if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
|
|
3170
|
+
delete newState[formId];
|
|
2939
3171
|
}
|
|
2940
3172
|
|
|
2941
|
-
|
|
3173
|
+
return newState;
|
|
3174
|
+
},
|
|
3175
|
+
// Form control handlers
|
|
3176
|
+
[registerControl]: (state, {
|
|
3177
|
+
name,
|
|
3178
|
+
formId
|
|
3179
|
+
}) => {
|
|
3180
|
+
return updateFormControl(state, formId, name);
|
|
3181
|
+
},
|
|
3182
|
+
[deregisterControl]: (state, {
|
|
3183
|
+
formId,
|
|
3184
|
+
name
|
|
3185
|
+
}) => {
|
|
3186
|
+
const form = state[formId];
|
|
2942
3187
|
|
|
2943
|
-
if (
|
|
2944
|
-
|
|
3188
|
+
if (!form) {
|
|
3189
|
+
return state;
|
|
2945
3190
|
}
|
|
2946
|
-
}
|
|
2947
3191
|
|
|
2948
|
-
|
|
2949
|
-
|
|
3192
|
+
if (form.persistData) {
|
|
3193
|
+
return state;
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
const controls = forms_reducer_objectSpread({}, form.controls);
|
|
3197
|
+
|
|
3198
|
+
delete controls[name];
|
|
3199
|
+
return forms_reducer_objectSpread(forms_reducer_objectSpread({}, state), {}, {
|
|
3200
|
+
[formId]: forms_reducer_objectSpread(forms_reducer_objectSpread({}, form), {}, {
|
|
3201
|
+
controls
|
|
3202
|
+
})
|
|
3203
|
+
});
|
|
3204
|
+
},
|
|
3205
|
+
[updateControlValue]: (state, {
|
|
3206
|
+
formId,
|
|
3207
|
+
name,
|
|
3208
|
+
value
|
|
3209
|
+
}) => {
|
|
3210
|
+
return updateFormControl(state, formId, name, {
|
|
3211
|
+
value
|
|
3212
|
+
});
|
|
3213
|
+
},
|
|
3214
|
+
[updateControlTouched]: (state, {
|
|
3215
|
+
formId,
|
|
3216
|
+
name,
|
|
3217
|
+
touched
|
|
3218
|
+
}) => {
|
|
3219
|
+
return updateFormControl(state, formId, name, {
|
|
3220
|
+
touched
|
|
3221
|
+
});
|
|
2950
3222
|
}
|
|
3223
|
+
}, forms_reducer_initialState));
|
|
3224
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/index.js
|
|
2951
3225
|
|
|
2952
|
-
keywordPossibilities.push("=".concat(intValue), OTHER$1);
|
|
2953
|
-
|
|
2954
|
-
for (var i = 0; i < keywordPossibilities.length; i++) {
|
|
2955
|
-
var keyword = keywordPossibilities[i];
|
|
2956
3226
|
|
|
2957
|
-
if (keyword in cases) {
|
|
2958
|
-
var _replaceNumberSign = replaceNumberSign(cases[keyword], intValue),
|
|
2959
|
-
caseBody = _replaceNumberSign.caseBody,
|
|
2960
|
-
numberValues = _replaceNumberSign.numberValues;
|
|
2961
3227
|
|
|
2962
|
-
return format(caseBody, icu_message_formatter_es_objectSpread(icu_message_formatter_es_objectSpread({}, values), numberValues));
|
|
2963
|
-
}
|
|
2964
|
-
}
|
|
2965
3228
|
|
|
2966
|
-
return value;
|
|
2967
|
-
}
|
|
2968
3229
|
|
|
2969
|
-
/*
|
|
2970
|
-
* Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
2971
|
-
*
|
|
2972
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2973
|
-
* you may not use this file except in compliance with the License.
|
|
2974
|
-
* You may obtain a copy of the License at
|
|
2975
|
-
*
|
|
2976
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2977
|
-
*
|
|
2978
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2979
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2980
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2981
|
-
* See the License for the specific language governing permissions and
|
|
2982
|
-
* limitations under the License.
|
|
2983
|
-
*/
|
|
2984
|
-
var OTHER = 'other';
|
|
2985
|
-
/**
|
|
2986
|
-
* Handler for `select` statements within ICU message syntax strings. Returns
|
|
2987
|
-
* a formatted string for the branch that closely matches the current value.
|
|
2988
|
-
*
|
|
2989
|
-
* See https://formatjs.io/docs/core-concepts/icu-syntax#select-format for more
|
|
2990
|
-
* details on how the `select` statement works.
|
|
2991
|
-
*
|
|
2992
|
-
* @param {String} value
|
|
2993
|
-
* @param {String} matches
|
|
2994
|
-
* @param {String} locale
|
|
2995
|
-
* @param {String} values
|
|
2996
|
-
* @param {Function} format
|
|
2997
|
-
* @return {String}
|
|
2998
|
-
*/
|
|
2999
3230
|
|
|
3000
|
-
|
|
3001
|
-
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
3002
|
-
var values = arguments.length > 3 ? arguments[3] : undefined;
|
|
3003
|
-
var format = arguments.length > 4 ? arguments[4] : undefined;
|
|
3231
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
3004
3232
|
|
|
3005
|
-
|
|
3006
|
-
|
|
3233
|
+
const {
|
|
3234
|
+
createActions: translations_utils_createActions,
|
|
3235
|
+
createReducer: translations_utils_createReducer,
|
|
3236
|
+
selectState: translations_utils_selectState
|
|
3237
|
+
} = createDomain('translations');
|
|
3238
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
3007
3239
|
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
}
|
|
3240
|
+
const [enable, disable] = translations_utils_createActions('translate', {
|
|
3241
|
+
enable: locale => ({
|
|
3242
|
+
locale
|
|
3243
|
+
}),
|
|
3244
|
+
disable: () => ({})
|
|
3245
|
+
});
|
|
3246
|
+
const [enableEvent, disableEvent] = translations_utils_createActions('event', {
|
|
3247
|
+
enable: payloadId => ({
|
|
3248
|
+
payloadId
|
|
3249
|
+
}),
|
|
3250
|
+
disable: payloadId => ({
|
|
3251
|
+
payloadId
|
|
3252
|
+
})
|
|
3253
|
+
});
|
|
3254
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/selectors.js
|
|
3013
3255
|
|
|
3014
|
-
return value;
|
|
3015
|
-
}
|
|
3016
3256
|
|
|
3017
3257
|
|
|
3018
|
-
|
|
3258
|
+
const selectors_getState = translations_utils_selectState;
|
|
3259
|
+
const getOriginalPayloadIds = createSelector(selectors_getState, state => state.originalPayloadIds);
|
|
3260
|
+
const getIsPayloadTranslated = createSelector(getOriginalPayloadIds, getPropSelector('payloadId'), (payloadIds, payloadId) => !payloadIds.includes(payloadId));
|
|
3261
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-api-context.js
|
|
3019
3262
|
|
|
3020
|
-
|
|
3263
|
+
const seamly_api_context_SeamlyApiContext = (0,external_preact_namespaceObject.createContext)(null);
|
|
3264
|
+
const seamly_api_context_SeamlyEventBusContext = (0,external_preact_namespaceObject.createContext)('');
|
|
3265
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-api-hooks.js
|
|
3021
3266
|
|
|
3022
3267
|
|
|
3268
|
+
const seamly_api_hooks_useSeamlyApiContext = () => useContext(SeamlyApiContext);
|
|
3269
|
+
const seamly_api_hooks_useSeamlyObjectStore = () => {
|
|
3270
|
+
const api = seamly_api_hooks_useSeamlyApiContext();
|
|
3271
|
+
return api.store || {};
|
|
3272
|
+
};
|
|
3273
|
+
const useSeamlyConversationUrl = () => {
|
|
3274
|
+
const {
|
|
3275
|
+
get
|
|
3276
|
+
} = seamly_api_hooks_useSeamlyObjectStore();
|
|
3023
3277
|
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3278
|
+
if (get) {
|
|
3279
|
+
return get('conversationUrl');
|
|
3280
|
+
}
|
|
3027
3281
|
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
const initialLocale = useSelector(Selectors.selectInitialLocale);
|
|
3036
|
-
const t = useCallback((key, values = {}) => {
|
|
3037
|
-
const translation = translations[key];
|
|
3282
|
+
return null;
|
|
3283
|
+
};
|
|
3284
|
+
const seamly_api_hooks_useSeamlyHasConversation = () => {
|
|
3285
|
+
const url = useSeamlyConversationUrl();
|
|
3286
|
+
return !!url;
|
|
3287
|
+
};
|
|
3288
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-dispatch.js
|
|
3038
3289
|
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
}
|
|
3290
|
+
/* harmony default export */ const use_seamly_dispatch = ((/* unused pure expression or super */ null && (useStoreDispatch)));
|
|
3291
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/focus-helper-hooks.js
|
|
3042
3292
|
|
|
3043
|
-
return formatter.format(translation, values);
|
|
3044
|
-
}, [translations]);
|
|
3045
|
-
return {
|
|
3046
|
-
t,
|
|
3047
|
-
locale,
|
|
3048
|
-
initialLocale
|
|
3049
|
-
};
|
|
3050
|
-
}
|
|
3051
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/reducer.js
|
|
3052
|
-
function i18n_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3053
3293
|
|
|
3054
|
-
function i18n_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { i18n_reducer_ownKeys(Object(source), true).forEach(function (key) { i18n_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { i18n_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
3055
3294
|
|
|
3056
|
-
function i18n_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3057
3295
|
|
|
3058
3296
|
|
|
3297
|
+
const {
|
|
3298
|
+
SET_SEAMLY_CONTAINER_ELEMENT: focus_helper_hooks_SET_SEAMLY_CONTAINER_ELEMENT
|
|
3299
|
+
} = seamly_utils_seamlyActions;
|
|
3059
3300
|
|
|
3060
|
-
const
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
|
|
3068
|
-
'errors.general.title': 'Something went wrong',
|
|
3069
|
-
'errors.seamlyOffline.message': 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
|
|
3070
|
-
'errors.seamlyOffline.srText': 'The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.',
|
|
3071
|
-
'errors.seamlyOffline.title': 'Connection issues'
|
|
3072
|
-
},
|
|
3073
|
-
isLoading: false,
|
|
3074
|
-
initialLocale: undefined
|
|
3301
|
+
const focusWithRaf = el => {
|
|
3302
|
+
requestAnimationFrame(() => {
|
|
3303
|
+
requestAnimationFrame(() => {
|
|
3304
|
+
const focusEl = typeof el === 'string' ? document.getElementById(el) : el;
|
|
3305
|
+
focusElement(focusEl);
|
|
3306
|
+
});
|
|
3307
|
+
});
|
|
3075
3308
|
};
|
|
3076
|
-
/* harmony default export */ const i18n_reducer = (i18n_utils_createReducer({
|
|
3077
|
-
[setInitialLocale]: (state, {
|
|
3078
|
-
locale
|
|
3079
|
-
}) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3080
|
-
initialLocale: locale
|
|
3081
|
-
}),
|
|
3082
|
-
[setLocale.pending]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3083
|
-
isLoading: true
|
|
3084
|
-
}),
|
|
3085
|
-
[setLocale.fulfilled]: (state, {
|
|
3086
|
-
payload: translations,
|
|
3087
|
-
meta: {
|
|
3088
|
-
arg: locale
|
|
3089
|
-
}
|
|
3090
|
-
}) => {
|
|
3091
|
-
if (!translations) {
|
|
3092
|
-
return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3093
|
-
isLoading: false
|
|
3094
|
-
});
|
|
3095
|
-
}
|
|
3096
3309
|
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3310
|
+
const useSeamlyContainerElement = () => {
|
|
3311
|
+
const {
|
|
3312
|
+
seamlyContainerElement
|
|
3313
|
+
} = useSeamlyStateContext();
|
|
3314
|
+
const dispatch = useSeamlyDispatchContext();
|
|
3315
|
+
const setSeamlyContainerElement = useCallback(element => {
|
|
3316
|
+
dispatch({
|
|
3317
|
+
type: focus_helper_hooks_SET_SEAMLY_CONTAINER_ELEMENT,
|
|
3318
|
+
element
|
|
3103
3319
|
});
|
|
3104
|
-
},
|
|
3105
|
-
[
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3320
|
+
}, [dispatch]);
|
|
3321
|
+
return [seamlyContainerElement, setSeamlyContainerElement];
|
|
3322
|
+
};
|
|
3323
|
+
const focus_helper_hooks_useElementFocusingById = elementId => useCallback(() => {
|
|
3324
|
+
focusWithRaf(elementId);
|
|
3325
|
+
}, [elementId]);
|
|
3326
|
+
const focus_helper_hooks_useSkiplinkTargetFocusing = () => {
|
|
3327
|
+
const skiplinkTargetId = useSkiplink();
|
|
3328
|
+
return focus_helper_hooks_useElementFocusingById(skiplinkTargetId);
|
|
3329
|
+
};
|
|
3330
|
+
const useFocusIfSeamlyContainedFocus = () => {
|
|
3331
|
+
const containerElementRef = useRef(null);
|
|
3332
|
+
const [seamlyContainerElement] = useSeamlyContainerElement();
|
|
3333
|
+
containerElementRef.current = seamlyContainerElement;
|
|
3334
|
+
return useCallback(elementToFocus => {
|
|
3335
|
+
const focusFn = () => {
|
|
3336
|
+
focusWithRaf(elementToFocus);
|
|
3337
|
+
};
|
|
3338
|
+
|
|
3339
|
+
runIfElementContainsOrHasFocus(containerElementRef.current, focusFn);
|
|
3340
|
+
}, []);
|
|
3341
|
+
};
|
|
3342
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
|
|
3110
3343
|
|
|
3111
3344
|
|
|
3112
3345
|
|
|
3346
|
+
const useSeamlyAppContainerClassNames = () => {
|
|
3347
|
+
return useConfig().appContainerClassNames;
|
|
3348
|
+
};
|
|
3349
|
+
const useSeamlyMessageContainerClassNames = event => {
|
|
3350
|
+
const {
|
|
3351
|
+
fromClient
|
|
3352
|
+
} = event.payload;
|
|
3353
|
+
const classNames = ['message'];
|
|
3113
3354
|
|
|
3355
|
+
if (event.type === 'info') {
|
|
3356
|
+
classNames.push('message--source-info');
|
|
3357
|
+
} else if (!fromClient) {
|
|
3358
|
+
classNames.push('message--source-agent');
|
|
3359
|
+
} else {
|
|
3360
|
+
classNames.push('message--source-user');
|
|
3361
|
+
}
|
|
3114
3362
|
|
|
3363
|
+
return classNames;
|
|
3364
|
+
};
|
|
3365
|
+
const useCobrowsingContainer = () => {
|
|
3366
|
+
const {
|
|
3367
|
+
cobrowsingContainerId: id
|
|
3368
|
+
} = useSeamlyStateContext();
|
|
3369
|
+
const focusContainer = useElementFocusingById(id);
|
|
3370
|
+
return {
|
|
3371
|
+
id,
|
|
3372
|
+
focusContainer
|
|
3373
|
+
};
|
|
3374
|
+
};
|
|
3115
3375
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-option-hooks.js
|
|
3116
3376
|
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; }
|
|
3117
3377
|
|
|
@@ -3408,14 +3668,10 @@ function hooks_useInterrupt() {
|
|
|
3408
3668
|
};
|
|
3409
3669
|
}
|
|
3410
3670
|
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
|
|
3411
|
-
class SeamlyGeneralError extends Error {
|
|
3412
|
-
constructor(params) {
|
|
3413
|
-
super(params);
|
|
3414
|
-
|
|
3415
|
-
if (Error.captureStackTrace) {
|
|
3416
|
-
Error.captureStackTrace(this, SeamlyGeneralError);
|
|
3417
|
-
}
|
|
3418
3671
|
|
|
3672
|
+
class SeamlyGeneralError extends SeamlyBaseError {
|
|
3673
|
+
constructor(originalError, ...params) {
|
|
3674
|
+
super(originalError, ...params);
|
|
3419
3675
|
this.name = 'SeamlyGeneralError';
|
|
3420
3676
|
this.langKey = 'errors.general';
|
|
3421
3677
|
this.action = 'reset';
|
|
@@ -3423,56 +3679,30 @@ class SeamlyGeneralError extends Error {
|
|
|
3423
3679
|
|
|
3424
3680
|
}
|
|
3425
3681
|
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-configuration-error.js
|
|
3426
|
-
class SeamlyConfigurationError extends Error {
|
|
3427
|
-
constructor(params) {
|
|
3428
|
-
super(params);
|
|
3429
|
-
|
|
3430
|
-
if (Error.captureStackTrace) {
|
|
3431
|
-
Error.captureStackTrace(this, SeamlyConfigurationError);
|
|
3432
|
-
}
|
|
3433
3682
|
|
|
3683
|
+
class SeamlyConfigurationError extends SeamlyBaseError {
|
|
3684
|
+
constructor(originalError, ...params) {
|
|
3685
|
+
super(originalError, ...params);
|
|
3434
3686
|
this.name = 'SeamlyConfigurationError';
|
|
3435
3687
|
this.langKey = 'errors.configError';
|
|
3436
3688
|
}
|
|
3437
3689
|
|
|
3438
|
-
}
|
|
3439
|
-
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-session-expired-error.js
|
|
3440
|
-
class SeamlySessionExpiredError extends Error {
|
|
3441
|
-
constructor(params) {
|
|
3442
|
-
super(params);
|
|
3443
|
-
|
|
3444
|
-
if (Error.captureStackTrace) {
|
|
3445
|
-
Error.captureStackTrace(this, SeamlySessionExpiredError);
|
|
3446
|
-
}
|
|
3447
|
-
|
|
3448
|
-
this.name = 'SeamlySessionExpiredError';
|
|
3449
|
-
this.action = 'reset';
|
|
3450
|
-
}
|
|
3451
|
-
|
|
3452
3690
|
}
|
|
3453
3691
|
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-offline-error.js
|
|
3454
|
-
class SeamlyOfflineError extends Error {
|
|
3455
|
-
constructor(params) {
|
|
3456
|
-
super(params);
|
|
3457
|
-
|
|
3458
|
-
if (Error.captureStackTrace) {
|
|
3459
|
-
Error.captureStackTrace(this, SeamlyOfflineError);
|
|
3460
|
-
}
|
|
3461
3692
|
|
|
3693
|
+
class SeamlyOfflineError extends SeamlyBaseError {
|
|
3694
|
+
constructor(originalError, ...params) {
|
|
3695
|
+
super(originalError, ...params);
|
|
3462
3696
|
this.name = 'SeamlyOfflineError';
|
|
3463
3697
|
this.langKey = 'errors.seamlyOffline';
|
|
3464
3698
|
}
|
|
3465
3699
|
|
|
3466
3700
|
}
|
|
3467
3701
|
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unauthorized-error.js
|
|
3468
|
-
class SeamlyUnauthorizedError extends Error {
|
|
3469
|
-
constructor(params) {
|
|
3470
|
-
super(params);
|
|
3471
|
-
|
|
3472
|
-
if (Error.captureStackTrace) {
|
|
3473
|
-
Error.captureStackTrace(this, SeamlyUnauthorizedError);
|
|
3474
|
-
}
|
|
3475
3702
|
|
|
3703
|
+
class SeamlyUnauthorizedError extends SeamlyBaseError {
|
|
3704
|
+
constructor(originalError, ...params) {
|
|
3705
|
+
super(originalError, ...params);
|
|
3476
3706
|
this.name = 'SeamlyUnauthorizedError';
|
|
3477
3707
|
this.langKey = 'errors.general';
|
|
3478
3708
|
this.action = 'reset';
|
|
@@ -3486,12 +3716,23 @@ class SeamlyUnauthorizedError extends Error {
|
|
|
3486
3716
|
|
|
3487
3717
|
|
|
3488
3718
|
|
|
3489
|
-
const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError];
|
|
3490
|
-
function middleware_createMiddleware(
|
|
3719
|
+
const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
|
|
3720
|
+
function middleware_createMiddleware({
|
|
3721
|
+
api
|
|
3722
|
+
}) {
|
|
3491
3723
|
return () => next => action => {
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3724
|
+
const {
|
|
3725
|
+
error
|
|
3726
|
+
} = action;
|
|
3727
|
+
|
|
3728
|
+
if (error) {
|
|
3729
|
+
if (!handledErrorTypes.some(ErrorType => error instanceof ErrorType)) {
|
|
3730
|
+
throw error;
|
|
3731
|
+
} else if (error.action === 'reset') {
|
|
3732
|
+
// [SMLY-942] We clear the store before a reset to force a new conversation if the page is refreshed before the conversation is reset
|
|
3733
|
+
api.disconnect().then(() => {
|
|
3734
|
+
api.clearStore();
|
|
3735
|
+
});
|
|
3495
3736
|
}
|
|
3496
3737
|
}
|
|
3497
3738
|
|
|
@@ -3507,20 +3748,22 @@ function interrupt_reducer_defineProperty(obj, key, value) { if (key in obj) { O
|
|
|
3507
3748
|
|
|
3508
3749
|
|
|
3509
3750
|
|
|
3751
|
+
|
|
3510
3752
|
const interrupt_reducer_initialState = {
|
|
3511
3753
|
error: undefined
|
|
3512
3754
|
};
|
|
3755
|
+
|
|
3756
|
+
const handleError = (state, {
|
|
3757
|
+
error
|
|
3758
|
+
}) => interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
|
|
3759
|
+
error
|
|
3760
|
+
});
|
|
3761
|
+
|
|
3513
3762
|
/* harmony default export */ const interrupt_reducer = (interrupt_utils_createReducer({
|
|
3514
|
-
[set]:
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
error
|
|
3519
|
-
});
|
|
3520
|
-
},
|
|
3521
|
-
[clear]: () => {
|
|
3522
|
-
return interrupt_reducer_initialState;
|
|
3523
|
-
}
|
|
3763
|
+
[set]: handleError,
|
|
3764
|
+
[app_actions_initialize.rejected]: handleError,
|
|
3765
|
+
[clear]: () => interrupt_reducer_initialState,
|
|
3766
|
+
[actions_reset]: () => interrupt_reducer_initialState
|
|
3524
3767
|
}, interrupt_reducer_initialState));
|
|
3525
3768
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
|
|
3526
3769
|
|
|
@@ -3529,99 +3772,58 @@ const interrupt_reducer_initialState = {
|
|
|
3529
3772
|
|
|
3530
3773
|
|
|
3531
3774
|
|
|
3532
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/
|
|
3533
|
-
|
|
3534
|
-
const {
|
|
3535
|
-
createAction: app_utils_createAction,
|
|
3536
|
-
createThunk: app_utils_createThunk,
|
|
3537
|
-
createReducer: app_utils_createReducer,
|
|
3538
|
-
selectState: app_utils_selectState
|
|
3539
|
-
} = createDomain('app');
|
|
3540
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
|
|
3547
|
-
hasResponded
|
|
3548
|
-
}));
|
|
3549
|
-
const actions_initialize = app_utils_createThunk('initialize', async (config, {
|
|
3550
|
-
dispatch,
|
|
3551
|
-
extra: {
|
|
3552
|
-
api
|
|
3553
|
-
}
|
|
3554
|
-
}) => {
|
|
3555
|
-
try {
|
|
3556
|
-
var _config$context;
|
|
3775
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/hooks.js
|
|
3557
3776
|
|
|
3558
|
-
dispatch(initialize(config));
|
|
3559
|
-
const {
|
|
3560
|
-
features,
|
|
3561
|
-
defaultLocale
|
|
3562
|
-
} = await api.getConfig();
|
|
3563
|
-
dispatch({
|
|
3564
|
-
type: seamly_utils_seamlyActions.SET_FEATURES,
|
|
3565
|
-
features
|
|
3566
|
-
});
|
|
3567
|
-
let locale = (config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale) || defaultLocale;
|
|
3568
|
-
dispatch(setInitialLocale(locale));
|
|
3569
3777
|
|
|
3570
|
-
try {
|
|
3571
|
-
if (api.hasConversation()) {
|
|
3572
|
-
var _initialState$transla;
|
|
3573
3778
|
|
|
3574
|
-
const initialState = await api.getConversationIntitialState();
|
|
3575
|
-
dispatch({
|
|
3576
|
-
type: seamly_utils_seamlyActions.SET_INITIAL_STATE,
|
|
3577
|
-
initialState
|
|
3578
|
-
});
|
|
3579
|
-
locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
|
|
3580
3779
|
|
|
3581
|
-
if ('userResponded' in initialState) {
|
|
3582
|
-
dispatch(setHasResponded(initialState.userResponded));
|
|
3583
|
-
}
|
|
3584
|
-
}
|
|
3585
|
-
} catch (error) {
|
|
3586
|
-
dispatch(set(error));
|
|
3587
|
-
}
|
|
3588
3780
|
|
|
3589
|
-
await dispatch(setLocale(locale));
|
|
3590
|
-
} catch (error) {
|
|
3591
|
-
dispatch(set(error));
|
|
3592
|
-
}
|
|
3593
|
-
});
|
|
3594
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
|
|
3595
3781
|
|
|
3782
|
+
const hooks_useVisibility = () => {
|
|
3783
|
+
const dispatch = useStoreDispatch();
|
|
3784
|
+
const visible = useSelector(Selectors.selectVisibility);
|
|
3785
|
+
const isVisible = visible ? visible !== visibilityStates.hidden : false;
|
|
3786
|
+
const {
|
|
3787
|
+
layoutMode
|
|
3788
|
+
} = useConfig();
|
|
3789
|
+
const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
|
|
3790
|
+
const setVisibility = useCallback(visibility => dispatch(Actions.setVisibility(visibility)), [dispatch]);
|
|
3791
|
+
return {
|
|
3792
|
+
isVisible,
|
|
3793
|
+
isOpen,
|
|
3794
|
+
visible,
|
|
3795
|
+
setVisibility
|
|
3796
|
+
};
|
|
3797
|
+
};
|
|
3798
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/reducer.js
|
|
3799
|
+
function visibility_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; }
|
|
3596
3800
|
|
|
3597
|
-
|
|
3801
|
+
function visibility_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { visibility_reducer_ownKeys(Object(source), true).forEach(function (key) { visibility_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { visibility_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
3598
3802
|
|
|
3599
|
-
|
|
3803
|
+
function visibility_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; }
|
|
3600
3804
|
|
|
3601
3805
|
|
|
3602
|
-
function hooks_useUserHasResponded() {
|
|
3603
|
-
return useSelector(Selectors.selectUserHasResponded);
|
|
3604
|
-
}
|
|
3605
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/reducer.js
|
|
3606
|
-
function app_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3607
3806
|
|
|
3608
|
-
function app_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { app_reducer_ownKeys(Object(source), true).forEach(function (key) { app_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { app_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
3609
3807
|
|
|
3610
|
-
|
|
3808
|
+
const visibility_reducer_initialState = {
|
|
3809
|
+
visibility: constants_visibilityStates.initialize
|
|
3810
|
+
};
|
|
3811
|
+
/* harmony default export */ const visibility_reducer = (visibility_utils_createReducer({
|
|
3812
|
+
[setFromStorage]: (state, {
|
|
3813
|
+
visibility
|
|
3814
|
+
}) => visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
|
|
3815
|
+
visibility
|
|
3816
|
+
}),
|
|
3817
|
+
[setVisibility.fulfilled]: (state, {
|
|
3818
|
+
payload: visibility
|
|
3819
|
+
}) => visibility ? visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
|
|
3820
|
+
visibility
|
|
3821
|
+
}) : state
|
|
3822
|
+
}, visibility_reducer_initialState));
|
|
3823
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/index.js
|
|
3611
3824
|
|
|
3612
3825
|
|
|
3613
3826
|
|
|
3614
|
-
const app_reducer_initialState = {
|
|
3615
|
-
userHasResponded: false
|
|
3616
|
-
};
|
|
3617
|
-
/* harmony default export */ const app_reducer = (app_utils_createReducer({
|
|
3618
|
-
[setHasResponded]: (state, {
|
|
3619
|
-
hasResponded
|
|
3620
|
-
}) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
|
|
3621
|
-
userHasResponded: hasResponded
|
|
3622
|
-
})
|
|
3623
|
-
}, app_reducer_initialState));
|
|
3624
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
|
|
3625
3827
|
|
|
3626
3828
|
|
|
3627
3829
|
|
|
@@ -3648,15 +3850,10 @@ function use_seamly_commands_defineProperty(obj, key, value) { if (key in obj) {
|
|
|
3648
3850
|
|
|
3649
3851
|
const {
|
|
3650
3852
|
ADD_EVENT: use_seamly_commands_ADD_EVENT,
|
|
3651
|
-
CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
|
|
3652
3853
|
SET_IS_LOADING: use_seamly_commands_SET_IS_LOADING,
|
|
3653
|
-
CLEAR_PARTICIPANTS: use_seamly_commands_CLEAR_PARTICIPANTS,
|
|
3654
3854
|
SET_HEADER_SUB_TITLE: use_seamly_commands_SET_HEADER_SUB_TITLE,
|
|
3655
3855
|
SET_INITIAL_STATE: use_seamly_commands_SET_INITIAL_STATE,
|
|
3656
|
-
|
|
3657
|
-
SET_FEATURES: use_seamly_commands_SET_FEATURES,
|
|
3658
|
-
RESET_UPLOAD_STATE: use_seamly_commands_RESET_UPLOAD_STATE,
|
|
3659
|
-
RESET_ENTRY_STATE: use_seamly_commands_RESET_ENTRY_STATE
|
|
3856
|
+
SET_FEATURES: use_seamly_commands_SET_FEATURES
|
|
3660
3857
|
} = seamly_utils_seamlyActions;
|
|
3661
3858
|
|
|
3662
3859
|
const use_seamly_commands_useSeamlyCommands = () => {
|
|
@@ -3668,7 +3865,7 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3668
3865
|
const hasConversation = useSeamlyHasConversation();
|
|
3669
3866
|
const {
|
|
3670
3867
|
visible: visibility
|
|
3671
|
-
} =
|
|
3868
|
+
} = useVisibility();
|
|
3672
3869
|
const unreadMessageCount = useSeamlyUnreadCount();
|
|
3673
3870
|
const emitEvent = useCallback((...args) => {
|
|
3674
3871
|
eventBus.emit(...args);
|
|
@@ -3690,26 +3887,12 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3690
3887
|
});
|
|
3691
3888
|
}, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
|
|
3692
3889
|
const reset = useCallback(async () => {
|
|
3890
|
+
dispatch(AppActions.reset());
|
|
3693
3891
|
dispatch(InterruptActions.clear());
|
|
3694
|
-
dispatch({
|
|
3695
|
-
type: use_seamly_commands_CLEAR_EVENTS
|
|
3696
|
-
});
|
|
3697
3892
|
dispatch({
|
|
3698
3893
|
type: use_seamly_commands_SET_IS_LOADING,
|
|
3699
3894
|
isLoading: true
|
|
3700
3895
|
});
|
|
3701
|
-
dispatch({
|
|
3702
|
-
type: use_seamly_commands_CLEAR_PARTICIPANTS
|
|
3703
|
-
});
|
|
3704
|
-
dispatch({
|
|
3705
|
-
type: use_seamly_commands_RESET_UPLOAD_STATE
|
|
3706
|
-
});
|
|
3707
|
-
dispatch({
|
|
3708
|
-
type: use_seamly_commands_RESET_ENTRY_STATE
|
|
3709
|
-
});
|
|
3710
|
-
dispatch({
|
|
3711
|
-
type: use_seamly_commands_CLEAR_FEATURES
|
|
3712
|
-
});
|
|
3713
3896
|
const {
|
|
3714
3897
|
agentName
|
|
3715
3898
|
} = appConfig.defaults || {};
|
|
@@ -3761,21 +3944,13 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3761
3944
|
|
|
3762
3945
|
const message = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, getTextMessageBase(body)), config);
|
|
3763
3946
|
|
|
3764
|
-
const sanitizedText = sanitizeText(body);
|
|
3765
|
-
|
|
3766
|
-
const sanitizedMessage = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, message), {}, {
|
|
3767
|
-
body: {
|
|
3768
|
-
text: sanitizedText
|
|
3769
|
-
}
|
|
3770
|
-
});
|
|
3771
|
-
|
|
3772
3947
|
api.send('message', message);
|
|
3773
3948
|
emitEvent('message', message);
|
|
3774
3949
|
dispatch({
|
|
3775
3950
|
type: use_seamly_commands_ADD_EVENT,
|
|
3776
3951
|
event: {
|
|
3777
3952
|
type: 'message',
|
|
3778
|
-
payload:
|
|
3953
|
+
payload: message
|
|
3779
3954
|
}
|
|
3780
3955
|
});
|
|
3781
3956
|
}, [api, dispatch, emitEvent, getTextMessageBase]);
|
|
@@ -4058,121 +4233,6 @@ const useSeamlyEntry = () => {
|
|
|
4058
4233
|
setBlockAutoEntrySwitch
|
|
4059
4234
|
};
|
|
4060
4235
|
};
|
|
4061
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-stored-visibility.js
|
|
4062
|
-
function use_seamly_stored_visibility_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; }
|
|
4063
|
-
|
|
4064
|
-
function use_seamly_stored_visibility_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { use_seamly_stored_visibility_ownKeys(Object(source), true).forEach(function (key) { use_seamly_stored_visibility_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { use_seamly_stored_visibility_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4065
|
-
|
|
4066
|
-
function use_seamly_stored_visibility_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; }
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
const use_seamly_stored_visibility_useSeamlyStoredVisibility = () => {
|
|
4073
|
-
const {
|
|
4074
|
-
layoutMode
|
|
4075
|
-
} = useConfig();
|
|
4076
|
-
const key = 'visibility';
|
|
4077
|
-
const {
|
|
4078
|
-
get,
|
|
4079
|
-
set
|
|
4080
|
-
} = useSeamlyObjectStore();
|
|
4081
|
-
let storedVisibilityObj = {};
|
|
4082
|
-
const savedVisibility = get ? get(key) : {};
|
|
4083
|
-
|
|
4084
|
-
if (savedVisibility) {
|
|
4085
|
-
storedVisibilityObj = savedVisibility;
|
|
4086
|
-
}
|
|
4087
|
-
|
|
4088
|
-
const setStoredVisibility = useCallback(state => {
|
|
4089
|
-
const saved = get ? get(key) : {};
|
|
4090
|
-
set(key, use_seamly_stored_visibility_objectSpread(use_seamly_stored_visibility_objectSpread({}, saved), {}, {
|
|
4091
|
-
[layoutMode]: state
|
|
4092
|
-
}));
|
|
4093
|
-
}, [set, get, layoutMode]);
|
|
4094
|
-
return [layoutMode ? storedVisibilityObj[layoutMode] : null, set && layoutMode ? setStoredVisibility : null];
|
|
4095
|
-
};
|
|
4096
|
-
|
|
4097
|
-
/* harmony default export */ const use_seamly_stored_visibility = ((/* unused pure expression or super */ null && (use_seamly_stored_visibility_useSeamlyStoredVisibility)));
|
|
4098
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-visibility.js
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
const {
|
|
4109
|
-
SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
|
|
4110
|
-
} = seamly_utils_seamlyActions;
|
|
4111
|
-
|
|
4112
|
-
const use_seamly_visibility_useSeamlyVisibility = () => {
|
|
4113
|
-
const config = useConfig();
|
|
4114
|
-
const {
|
|
4115
|
-
layoutMode,
|
|
4116
|
-
visibilityCallback
|
|
4117
|
-
} = config;
|
|
4118
|
-
const {
|
|
4119
|
-
visible
|
|
4120
|
-
} = useSeamlyStateContext();
|
|
4121
|
-
const {
|
|
4122
|
-
emitEvent
|
|
4123
|
-
} = useSeamlyCommands();
|
|
4124
|
-
const dispatch = useSeamlyDispatchContext();
|
|
4125
|
-
const [storedVisibility, setStoredVisibility] = useSeamlyStoredVisibility();
|
|
4126
|
-
const hasResponded = useUserHasResponded();
|
|
4127
|
-
const hasConversation = useSeamlyHasConversation();
|
|
4128
|
-
const unreadMessageCount = useSeamlyUnreadCount();
|
|
4129
|
-
const isVisible = visible ? visible !== visibilityStates.hidden : false;
|
|
4130
|
-
const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
|
|
4131
|
-
const setVisibility = useCallback(visibility => {
|
|
4132
|
-
const visibilityFn = visibilityCallback || calculateVisibility;
|
|
4133
|
-
const requestedVisibility = visibilityFn({
|
|
4134
|
-
hasConversation,
|
|
4135
|
-
hasResponded,
|
|
4136
|
-
previousVisibility: storedVisibility || null,
|
|
4137
|
-
requestedVisibility: visibility,
|
|
4138
|
-
config
|
|
4139
|
-
});
|
|
4140
|
-
|
|
4141
|
-
if (![visibilityStates.open, visibilityStates.minimized, visibilityStates.hidden].includes(requestedVisibility)) {
|
|
4142
|
-
console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
|
|
4143
|
-
return;
|
|
4144
|
-
}
|
|
4145
|
-
|
|
4146
|
-
if (requestedVisibility !== visible) {
|
|
4147
|
-
if (setStoredVisibility) {
|
|
4148
|
-
setStoredVisibility(requestedVisibility);
|
|
4149
|
-
} // Don't broadcast the init visibility state
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
if (visibility) {
|
|
4153
|
-
emitEvent('ui.visible', requestedVisibility, {
|
|
4154
|
-
visibility: requestedVisibility,
|
|
4155
|
-
hasConversation,
|
|
4156
|
-
hasResponded,
|
|
4157
|
-
unreadMessageCount
|
|
4158
|
-
});
|
|
4159
|
-
}
|
|
4160
|
-
|
|
4161
|
-
dispatch({
|
|
4162
|
-
type: use_seamly_visibility_SET_VISIBILITY,
|
|
4163
|
-
visible: requestedVisibility
|
|
4164
|
-
});
|
|
4165
|
-
}
|
|
4166
|
-
}, [visible, emitEvent, dispatch, hasConversation, hasResponded, storedVisibility, visibilityCallback, config, setStoredVisibility, unreadMessageCount]);
|
|
4167
|
-
return {
|
|
4168
|
-
isVisible,
|
|
4169
|
-
isOpen,
|
|
4170
|
-
visible,
|
|
4171
|
-
setVisibility
|
|
4172
|
-
};
|
|
4173
|
-
};
|
|
4174
|
-
|
|
4175
|
-
/* harmony default export */ const use_seamly_visibility = ((/* unused pure expression or super */ null && (use_seamly_visibility_useSeamlyVisibility)));
|
|
4176
4236
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
|
|
4177
4237
|
|
|
4178
4238
|
|
|
@@ -4194,9 +4254,8 @@ const useSeamlyChat = () => {
|
|
|
4194
4254
|
const {
|
|
4195
4255
|
isOpen,
|
|
4196
4256
|
isVisible,
|
|
4197
|
-
visible,
|
|
4198
4257
|
setVisibility
|
|
4199
|
-
} =
|
|
4258
|
+
} = useVisibility();
|
|
4200
4259
|
const dispatch = useSeamlyDispatchContext();
|
|
4201
4260
|
const events = useEvents();
|
|
4202
4261
|
const spinnerTimeout = useRef(null);
|
|
@@ -4240,7 +4299,6 @@ const useSeamlyChat = () => {
|
|
|
4240
4299
|
prevIsOpen.current = isOpen;
|
|
4241
4300
|
prevIsVisible.current = isVisible;
|
|
4242
4301
|
}, [isOpen, isVisible, sendAssertive, t]);
|
|
4243
|
-
useEffect(() => {}, [visible, sendAssertive]);
|
|
4244
4302
|
useEffect(() => {
|
|
4245
4303
|
// This delays the start of the loading inidicator we set when we initialise
|
|
4246
4304
|
// the application. This is done to only avoid BSOD on initial load if DCX is slow.
|
|
@@ -4338,7 +4396,7 @@ const useSeamlyIdleDetachCountdown = () => {
|
|
|
4338
4396
|
} = useSeamlyStateContext();
|
|
4339
4397
|
const {
|
|
4340
4398
|
isOpen: isSeamlyOpen
|
|
4341
|
-
} =
|
|
4399
|
+
} = useVisibility();
|
|
4342
4400
|
const stableState = useRef({});
|
|
4343
4401
|
stableState.current = {
|
|
4344
4402
|
hasCountdown: idleDetachCountdown.hasCountdown,
|
|
@@ -4537,8 +4595,6 @@ const useSeamlyResumeConversationPrompt = () => {
|
|
|
4537
4595
|
|
|
4538
4596
|
|
|
4539
4597
|
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
4598
|
// This hook isn't used within the core
|
|
4543
4599
|
// But it is used in implementations
|
|
4544
4600
|
// and imported directly from this file
|
|
@@ -5707,7 +5763,7 @@ function TranslationsChatStatus() {
|
|
|
5707
5763
|
|
|
5708
5764
|
|
|
5709
5765
|
;// CONCATENATED MODULE: ./src/javascripts/style-guide/components/static-core.js
|
|
5710
|
-
const static_core_excluded = ["translations", "interrupt", "config"];
|
|
5766
|
+
const static_core_excluded = ["translations", "interrupt", "config", "visibility"];
|
|
5711
5767
|
|
|
5712
5768
|
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; }
|
|
5713
5769
|
|
|
@@ -5723,6 +5779,8 @@ function static_core_objectWithoutPropertiesLoose(source, excluded) { if (source
|
|
|
5723
5779
|
|
|
5724
5780
|
|
|
5725
5781
|
|
|
5782
|
+
|
|
5783
|
+
|
|
5726
5784
|
const bareApi = {
|
|
5727
5785
|
send: () => {},
|
|
5728
5786
|
reset: () => {
|
|
@@ -5731,7 +5789,8 @@ const bareApi = {
|
|
|
5731
5789
|
store: {
|
|
5732
5790
|
get: () => {},
|
|
5733
5791
|
set: () => {}
|
|
5734
|
-
}
|
|
5792
|
+
},
|
|
5793
|
+
hasConversation: () => false
|
|
5735
5794
|
};
|
|
5736
5795
|
|
|
5737
5796
|
const SeamlyTestCore = ({
|
|
@@ -5748,7 +5807,8 @@ const SeamlyTestCore = ({
|
|
|
5748
5807
|
{
|
|
5749
5808
|
translations: translationsSlice,
|
|
5750
5809
|
interrupt: interruptSlice,
|
|
5751
|
-
config: configSlice
|
|
5810
|
+
config: configSlice,
|
|
5811
|
+
visibility: visibilitySlice
|
|
5752
5812
|
} = _ref,
|
|
5753
5813
|
restState = static_core_objectWithoutProperties(_ref, static_core_excluded);
|
|
5754
5814
|
|
|
@@ -5756,17 +5816,23 @@ const SeamlyTestCore = ({
|
|
|
5756
5816
|
reducers: {
|
|
5757
5817
|
state: stateReducer,
|
|
5758
5818
|
[String(app_reducer)]: app_reducer,
|
|
5759
|
-
[String(config_reducer)]: config_reducer,
|
|
5760
5819
|
[String(reducer)]: reducer,
|
|
5820
|
+
[String(forms_reducer)]: forms_reducer,
|
|
5761
5821
|
[String(translations_reducer)]: translations_reducer,
|
|
5762
5822
|
[String(i18n_reducer)]: i18n_reducer,
|
|
5763
|
-
[String(interrupt_reducer)]: interrupt_reducer
|
|
5823
|
+
[String(interrupt_reducer)]: interrupt_reducer,
|
|
5824
|
+
[String(visibility_reducer)]: visibility_reducer
|
|
5764
5825
|
},
|
|
5765
5826
|
initialState: {
|
|
5766
5827
|
state: restState,
|
|
5767
5828
|
[String(translations_reducer)]: translationsSlice,
|
|
5768
|
-
[String(interrupt_reducer)]: interruptSlice
|
|
5769
|
-
|
|
5829
|
+
[String(interrupt_reducer)]: interruptSlice,
|
|
5830
|
+
[String(visibility_reducer)]: visibilitySlice
|
|
5831
|
+
},
|
|
5832
|
+
middlewares: [es.withExtraArgument({
|
|
5833
|
+
api: bareApi,
|
|
5834
|
+
eventBus: eventBusRef.current
|
|
5835
|
+
})]
|
|
5770
5836
|
});
|
|
5771
5837
|
newStore.dispatch(initialize(configSlice || {}));
|
|
5772
5838
|
newStore.dispatch(setLocale.fulfilled('en-GB', translations));
|
|
@@ -5921,7 +5987,9 @@ const baseState = {
|
|
|
5921
5987
|
isActive: false
|
|
5922
5988
|
},
|
|
5923
5989
|
resumeConversationPrompt: false,
|
|
5924
|
-
|
|
5990
|
+
visibility: {
|
|
5991
|
+
visibility: web_ui_namespaceObject.visibilityStates.open
|
|
5992
|
+
},
|
|
5925
5993
|
serviceInfo: {
|
|
5926
5994
|
activeServiceSessionId: ''
|
|
5927
5995
|
},
|
|
@@ -6845,8 +6913,27 @@ const standardState = {
|
|
|
6845
6913
|
headingText: 'System messages',
|
|
6846
6914
|
description: ''
|
|
6847
6915
|
}, baseState), {}, {
|
|
6916
|
+
config: {
|
|
6917
|
+
overrideMessages: {
|
|
6918
|
+
timeIndicator: {
|
|
6919
|
+
enabled: true,
|
|
6920
|
+
threshold: 3600000
|
|
6921
|
+
}
|
|
6922
|
+
}
|
|
6923
|
+
},
|
|
6848
6924
|
participantInfo,
|
|
6849
|
-
events: [
|
|
6925
|
+
events: [{
|
|
6926
|
+
type: 'message',
|
|
6927
|
+
payload: states_objectSpread(states_objectSpread({}, shortTextMessage.payload), {}, {
|
|
6928
|
+
occurredAt: (Date.now() - 86400000 * 5) * 1000,
|
|
6929
|
+
id: (0,web_ui_namespaceObject.randomId)(),
|
|
6930
|
+
body: {
|
|
6931
|
+
text: 'Long ago when a dialog started',
|
|
6932
|
+
type: 'text',
|
|
6933
|
+
variables: {}
|
|
6934
|
+
}
|
|
6935
|
+
})
|
|
6936
|
+
}, participantMessage, participantMessageDefaultIcon, newTopicDivider, transcriptInfoMessage, ...[newTranslationDividerStart, newTranslationDividerStop].map(addTranslationData), infoMessage]
|
|
6850
6937
|
}),
|
|
6851
6938
|
choicePromptMessages: states_objectSpread(states_objectSpread({
|
|
6852
6939
|
category: categoryKeys.messages,
|
|
@@ -6999,34 +7086,24 @@ const standardState = {
|
|
|
6999
7086
|
}
|
|
7000
7087
|
}]
|
|
7001
7088
|
}),
|
|
7002
|
-
|
|
7003
|
-
// Important: This cannot pick up the language files so the text is hard set here.
|
|
7004
|
-
category: categoryKeys.errors,
|
|
7005
|
-
headingText: 'Disconnected interrupt',
|
|
7006
|
-
description: ''
|
|
7007
|
-
}, baseState), {}, {
|
|
7008
|
-
interrupt: {
|
|
7009
|
-
error: new web_ui_namespaceObject.SeamlyOfflineError()
|
|
7010
|
-
}
|
|
7011
|
-
}),
|
|
7012
|
-
generalErrorInterrupt: states_objectSpread(states_objectSpread({
|
|
7089
|
+
errorWithAction: states_objectSpread(states_objectSpread({
|
|
7013
7090
|
// Important: This cannot pick up the language files so the text is hard set here.
|
|
7014
7091
|
category: categoryKeys.errors,
|
|
7015
|
-
headingText: '
|
|
7092
|
+
headingText: 'Error with a user action',
|
|
7016
7093
|
description: ''
|
|
7017
7094
|
}, baseState), {}, {
|
|
7018
7095
|
interrupt: {
|
|
7019
7096
|
error: new web_ui_namespaceObject.SeamlyGeneralError()
|
|
7020
7097
|
}
|
|
7021
7098
|
}),
|
|
7022
|
-
|
|
7099
|
+
errorWithoutAction: states_objectSpread(states_objectSpread({
|
|
7023
7100
|
// Important: This cannot pick up the language files so the text is hard set here.
|
|
7024
7101
|
category: categoryKeys.errors,
|
|
7025
|
-
headingText: '
|
|
7102
|
+
headingText: 'Error without a user action',
|
|
7026
7103
|
description: ''
|
|
7027
7104
|
}, baseState), {}, {
|
|
7028
7105
|
interrupt: {
|
|
7029
|
-
error: new web_ui_namespaceObject.
|
|
7106
|
+
error: new web_ui_namespaceObject.SeamlyOfflineError()
|
|
7030
7107
|
}
|
|
7031
7108
|
}),
|
|
7032
7109
|
privacyDisclaimer: states_objectSpread(states_objectSpread({
|
|
@@ -7574,11 +7651,11 @@ const standardState = {
|
|
|
7574
7651
|
serviceInfo: {
|
|
7575
7652
|
activeServiceSessionId: '3942159e-9878-469e-9120-f44fd6be0f35'
|
|
7576
7653
|
},
|
|
7577
|
-
events: [infoMessage, shortTextMessage, states_objectSpread(states_objectSpread({}, choicePromptMessage), {}, {
|
|
7654
|
+
events: [newTranslationDividerStart, infoMessage, shortTextMessage, states_objectSpread(states_objectSpread({}, choicePromptMessage), {}, {
|
|
7578
7655
|
payload: states_objectSpread(states_objectSpread({}, choicePromptMessage.payload), {}, {
|
|
7579
7656
|
id: `${choicePromptMessage.payload.id}XXX`
|
|
7580
7657
|
})
|
|
7581
|
-
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, newTranslationDividerStart, newTranslationDividerStop, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage].map(addTranslationData),
|
|
7658
|
+
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, newTopicDivider, newTranslationDividerStart, newTranslationDividerStop, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage, newTranslationDividerStop, newTranslationDividerStart].map(addTranslationData),
|
|
7582
7659
|
translations: states_objectSpread(states_objectSpread({}, translationsSlice), {}, {
|
|
7583
7660
|
currentLocale: 'nl',
|
|
7584
7661
|
isActive: true,
|
|
@@ -7648,7 +7725,9 @@ const getStateObj = (layoutModes, customComponentEventBodies) => states_objectSp
|
|
|
7648
7725
|
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7649
7726
|
layoutMode: 'window'
|
|
7650
7727
|
}),
|
|
7651
|
-
|
|
7728
|
+
visibility: states_objectSpread(states_objectSpread({}, baseState.visibility), {}, {
|
|
7729
|
+
visibility: web_ui_namespaceObject.visibilityStates.minimized
|
|
7730
|
+
})
|
|
7652
7731
|
})
|
|
7653
7732
|
},
|
|
7654
7733
|
minimizedStarted: {
|
|
@@ -7659,7 +7738,9 @@ const getStateObj = (layoutModes, customComponentEventBodies) => states_objectSp
|
|
|
7659
7738
|
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7660
7739
|
layoutMode: 'window'
|
|
7661
7740
|
}),
|
|
7662
|
-
|
|
7741
|
+
visibility: states_objectSpread(states_objectSpread({}, baseState.visibility), {}, {
|
|
7742
|
+
visibility: web_ui_namespaceObject.visibilityStates.minimized
|
|
7743
|
+
}),
|
|
7663
7744
|
participantInfo,
|
|
7664
7745
|
headerTitles
|
|
7665
7746
|
})
|
|
@@ -7672,7 +7753,9 @@ const getStateObj = (layoutModes, customComponentEventBodies) => states_objectSp
|
|
|
7672
7753
|
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7673
7754
|
layoutMode: 'window'
|
|
7674
7755
|
}),
|
|
7675
|
-
|
|
7756
|
+
visibility: states_objectSpread(states_objectSpread({}, baseState.visibility), {}, {
|
|
7757
|
+
visibility: web_ui_namespaceObject.visibilityStates.minimized
|
|
7758
|
+
}),
|
|
7676
7759
|
participantInfo,
|
|
7677
7760
|
headerTitles,
|
|
7678
7761
|
unreadEvents: 12
|
|
@@ -7879,7 +7962,9 @@ const StyleGuideApp = ({
|
|
|
7879
7962
|
if (overlay) {
|
|
7880
7963
|
overlay.addEventListener('click', () => {
|
|
7881
7964
|
setStaticState(s => app_objectSpread(app_objectSpread({}, s), {}, {
|
|
7882
|
-
|
|
7965
|
+
visibility: app_objectSpread(app_objectSpread({}, s.visibility), {}, {
|
|
7966
|
+
visible: 'minimized'
|
|
7967
|
+
})
|
|
7883
7968
|
}));
|
|
7884
7969
|
});
|
|
7885
7970
|
}
|