@seamly/web-ui 18.3.0 → 19.0.0-beta.3
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 +349 -74
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +108 -8
- package/build/dist/lib/index.js +6103 -5988
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.LICENSE.txt +1 -1
- package/build/dist/lib/standalone.js +2414 -2226
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.LICENSE.txt +1 -1
- package/build/dist/lib/storage.js +8 -1
- package/build/dist/lib/storage.min.js +1 -1
- package/build/dist/lib/style-guide.js +1517 -785
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +27 -28
- package/src/javascripts/api/index.js +25 -40
- package/src/javascripts/api/producer.js +3 -6
- package/src/javascripts/config.js +3 -3
- package/src/javascripts/domains/app/actions.js +28 -11
- package/src/javascripts/domains/app/hooks.js +6 -0
- package/src/javascripts/domains/app/index.js +3 -0
- package/src/javascripts/domains/app/reducer.js +16 -0
- package/src/javascripts/domains/app/selectors.js +8 -0
- package/src/javascripts/domains/app/utils.js +4 -0
- package/src/javascripts/domains/config/actions.js +1 -3
- package/src/javascripts/domains/config/middleware.js +0 -4
- package/src/javascripts/domains/config/reducer.js +2 -13
- package/src/javascripts/domains/config/selectors.js +3 -3
- package/src/javascripts/domains/config/utils.js +4 -0
- package/src/javascripts/domains/forms/actions.js +1 -3
- package/src/javascripts/domains/forms/reducer.js +1 -2
- package/src/javascripts/domains/forms/selectors.js +2 -2
- package/src/javascripts/domains/forms/utils.js +5 -0
- package/src/javascripts/domains/i18n/actions.js +20 -0
- package/src/javascripts/domains/i18n/hooks.js +38 -0
- package/src/javascripts/domains/i18n/index.js +5 -84
- package/src/javascripts/domains/i18n/reducer.js +64 -0
- package/src/javascripts/domains/i18n/selectors.js +15 -0
- package/src/javascripts/domains/i18n/utils.js +4 -0
- package/src/javascripts/domains/interrupt/actions.js +1 -3
- package/src/javascripts/domains/interrupt/reducer.js +1 -2
- package/src/javascripts/domains/interrupt/selectors.js +3 -2
- package/src/javascripts/domains/interrupt/utils.js +4 -0
- package/src/javascripts/domains/redux/hooks.js +1 -0
- package/src/javascripts/domains/store/index.js +7 -1
- package/src/javascripts/domains/translations/actions.js +1 -3
- package/src/javascripts/domains/translations/components/chat-status.js +1 -1
- package/src/javascripts/domains/translations/components/options-dialog/form.js +11 -6
- package/src/javascripts/domains/translations/index.js +1 -0
- package/src/javascripts/domains/translations/middleware.js +43 -0
- package/src/javascripts/domains/translations/reducer.js +2 -9
- package/src/javascripts/domains/translations/selectors.js +2 -2
- package/src/javascripts/domains/translations/utils.js +4 -0
- package/src/javascripts/index.js +3 -0
- package/src/javascripts/lib/engine/index.js +1 -0
- package/src/javascripts/lib/mutex.js +30 -0
- package/src/javascripts/lib/redux-helpers/index.js +55 -16
- package/src/javascripts/lib/store/providers/session-storage.js +6 -1
- package/src/javascripts/style-guide/components/app.js +7 -2
- package/src/javascripts/style-guide/components/static-core.js +9 -3
- package/src/javascripts/style-guide/states.js +8 -8
- package/src/javascripts/style-guide/style-guide-engine.js +14 -11
- package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +1 -1
- package/src/javascripts/ui/components/conversation/event/upload.js +2 -2
- package/src/javascripts/ui/components/core/seamly-activity-monitor.js +2 -0
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +2 -0
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +1 -7
- package/src/javascripts/ui/components/core/seamly-new-notifications.js +5 -6
- package/src/javascripts/ui/components/core/seamly-read-state.js +6 -4
- package/src/javascripts/ui/components/entry/text-entry/hooks.js +6 -4
- package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +10 -3
- package/src/javascripts/ui/components/entry/upload/file-upload-form.js +6 -3
- package/src/javascripts/ui/components/entry/upload/index.js +8 -3
- package/src/javascripts/ui/components/faq/faq.js +2 -2
- package/src/javascripts/ui/components/layout/app-frame.js +11 -8
- package/src/javascripts/ui/components/layout/interrupt.js +6 -2
- package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +1 -1
- package/src/javascripts/ui/components/widgets/upload-progress.js +1 -1
- package/src/javascripts/ui/hooks/seamly-api-hooks.js +0 -6
- package/src/javascripts/ui/hooks/seamly-entry-hooks.js +17 -21
- package/src/javascripts/ui/hooks/seamly-hooks.js +0 -1
- package/src/javascripts/ui/hooks/use-seamly-commands.js +5 -6
- package/src/javascripts/ui/hooks/use-seamly-visibility.js +3 -5
- package/src/javascripts/ui/hooks/use-single-file-upload.js +4 -1
- package/src/javascripts/ui/utils/general-utils.js +6 -13
- package/src/stylesheets/1-settings/_config.scss +2 -1
- package/src/stylesheets/3-app/_app.scss +3 -4
- package/src/stylesheets/5-components/_faq.scss +3 -8
- package/src/stylesheets/5-components/_modal.scss +3 -3
- package/webpack/config.package.js +0 -18
- package/webpack/config.site.js +6 -0
- package/webpack/defaults.js +0 -3
- package/CHANGELOG.md +0 -573
- package/build/dist/translations/de-informal.js +0 -274
- package/build/dist/translations/de-informal.min.js +0 -1
- package/build/dist/translations/en.js +0 -274
- package/build/dist/translations/en.min.js +0 -1
- package/build/dist/translations/es-informal.js +0 -280
- package/build/dist/translations/es-informal.min.js +0 -1
- package/build/dist/translations/nl-formal.js +0 -274
- package/build/dist/translations/nl-formal.min.js +0 -1
- package/build/dist/translations/nl-informal.js +0 -274
- package/build/dist/translations/nl-informal.min.js +0 -1
- package/src/javascripts/lib/i18n.js +0 -46
- package/translations/de-informal.js +0 -235
- package/translations/en.js +0 -232
- package/translations/es-informal.js +0 -241
- package/translations/nl-formal.js +0 -228
- package/translations/nl-informal.js +0 -228
|
@@ -4,18 +4,6 @@
|
|
|
4
4
|
/******/ var __webpack_require__ = {};
|
|
5
5
|
/******/
|
|
6
6
|
/************************************************************************/
|
|
7
|
-
/******/ /* webpack/runtime/compat get default export */
|
|
8
|
-
/******/ (() => {
|
|
9
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
10
|
-
/******/ __webpack_require__.n = (module) => {
|
|
11
|
-
/******/ var getter = module && module.__esModule ?
|
|
12
|
-
/******/ () => (module['default']) :
|
|
13
|
-
/******/ () => (module);
|
|
14
|
-
/******/ __webpack_require__.d(getter, { a: getter });
|
|
15
|
-
/******/ return getter;
|
|
16
|
-
/******/ };
|
|
17
|
-
/******/ })();
|
|
18
|
-
/******/
|
|
19
7
|
/******/ /* webpack/runtime/define property getters */
|
|
20
8
|
/******/ (() => {
|
|
21
9
|
/******/ // define getter functions for harmony exports
|
|
@@ -58,9 +46,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
58
46
|
const web_ui_namespaceObject = require("@seamly/web-ui");
|
|
59
47
|
;// CONCATENATED MODULE: external "preact"
|
|
60
48
|
const external_preact_namespaceObject = require("preact");
|
|
61
|
-
;// CONCATENATED MODULE: external "@seamly/web-ui/translations/en"
|
|
62
|
-
const en_namespaceObject = require("@seamly/web-ui/translations/en");
|
|
63
|
-
var en_default = /*#__PURE__*/__webpack_require__.n(en_namespaceObject);
|
|
64
49
|
;// CONCATENATED MODULE: external "preact/hooks"
|
|
65
50
|
const hooks_namespaceObject = require("preact/hooks");
|
|
66
51
|
;// CONCATENATED MODULE: ./src/javascripts/lib/id.js
|
|
@@ -246,15 +231,14 @@ const getRelativeDate = (date, currentDate) => {
|
|
|
246
231
|
return date;
|
|
247
232
|
}
|
|
248
233
|
};
|
|
249
|
-
const flattenObject = (obj, prefix = '') => Object.keys(obj).reduce((acc, k) => {
|
|
250
|
-
const pre = prefix.length ? `${prefix}.` : '';
|
|
251
|
-
if (typeof obj[k] === 'object' && obj[k] !== null && Object.keys(obj[k]).length > 0) Object.assign(acc, flattenObject(obj[k], pre + k));else acc[pre + k] = obj[k];
|
|
252
|
-
return acc;
|
|
253
|
-
}, {});
|
|
254
234
|
const pick = (obj, keys) => keys.reduce((accum, key) => {
|
|
255
235
|
if (key in obj) accum[key] = obj[key];
|
|
256
236
|
return accum;
|
|
257
237
|
}, {});
|
|
238
|
+
const omit = (obj, keys) => Object.keys(obj).reduce((accum, key) => {
|
|
239
|
+
if (!keys.includes(key)) accum[key] = obj[key];
|
|
240
|
+
return accum;
|
|
241
|
+
}, {});
|
|
258
242
|
;// CONCATENATED MODULE: ./src/javascripts/ui/utils/seamly-utils.js
|
|
259
243
|
function seamly_utils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
260
244
|
|
|
@@ -1119,6 +1103,7 @@ function redux_helpers_objectSpread(target) { for (var i = 1; i < arguments.leng
|
|
|
1119
1103
|
|
|
1120
1104
|
function redux_helpers_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; }
|
|
1121
1105
|
|
|
1106
|
+
|
|
1122
1107
|
const SLICE_DELIMITER = '/';
|
|
1123
1108
|
const DOMAIN_DELIMITER = '//';
|
|
1124
1109
|
function prefixType(prefix, fn, delimiter = '/') {
|
|
@@ -1131,7 +1116,9 @@ function createAction(type, identityReducer = payload => ({
|
|
|
1131
1116
|
type
|
|
1132
1117
|
}, identityReducer(...params));
|
|
1133
1118
|
|
|
1134
|
-
action.toString = () => type
|
|
1119
|
+
action.toString = () => String(type);
|
|
1120
|
+
|
|
1121
|
+
action.match = obj => (obj === null || obj === void 0 ? void 0 : obj.type) === String(type);
|
|
1135
1122
|
|
|
1136
1123
|
return action;
|
|
1137
1124
|
}
|
|
@@ -1154,23 +1141,70 @@ function createActions(baseType, ...args) {
|
|
|
1154
1141
|
const create = prefixType(baseType, createAction, SLICE_DELIMITER);
|
|
1155
1142
|
return handlers.map(handler => create(...handler));
|
|
1156
1143
|
}
|
|
1157
|
-
function createThunk(type,
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1144
|
+
function createThunk(type, payloadCreator) {
|
|
1145
|
+
const [pending, fulfilled, rejected] = createActions(type, {
|
|
1146
|
+
pending: (arg, requestId) => ({
|
|
1147
|
+
meta: {
|
|
1148
|
+
arg,
|
|
1149
|
+
requestId,
|
|
1150
|
+
status: 'pending'
|
|
1151
|
+
}
|
|
1152
|
+
}),
|
|
1153
|
+
fulfilled: (arg, payload, requestId) => ({
|
|
1154
|
+
payload,
|
|
1155
|
+
meta: {
|
|
1156
|
+
arg,
|
|
1157
|
+
requestId,
|
|
1158
|
+
status: 'fulfilled'
|
|
1159
|
+
}
|
|
1160
|
+
}),
|
|
1161
|
+
rejected: (arg, error, requestId) => ({
|
|
1162
|
+
error,
|
|
1163
|
+
meta: {
|
|
1164
|
+
arg,
|
|
1165
|
+
requestId,
|
|
1166
|
+
status: 'rejected',
|
|
1167
|
+
error: String(error)
|
|
1168
|
+
}
|
|
1169
|
+
})
|
|
1170
|
+
});
|
|
1163
1171
|
|
|
1164
|
-
|
|
1172
|
+
const thunkCreator = arg => (dispatch, getState, extra) => {
|
|
1173
|
+
const requestId = id_randomId();
|
|
1165
1174
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1175
|
+
const promise = (async () => {
|
|
1176
|
+
let finalAction;
|
|
1177
|
+
|
|
1178
|
+
try {
|
|
1179
|
+
dispatch(pending(arg, requestId));
|
|
1180
|
+
const prms = payloadCreator(arg, {
|
|
1181
|
+
dispatch,
|
|
1182
|
+
getState,
|
|
1183
|
+
extra
|
|
1184
|
+
});
|
|
1185
|
+
const result = await prms;
|
|
1186
|
+
finalAction = fulfilled(arg, result, requestId);
|
|
1187
|
+
} catch (error) {
|
|
1188
|
+
finalAction = rejected(arg, error, requestId);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
dispatch(finalAction);
|
|
1192
|
+
return finalAction;
|
|
1193
|
+
})();
|
|
1194
|
+
|
|
1195
|
+
return Object.assign(promise, {
|
|
1196
|
+
type,
|
|
1197
|
+
arg,
|
|
1198
|
+
requestId
|
|
1199
|
+
});
|
|
1173
1200
|
};
|
|
1201
|
+
|
|
1202
|
+
return Object.assign(thunkCreator, {
|
|
1203
|
+
type,
|
|
1204
|
+
pending,
|
|
1205
|
+
fulfilled,
|
|
1206
|
+
rejected
|
|
1207
|
+
});
|
|
1174
1208
|
}
|
|
1175
1209
|
function createReducer(domain, handlers = {}, defaultState) {
|
|
1176
1210
|
const reducer = (state, action) => {
|
|
@@ -1187,12 +1221,44 @@ function createReducer(domain, handlers = {}, defaultState) {
|
|
|
1187
1221
|
|
|
1188
1222
|
return reducer;
|
|
1189
1223
|
}
|
|
1190
|
-
|
|
1224
|
+
function createDomain(domain) {
|
|
1225
|
+
return {
|
|
1226
|
+
createAction: prefixType(domain, createAction, DOMAIN_DELIMITER),
|
|
1227
|
+
createActions: prefixType(domain, createActions, DOMAIN_DELIMITER),
|
|
1228
|
+
createThunk: prefixType(domain, createThunk, DOMAIN_DELIMITER),
|
|
1229
|
+
createReducer: (handlers, defaultState) => createReducer(domain, handlers, defaultState),
|
|
1230
|
+
selectState: state => state[domain]
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/utils.js
|
|
1191
1234
|
|
|
1192
1235
|
const {
|
|
1193
|
-
createActions:
|
|
1236
|
+
createActions: utils_createActions,
|
|
1237
|
+
createReducer: utils_createReducer,
|
|
1238
|
+
selectState
|
|
1194
1239
|
} = createDomain('forms');
|
|
1195
|
-
|
|
1240
|
+
function utils_validate(values, schema = {}) {
|
|
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
|
|
1260
|
+
|
|
1261
|
+
const [registerForm, deregisterForm] = utils_createActions('form', {
|
|
1196
1262
|
register: (formId, persistData) => ({
|
|
1197
1263
|
formId,
|
|
1198
1264
|
persistData
|
|
@@ -1201,7 +1267,7 @@ const [registerForm, deregisterForm] = actions_createActions('form', {
|
|
|
1201
1267
|
formId
|
|
1202
1268
|
})
|
|
1203
1269
|
});
|
|
1204
|
-
const [registerControl, deregisterControl, updateControlValue, updateControlTouched] =
|
|
1270
|
+
const [registerControl, deregisterControl, updateControlValue, updateControlTouched] = utils_createActions('control', {
|
|
1205
1271
|
register: (formId, name) => ({
|
|
1206
1272
|
formId,
|
|
1207
1273
|
name
|
|
@@ -1355,121 +1421,11 @@ const arrayContentEquals = (a, b) => {
|
|
|
1355
1421
|
return a.every((value, idx) => b[idx] === value);
|
|
1356
1422
|
};
|
|
1357
1423
|
const getPropSelector = (propName, orDefault) => (_, props) => props[propName] || orDefault;
|
|
1358
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/reducer.js
|
|
1359
|
-
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; }
|
|
1360
|
-
|
|
1361
|
-
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; }
|
|
1362
|
-
|
|
1363
|
-
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; }
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
const reducer_initialState = {};
|
|
1368
|
-
const initialFormState = {
|
|
1369
|
-
controls: {}
|
|
1370
|
-
};
|
|
1371
|
-
const initialControlState = {
|
|
1372
|
-
value: '',
|
|
1373
|
-
touched: false
|
|
1374
|
-
};
|
|
1375
|
-
|
|
1376
|
-
function updateFormControl(state, formId, name, controlState) {
|
|
1377
|
-
var _state$formId;
|
|
1378
|
-
|
|
1379
|
-
const currentControlState = ((_state$formId = state[formId]) === null || _state$formId === void 0 ? void 0 : _state$formId.controls[name]) || initialControlState;
|
|
1380
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1381
|
-
[formId]: reducer_objectSpread(reducer_objectSpread({}, state[formId]), {}, {
|
|
1382
|
-
controls: reducer_objectSpread(reducer_objectSpread({}, state[formId].controls), {}, {
|
|
1383
|
-
[name]: reducer_objectSpread(reducer_objectSpread({}, currentControlState), controlState)
|
|
1384
|
-
})
|
|
1385
|
-
})
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
/* harmony default export */ const reducer = (createReducer('form', {
|
|
1390
|
-
// Form handlers
|
|
1391
|
-
[registerForm]: (state, {
|
|
1392
|
-
formId,
|
|
1393
|
-
persistData
|
|
1394
|
-
}) => {
|
|
1395
|
-
var _state$formId2;
|
|
1396
|
-
|
|
1397
|
-
const formState = persistData ? (_state$formId2 = state[formId]) !== null && _state$formId2 !== void 0 ? _state$formId2 : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1398
|
-
persistData
|
|
1399
|
-
}) : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1400
|
-
persistData
|
|
1401
|
-
});
|
|
1402
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1403
|
-
[formId]: formState
|
|
1404
|
-
});
|
|
1405
|
-
},
|
|
1406
|
-
[deregisterForm]: (state, {
|
|
1407
|
-
formId
|
|
1408
|
-
}) => {
|
|
1409
|
-
var _newState$formId;
|
|
1410
|
-
|
|
1411
|
-
const newState = reducer_objectSpread({}, state);
|
|
1412
|
-
|
|
1413
|
-
if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
|
|
1414
|
-
delete newState[formId];
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
return newState;
|
|
1418
|
-
},
|
|
1419
|
-
// Form control handlers
|
|
1420
|
-
[registerControl]: (state, {
|
|
1421
|
-
name,
|
|
1422
|
-
formId
|
|
1423
|
-
}) => {
|
|
1424
|
-
return updateFormControl(state, formId, name);
|
|
1425
|
-
},
|
|
1426
|
-
[deregisterControl]: (state, {
|
|
1427
|
-
formId,
|
|
1428
|
-
name
|
|
1429
|
-
}) => {
|
|
1430
|
-
const form = state[formId];
|
|
1431
|
-
|
|
1432
|
-
if (!form) {
|
|
1433
|
-
return state;
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
if (form.persistData) {
|
|
1437
|
-
return state;
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
const controls = reducer_objectSpread({}, form.controls);
|
|
1441
|
-
|
|
1442
|
-
delete controls[name];
|
|
1443
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1444
|
-
[formId]: reducer_objectSpread(reducer_objectSpread({}, form), {}, {
|
|
1445
|
-
controls
|
|
1446
|
-
})
|
|
1447
|
-
});
|
|
1448
|
-
},
|
|
1449
|
-
[updateControlValue]: (state, {
|
|
1450
|
-
formId,
|
|
1451
|
-
name,
|
|
1452
|
-
value
|
|
1453
|
-
}) => {
|
|
1454
|
-
return updateFormControl(state, formId, name, {
|
|
1455
|
-
value
|
|
1456
|
-
});
|
|
1457
|
-
},
|
|
1458
|
-
[updateControlTouched]: (state, {
|
|
1459
|
-
formId,
|
|
1460
|
-
name,
|
|
1461
|
-
touched
|
|
1462
|
-
}) => {
|
|
1463
|
-
return updateFormControl(state, formId, name, {
|
|
1464
|
-
touched
|
|
1465
|
-
});
|
|
1466
|
-
}
|
|
1467
|
-
}, reducer_initialState));
|
|
1468
1424
|
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/selectors.js
|
|
1469
1425
|
|
|
1470
1426
|
|
|
1471
1427
|
|
|
1472
|
-
const getState =
|
|
1428
|
+
const getState = selectState;
|
|
1473
1429
|
const selectors_getFormById = createSelector(getState, getPropSelector('formId'), (forms, formId) => forms[formId]);
|
|
1474
1430
|
const getFormControlsByFormId = createSelector(selectors_getFormById, form => (form === null || form === void 0 ? void 0 : form.controls) || {});
|
|
1475
1431
|
const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId, controls => {
|
|
@@ -1531,6 +1487,7 @@ function hooks_useSelector(selector, deps = []) {
|
|
|
1531
1487
|
const valueRef = useRef(); // instead of accepting a stabilized selector, we stick to the signature
|
|
1532
1488
|
// of useCallback, as that makes the exposed api much more dev-friendly
|
|
1533
1489
|
// otherwise you'd have to stabilize selectors externally
|
|
1490
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1534
1491
|
|
|
1535
1492
|
const selectorCb = useCallback(selector, deps); // we're keeping the selector in a ref to compare against
|
|
1536
1493
|
// we need this both in the store subscription and for
|
|
@@ -1780,119 +1737,149 @@ function provider_FormProvider(_ref) {
|
|
|
1780
1737
|
children: children
|
|
1781
1738
|
}));
|
|
1782
1739
|
}
|
|
1783
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
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; }
|
|
1791
1742
|
|
|
1792
|
-
|
|
1793
|
-
createActions: translations_actions_createActions
|
|
1794
|
-
} = createDomain('translations');
|
|
1795
|
-
const [enable, disable] = translations_actions_createActions('translate', {
|
|
1796
|
-
enable: locale => ({
|
|
1797
|
-
locale
|
|
1798
|
-
}),
|
|
1799
|
-
disable: () => ({})
|
|
1800
|
-
});
|
|
1801
|
-
const [enableEvent, disableEvent] = translations_actions_createActions('event', {
|
|
1802
|
-
enable: payloadId => ({
|
|
1803
|
-
payloadId
|
|
1804
|
-
}),
|
|
1805
|
-
disable: payloadId => ({
|
|
1806
|
-
payloadId
|
|
1807
|
-
})
|
|
1808
|
-
});
|
|
1809
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/reducer.js
|
|
1810
|
-
function translations_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
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; }
|
|
1811
1744
|
|
|
1812
|
-
function
|
|
1745
|
+
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; }
|
|
1813
1746
|
|
|
1814
|
-
function translations_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1815
1747
|
|
|
1816
1748
|
|
|
1749
|
+
const reducer_initialState = {};
|
|
1750
|
+
const initialFormState = {
|
|
1751
|
+
controls: {}
|
|
1752
|
+
};
|
|
1753
|
+
const initialControlState = {
|
|
1754
|
+
value: '',
|
|
1755
|
+
touched: false
|
|
1756
|
+
};
|
|
1817
1757
|
|
|
1758
|
+
function updateFormControl(state, formId, name, controlState) {
|
|
1759
|
+
var _state$formId;
|
|
1818
1760
|
|
|
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
|
+
}
|
|
1819
1770
|
|
|
1820
|
-
const
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1771
|
+
/* harmony default export */ const reducer = (utils_createReducer({
|
|
1772
|
+
// Form handlers
|
|
1773
|
+
[registerForm]: (state, {
|
|
1774
|
+
formId,
|
|
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;
|
|
1831
1790
|
|
|
1832
|
-
const
|
|
1791
|
+
const newState = reducer_objectSpread({}, state);
|
|
1833
1792
|
|
|
1834
|
-
if (!
|
|
1835
|
-
|
|
1793
|
+
if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
|
|
1794
|
+
delete newState[formId];
|
|
1836
1795
|
}
|
|
1837
1796
|
|
|
1838
|
-
return
|
|
1839
|
-
isAvailable: feature.enabled === true,
|
|
1840
|
-
languages: feature.languages || []
|
|
1841
|
-
});
|
|
1797
|
+
return newState;
|
|
1842
1798
|
},
|
|
1843
|
-
|
|
1844
|
-
|
|
1799
|
+
// Form control handlers
|
|
1800
|
+
[registerControl]: (state, {
|
|
1801
|
+
name,
|
|
1802
|
+
formId
|
|
1845
1803
|
}) => {
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1849
|
-
isActive: history === null || history === void 0 ? void 0 : (_history$translation = history.translation) === null || _history$translation === void 0 ? void 0 : _history$translation.enabled,
|
|
1850
|
-
currentLocale: history === null || history === void 0 ? void 0 : (_history$translation2 = history.translation) === null || _history$translation2 === void 0 ? void 0 : _history$translation2.locale
|
|
1851
|
-
});
|
|
1804
|
+
return updateFormControl(state, formId, name);
|
|
1852
1805
|
},
|
|
1853
|
-
[
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
}) => {
|
|
1857
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1858
|
-
isActive: true,
|
|
1859
|
-
currentLocale: locale
|
|
1860
|
-
});
|
|
1861
|
-
},
|
|
1862
|
-
[disable]: state => {
|
|
1863
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1864
|
-
isActive: false,
|
|
1865
|
-
currentLocale: undefined
|
|
1866
|
-
});
|
|
1867
|
-
},
|
|
1868
|
-
[enableEvent]: (state, {
|
|
1869
|
-
payloadId
|
|
1806
|
+
[deregisterControl]: (state, {
|
|
1807
|
+
formId,
|
|
1808
|
+
name
|
|
1870
1809
|
}) => {
|
|
1871
|
-
|
|
1810
|
+
const form = state[formId];
|
|
1811
|
+
|
|
1812
|
+
if (!form) {
|
|
1872
1813
|
return state;
|
|
1873
1814
|
}
|
|
1874
1815
|
|
|
1875
|
-
|
|
1876
|
-
originalPayloadIds: state.originalPayloadIds.filter(id => id !== payloadId)
|
|
1877
|
-
});
|
|
1878
|
-
},
|
|
1879
|
-
[disableEvent]: (state, {
|
|
1880
|
-
payloadId
|
|
1881
|
-
}) => {
|
|
1882
|
-
if (state.originalPayloadIds.includes(payloadId)) {
|
|
1816
|
+
if (form.persistData) {
|
|
1883
1817
|
return state;
|
|
1884
1818
|
}
|
|
1885
1819
|
|
|
1886
|
-
|
|
1887
|
-
|
|
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
|
|
1888
1845
|
});
|
|
1889
1846
|
}
|
|
1890
|
-
},
|
|
1847
|
+
}, reducer_initialState));
|
|
1848
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/index.js
|
|
1849
|
+
|
|
1850
|
+
|
|
1851
|
+
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
|
|
1855
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
1856
|
+
|
|
1857
|
+
const {
|
|
1858
|
+
createActions: translations_utils_createActions,
|
|
1859
|
+
createReducer: translations_utils_createReducer,
|
|
1860
|
+
selectState: utils_selectState
|
|
1861
|
+
} = createDomain('translations');
|
|
1862
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
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
|
+
});
|
|
1891
1878
|
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/selectors.js
|
|
1892
1879
|
|
|
1893
1880
|
|
|
1894
1881
|
|
|
1895
|
-
const selectors_getState =
|
|
1882
|
+
const selectors_getState = utils_selectState;
|
|
1896
1883
|
const getOriginalPayloadIds = createSelector(selectors_getState, state => state.originalPayloadIds);
|
|
1897
1884
|
const getIsPayloadTranslated = createSelector(getOriginalPayloadIds, getPropSelector('payloadId'), (payloadIds, payloadId) => !payloadIds.includes(payloadId));
|
|
1898
1885
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-api-context.js
|
|
@@ -1922,23 +1909,81 @@ const seamly_api_hooks_useSeamlyHasConversation = () => {
|
|
|
1922
1909
|
const url = useSeamlyConversationUrl();
|
|
1923
1910
|
return !!url;
|
|
1924
1911
|
};
|
|
1925
|
-
|
|
1926
|
-
const {
|
|
1927
|
-
get
|
|
1928
|
-
} = seamly_api_hooks_useSeamlyObjectStore();
|
|
1929
|
-
return get ? !!get('userResponded') : false;
|
|
1930
|
-
};
|
|
1931
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
|
|
1912
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/utils.js
|
|
1932
1913
|
|
|
1933
1914
|
const {
|
|
1934
|
-
createAction:
|
|
1915
|
+
createAction: utils_createAction,
|
|
1916
|
+
createThunk: utils_createThunk,
|
|
1917
|
+
createReducer: config_utils_createReducer,
|
|
1918
|
+
selectState: config_utils_selectState
|
|
1935
1919
|
} = createDomain('config');
|
|
1936
|
-
|
|
1920
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
|
|
1921
|
+
|
|
1922
|
+
const initialize = utils_createAction('initialize', config => ({
|
|
1937
1923
|
config
|
|
1938
1924
|
}));
|
|
1939
|
-
const update =
|
|
1925
|
+
const update = utils_createAction('update', config => ({
|
|
1940
1926
|
config
|
|
1941
1927
|
}));
|
|
1928
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/selectors.js
|
|
1929
|
+
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; }
|
|
1930
|
+
|
|
1931
|
+
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; }
|
|
1932
|
+
|
|
1933
|
+
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; }
|
|
1934
|
+
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
|
|
1938
|
+
const selectConfig = createSelector(config_utils_selectState, config => {
|
|
1939
|
+
let newConfig = selectors_objectSpread({
|
|
1940
|
+
visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized,
|
|
1941
|
+
appContainerClassNames: config.appContainerClassNames || []
|
|
1942
|
+
}, config);
|
|
1943
|
+
|
|
1944
|
+
if (typeof newConfig.appContainerClassNames === 'function') {
|
|
1945
|
+
newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
|
|
1946
|
+
appContainerClassNames: newConfig.appContainerClassNames(newConfig)
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
return newConfig;
|
|
1951
|
+
});
|
|
1952
|
+
|
|
1953
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
|
|
1954
|
+
|
|
1955
|
+
|
|
1956
|
+
function hooks_useConfig() {
|
|
1957
|
+
return useSelector(Selectors.selectConfig);
|
|
1958
|
+
}
|
|
1959
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
|
|
1960
|
+
|
|
1961
|
+
|
|
1962
|
+
function createMiddleware() {
|
|
1963
|
+
return ({
|
|
1964
|
+
dispatch
|
|
1965
|
+
}) => next => action => {
|
|
1966
|
+
var _action$config, _action$config$defaul;
|
|
1967
|
+
|
|
1968
|
+
const result = next(action);
|
|
1969
|
+
|
|
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
|
+
|
|
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
|
+
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
return result;
|
|
1985
|
+
};
|
|
1986
|
+
}
|
|
1942
1987
|
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
1943
1988
|
const CSS_NAME = 'cvco';
|
|
1944
1989
|
const apiVersion = '2';
|
|
@@ -1951,7 +1996,9 @@ const config_screenReaderDebounceDelaySeconds = 10;
|
|
|
1951
1996
|
const activitySendDelay = 15000;
|
|
1952
1997
|
const maxCharacterWarningLimit = 50;
|
|
1953
1998
|
const maxCharacterSrDebounceDelay = 300;
|
|
1954
|
-
const config_defaultTransitionTimeMs = 300;
|
|
1999
|
+
const config_defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
|
|
2000
|
+
|
|
2001
|
+
const config_typingTimeout = 2000;
|
|
1955
2002
|
const defaultConfig = {
|
|
1956
2003
|
namespace: 'default',
|
|
1957
2004
|
layoutMode: 'window',
|
|
@@ -1973,14 +2020,10 @@ const defaultConfig = {
|
|
|
1973
2020
|
|
|
1974
2021
|
}
|
|
1975
2022
|
},
|
|
1976
|
-
typing: {
|
|
1977
|
-
timeout: 2000 // How long to wait before we decide the user isn't typing
|
|
1978
|
-
|
|
1979
|
-
},
|
|
1980
2023
|
appContainerClassNames: config => [`app--layout-${config.layoutMode}`, `namespace--${config.namespace}`]
|
|
1981
2024
|
};
|
|
1982
2025
|
;// CONCATENATED MODULE: ./src/javascripts/domains/config/reducer.js
|
|
1983
|
-
const reducer_excluded = ["messages"
|
|
2026
|
+
const reducer_excluded = ["messages"];
|
|
1984
2027
|
|
|
1985
2028
|
function reducer_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = reducer_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1986
2029
|
|
|
@@ -2005,15 +2048,14 @@ const config_reducer_initialState = config_reducer_objectSpread(config_reducer_o
|
|
|
2005
2048
|
defaults: {}
|
|
2006
2049
|
});
|
|
2007
2050
|
|
|
2008
|
-
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', '
|
|
2051
|
+
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback'];
|
|
2009
2052
|
|
|
2010
2053
|
const updateState = (state, {
|
|
2011
2054
|
config
|
|
2012
2055
|
}) => {
|
|
2013
2056
|
const _pick = pick(config, configKeys),
|
|
2014
2057
|
{
|
|
2015
|
-
messages
|
|
2016
|
-
typing
|
|
2058
|
+
messages
|
|
2017
2059
|
} = _pick,
|
|
2018
2060
|
partialConfig = reducer_objectWithoutProperties(_pick, reducer_excluded);
|
|
2019
2061
|
|
|
@@ -2029,16 +2071,10 @@ const updateState = (state, {
|
|
|
2029
2071
|
});
|
|
2030
2072
|
}
|
|
2031
2073
|
|
|
2032
|
-
if (typing) {
|
|
2033
|
-
newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), {}, {
|
|
2034
|
-
typing: config_reducer_objectSpread(config_reducer_objectSpread({}, newState.typing), typing)
|
|
2035
|
-
});
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
2074
|
return newState;
|
|
2039
2075
|
};
|
|
2040
2076
|
|
|
2041
|
-
/* harmony default export */ const config_reducer = (
|
|
2077
|
+
/* harmony default export */ const config_reducer = (config_utils_createReducer({
|
|
2042
2078
|
[initialize]: (state, action) => {
|
|
2043
2079
|
return updateState(state, action);
|
|
2044
2080
|
},
|
|
@@ -2046,436 +2082,68 @@ const updateState = (state, {
|
|
|
2046
2082
|
return updateState(state, action);
|
|
2047
2083
|
}
|
|
2048
2084
|
}, config_reducer_initialState));
|
|
2049
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/
|
|
2050
|
-
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; }
|
|
2051
|
-
|
|
2052
|
-
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; }
|
|
2053
|
-
|
|
2054
|
-
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; }
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2085
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
2058
2086
|
|
|
2059
|
-
const selectState = state => state[String(config_reducer)];
|
|
2060
|
-
const selectConfig = createSelector(selectState, config => {
|
|
2061
|
-
let newConfig = selectors_objectSpread({
|
|
2062
|
-
visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized,
|
|
2063
|
-
appContainerClassNames: config.appContainerClassNames || []
|
|
2064
|
-
}, config);
|
|
2065
2087
|
|
|
2066
|
-
if (typeof newConfig.appContainerClassNames === 'function') {
|
|
2067
|
-
newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
|
|
2068
|
-
appContainerClassNames: newConfig.appContainerClassNames(newConfig)
|
|
2069
|
-
});
|
|
2070
|
-
}
|
|
2071
2088
|
|
|
2072
|
-
return newConfig;
|
|
2073
|
-
});
|
|
2074
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
|
|
2075
2089
|
|
|
2076
2090
|
|
|
2077
|
-
function hooks_useConfig() {
|
|
2078
|
-
return useSelector(Selectors.selectConfig);
|
|
2079
|
-
}
|
|
2080
|
-
;// CONCATENATED MODULE: ./translations/en.js
|
|
2081
|
-
// Please note: All texts containing the string 'srText' are short for
|
|
2082
|
-
// Screen Reader Text. These texts are invisible on screen but broadcast
|
|
2083
|
-
// to screen readers. Avoid undue verbosity, but ensure that a user who cannot
|
|
2084
|
-
// see the screen will get both the message content as well as the context
|
|
2085
|
-
// in which the message occurred if not already clear from the current
|
|
2086
|
-
// position of the keyboard focus.
|
|
2087
|
-
// Example: An error occurs in the chat window and this error has an 'srText'
|
|
2088
|
-
// entry. Because the error could occur while the user is NOT chatting in the window,
|
|
2089
|
-
// add context such as "Something went wrong with the chat session" as just saying
|
|
2090
|
-
// "Something went wrong" would not be clear enough for users who cannot see the
|
|
2091
|
-
// source of the error on screen.
|
|
2092
|
-
/* harmony default export */ const en = ({
|
|
2093
|
-
'carousel.controls.next': 'Next',
|
|
2094
|
-
'carousel.controls.previous': 'Previous',
|
|
2095
|
-
'carousel.slide.label': ({
|
|
2096
|
-
index,
|
|
2097
|
-
total
|
|
2098
|
-
}) => `${index} of ${total}`,
|
|
2099
|
-
'dateTime.srText': ({
|
|
2100
|
-
date,
|
|
2101
|
-
time
|
|
2102
|
-
}) => `Messages starting ${date} at ${time}:`,
|
|
2103
|
-
'dateTime.today': 'Today',
|
|
2104
|
-
'dateTime.yesterday': 'Yesterday',
|
|
2105
|
-
'disclaimer.content': 'This chat session will be saved to help us improve our service delivery.',
|
|
2106
|
-
'disclaimer.title': 'Privacy disclaimer',
|
|
2107
|
-
'dividerKeys.newTopic': 'New topic started.',
|
|
2108
|
-
'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
|
|
2109
|
-
'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
|
|
2110
|
-
'errors.configError.title': 'Chat configuration error.',
|
|
2111
|
-
'errors.general.buttonText': 'Restart chat',
|
|
2112
|
-
'errors.general.message': 'Do you want to start a new chat session?',
|
|
2113
|
-
'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
|
|
2114
|
-
'errors.general.title': 'Something went wrong',
|
|
2115
|
-
'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.',
|
|
2116
|
-
'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.',
|
|
2117
|
-
'errors.seamlyOffline.title': 'Connection issues',
|
|
2118
|
-
'faq.headingText': 'Suggested topics',
|
|
2119
|
-
'faq.srAvailableText': 'Suggested topics are available in the chat.',
|
|
2120
|
-
'faq.srUnavailableText': 'Suggested topics are no longer available in the chat.',
|
|
2121
|
-
'faq.srUpdatedText': 'There are new suggested topics in the chat.',
|
|
2122
|
-
'fileUpload.cancelButtonText': 'Cancel upload',
|
|
2123
|
-
'fileUpload.contentHint': size => `Select a file of maximum ${size}`,
|
|
2124
|
-
'fileUpload.errors.general': 'Something went wrong with the upload. Please cancel the upload and try again.',
|
|
2125
|
-
'fileUpload.errors.noFile': 'Please select a file to upload',
|
|
2126
|
-
'fileUpload.errors.tooLarge': 'The selected file is too large, please upload a smaller file',
|
|
2127
|
-
'fileUpload.errors.unavailable': 'Uploading files is no longer possible. Please cancel the upload and try again later.',
|
|
2128
|
-
'fileUpload.errors.virusFound': 'The selected file is unsafe, please upload a different file.',
|
|
2129
|
-
'fileUpload.errors.wrongType': 'The selected file type is not supported. Please cancel the upload and upload a different file.',
|
|
2130
|
-
'fileUpload.fileUnavailableText': 'This download link has expired',
|
|
2131
|
-
'fileUpload.labelText': 'Select file',
|
|
2132
|
-
'fileUpload.selectedText': fileName => {
|
|
2133
|
-
if (fileName) {
|
|
2134
|
-
return fileName;
|
|
2135
|
-
} else {
|
|
2136
|
-
return 'No file selected';
|
|
2137
|
-
}
|
|
2138
|
-
},
|
|
2139
|
-
'fileUpload.srAvailableText': 'File uploads are now available in the chat.',
|
|
2140
|
-
'fileUpload.srCompleteText': 'Upload complete.',
|
|
2141
|
-
'fileUpload.srFileDownloadText': fileName => `Download file ${fileName}.`,
|
|
2142
|
-
'fileUpload.srFileUploadedText': fileName => `Uploaded file ${fileName}.`,
|
|
2143
|
-
'fileUpload.srProgressLabel': fileName => `${fileName} upload progress status`,
|
|
2144
|
-
'fileUpload.srStartedText': 'Upload started.',
|
|
2145
|
-
'fileUpload.srUnavailableText': 'File uploads in the chat are no longer available.',
|
|
2146
|
-
'fileUpload.toggleButtonText': 'Upload files',
|
|
2147
|
-
'fileUpload.uploadButtonText': 'Upload file',
|
|
2148
|
-
'header.collapseApp': 'collapse chat',
|
|
2149
|
-
'header.title': 'You\'re talking to',
|
|
2150
|
-
'idleDetachWarning.continueButton': 'Continue conversation',
|
|
2151
|
-
'idleDetachWarning.countdownText': 'Your conversation will automatically end in:',
|
|
2152
|
-
'idleDetachWarning.countdownTimer': ({
|
|
2153
|
-
minutes,
|
|
2154
|
-
seconds
|
|
2155
|
-
}) => {
|
|
2156
|
-
switch (minutes) {
|
|
2157
|
-
case 1:
|
|
2158
|
-
switch (seconds) {
|
|
2159
|
-
case 1:
|
|
2160
|
-
return '1 minute, 1 second';
|
|
2161
2091
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2092
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
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; }
|
|
2164
2094
|
|
|
2165
|
-
|
|
2166
|
-
return `1 minute, ${seconds} seconds`;
|
|
2167
|
-
}
|
|
2095
|
+
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; }
|
|
2168
2096
|
|
|
2169
|
-
|
|
2170
|
-
switch (seconds) {
|
|
2171
|
-
case 1:
|
|
2172
|
-
return '1 second';
|
|
2097
|
+
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; }
|
|
2173
2098
|
|
|
2174
|
-
case 0:
|
|
2175
|
-
default:
|
|
2176
|
-
return `${seconds} seconds`;
|
|
2177
|
-
}
|
|
2178
2099
|
|
|
2179
|
-
default:
|
|
2180
|
-
switch (seconds) {
|
|
2181
|
-
case 1:
|
|
2182
|
-
return `${minutes} minutes, 1 second`;
|
|
2183
2100
|
|
|
2184
|
-
case 0:
|
|
2185
|
-
return `${minutes} minutes`;
|
|
2186
2101
|
|
|
2187
|
-
default:
|
|
2188
|
-
return `${minutes} minutes, ${seconds} seconds`;
|
|
2189
|
-
}
|
|
2190
2102
|
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
'info.cobrowsing.cobrowsingEnded': 'Screen sharing has ended',
|
|
2198
|
-
'info.cobrowsing.cobrowsingStarted': 'Screen sharing is now enabled. The agent can see the page you\'re currently on',
|
|
2199
|
-
'info.sendTranscript.accepted': ({
|
|
2200
|
-
emailAddress
|
|
2201
|
-
}) => `A transcript will be sent to ${emailAddress}`,
|
|
2202
|
-
'input.inputLabel': limit => {
|
|
2203
|
-
if (limit) {
|
|
2204
|
-
return `Your message (max. ${limit} characters)`;
|
|
2205
|
-
}
|
|
2103
|
+
const seamly_state_hooks_selectState = state => state.state;
|
|
2104
|
+
const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
|
|
2105
|
+
const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
|
|
2106
|
+
events
|
|
2107
|
+
}, config) => {
|
|
2108
|
+
var _config$messages;
|
|
2206
2109
|
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
return `Your message (max. ${limit} characters)`;
|
|
2212
|
-
}
|
|
2110
|
+
const {
|
|
2111
|
+
enabled,
|
|
2112
|
+
threshold
|
|
2113
|
+
} = (config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) ?? {};
|
|
2213
2114
|
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
'input.srCharacterLimitText': limit => {
|
|
2218
|
-
switch (limit) {
|
|
2219
|
-
case 1:
|
|
2220
|
-
return '1 character remaining.';
|
|
2221
|
-
|
|
2222
|
-
case 0:
|
|
2223
|
-
default:
|
|
2224
|
-
return `${limit} characters remaining.`;
|
|
2225
|
-
}
|
|
2226
|
-
},
|
|
2227
|
-
'lightbox.closeLabel': 'Close',
|
|
2228
|
-
'lightbox.heading': 'Enlarged chat image',
|
|
2229
|
-
'message.choicePrompts.cancelChooseAgain': 'Cancel choice change',
|
|
2230
|
-
'message.choicePrompts.chooseAgain': 'Change your choice',
|
|
2231
|
-
'message.image.srTextEnlargeButtonLabel': ({
|
|
2232
|
-
description
|
|
2233
|
-
}) => `Enlarge ${description}`,
|
|
2234
|
-
'message.srNewEventCount': ({
|
|
2235
|
-
newCount
|
|
2236
|
-
}) => {
|
|
2237
|
-
switch (newCount) {
|
|
2238
|
-
case 1:
|
|
2239
|
-
return `There is 1 new chat message.`;
|
|
2115
|
+
if (!enabled) {
|
|
2116
|
+
return events;
|
|
2117
|
+
}
|
|
2240
2118
|
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2119
|
+
const mappedEvents = [];
|
|
2120
|
+
let previousEvent = null;
|
|
2121
|
+
events.forEach((event, idx) => {
|
|
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
|
+
}));
|
|
2244
2132
|
}
|
|
2245
|
-
},
|
|
2246
|
-
'message.srTextUnreadCount': ({
|
|
2247
|
-
unreadCount
|
|
2248
|
-
}) => {
|
|
2249
|
-
switch (unreadCount) {
|
|
2250
|
-
case 1:
|
|
2251
|
-
return `There is 1 new unread chat message.`;
|
|
2252
2133
|
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
}
|
|
2257
|
-
},
|
|
2258
|
-
'options.cancelButtonText': 'Cancel',
|
|
2259
|
-
'options.cobrowsing.cobrowsingActiveText': 'Sharing screen',
|
|
2260
|
-
'options.cobrowsing.cobrowsingUnavailable': 'Screen sharing is currently unavailable.',
|
|
2261
|
-
'options.cobrowsing.description': 'This allows the agent to see the page you\'re currently on. Nothing else is shared.',
|
|
2262
|
-
'options.cobrowsing.labelTurnOff': 'Turn screen sharing off',
|
|
2263
|
-
'options.cobrowsing.labelTurnOn': 'Turn screen sharing on',
|
|
2264
|
-
'options.cobrowsing.menuTitle': 'Screen sharing',
|
|
2265
|
-
'options.cobrowsing.srCobrowsingAvailable': 'Screen sharing is now available.',
|
|
2266
|
-
'options.cobrowsing.srStartedCobrowsingText': 'Screen sharing has been started.',
|
|
2267
|
-
'options.cobrowsing.srStopCobrowsingText': 'Stop screen sharing',
|
|
2268
|
-
'options.cobrowsing.srStoppedCobrowsingText': 'Screen sharing has been stopped.',
|
|
2269
|
-
'options.cobrowsing.stopCobrowsingText': 'Stop',
|
|
2270
|
-
'options.cobrowsing.title': 'Share my screen',
|
|
2271
|
-
'options.openButtonText': 'Options',
|
|
2272
|
-
'options.saveButtonText': 'Save',
|
|
2273
|
-
'options.sendTranscript.description': 'Enter the email address you would like to send the chat transcript to.',
|
|
2274
|
-
'options.sendTranscript.invalidEmailText': 'Please enter a valid email address',
|
|
2275
|
-
'options.sendTranscript.label': 'Email address',
|
|
2276
|
-
'options.sendTranscript.menuTitle': 'Send transcript',
|
|
2277
|
-
'options.sendTranscript.noEmailText': 'Please enter an email address',
|
|
2278
|
-
'options.sendTranscript.sendButtonText': 'Send',
|
|
2279
|
-
'options.sendTranscript.title': 'Send chat transcript',
|
|
2280
|
-
'options.unavailableText': 'unavailable',
|
|
2281
|
-
'resumeConversationPrompt.continueButton': 'Resume conversation',
|
|
2282
|
-
'resumeConversationPrompt.detachButton': 'Ask new question',
|
|
2283
|
-
'resumeConversationPrompt.title': name => `Would you like to continue the conversation with ${name}?`,
|
|
2284
|
-
skiplinkText: 'Skip to chat input',
|
|
2285
|
-
'toggleButton.resumeTitle': 'Resume chat with',
|
|
2286
|
-
'toggleButton.subtitle': 'Start a chat with us',
|
|
2287
|
-
'toggleButton.title': 'Have a question?',
|
|
2288
|
-
'translations.divider.restartButtonText': 'Start again',
|
|
2289
|
-
'translations.divider.startText': language => `Translating to ${language}`,
|
|
2290
|
-
'translations.divider.stopText': language => `Translating to ${language} ended`,
|
|
2291
|
-
'translations.settings.cancelButtonText': 'Cancel',
|
|
2292
|
-
'translations.settings.currentTranslationLabel': 'Currently translating to',
|
|
2293
|
-
'translations.settings.defaultOptionLabel': 'Choose language',
|
|
2294
|
-
'translations.settings.description': 'Automatic translations might contain errors.',
|
|
2295
|
-
'translations.settings.endButtonText': 'Stop translating',
|
|
2296
|
-
'translations.settings.inputLabel': 'Translate chat to',
|
|
2297
|
-
'translations.settings.noLocaleText': 'Choose a language to translate to',
|
|
2298
|
-
'translations.settings.openButtonText': 'Translation',
|
|
2299
|
-
'translations.settings.startButtonText': 'Start translating',
|
|
2300
|
-
'translations.settings.title': 'Translation',
|
|
2301
|
-
'translations.status.label': language => `Translating to ${language}`,
|
|
2302
|
-
'translations.status.srStopText': 'Stop translating',
|
|
2303
|
-
'translations.status.stopText': 'Stop',
|
|
2304
|
-
'translations.toggle.hideButtonText': 'Show original',
|
|
2305
|
-
'translations.toggle.showButtonText': 'Show translation',
|
|
2306
|
-
'window.srModalLayoutLabel': 'Chat window',
|
|
2307
|
-
'window.srTexts.onClose': 'The chat is closed.',
|
|
2308
|
-
'window.srTexts.onHistoryLoad': 'Chat history has been loaded.',
|
|
2309
|
-
'window.srTexts.onLoad': 'Chat is available on this page.',
|
|
2310
|
-
'window.srTexts.onOpen': 'The chat is opened.'
|
|
2134
|
+
previousEvent = event;
|
|
2135
|
+
});
|
|
2136
|
+
return mappedEvents;
|
|
2311
2137
|
});
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
// Actions
|
|
2325
|
-
|
|
2326
|
-
const {
|
|
2327
|
-
createAction: i18n_createAction
|
|
2328
|
-
} = createDomain('i18n');
|
|
2329
|
-
const i18n_initI18n = i18n_createAction('init', overrides => ({
|
|
2330
|
-
overrides
|
|
2331
|
-
}));
|
|
2332
|
-
const i18n_Actions = {
|
|
2333
|
-
initI18n: i18n_initI18n
|
|
2334
|
-
}; // Reducer
|
|
2335
|
-
|
|
2336
|
-
const defaultState = {
|
|
2337
|
-
translations: flattenObject(en),
|
|
2338
|
-
overrides: {}
|
|
2339
|
-
};
|
|
2340
|
-
const Reducer = createReducer('i18n', {
|
|
2341
|
-
[i18n_initI18n]: (state, {
|
|
2342
|
-
overrides
|
|
2343
|
-
}) => {
|
|
2344
|
-
return i18n_objectSpread(i18n_objectSpread({}, state), {}, {
|
|
2345
|
-
overrides: overrides ? flattenObject(overrides) : undefined
|
|
2346
|
-
});
|
|
2347
|
-
}
|
|
2348
|
-
}, defaultState); // Selectors
|
|
2349
|
-
|
|
2350
|
-
const i18n_getState = state => state[String(Reducer)];
|
|
2351
|
-
const getTranslations = createSelector(i18n_getState, state => state.translations);
|
|
2352
|
-
const getOverrides = createSelector(i18n_getState, state => state.overrides || {});
|
|
2353
|
-
const getCombinedTranslations = createSelector(getTranslations, getOverrides, (translations, overrides) => {
|
|
2354
|
-
const overrideKeys = Object.keys(overrides);
|
|
2355
|
-
|
|
2356
|
-
if (overrideKeys.length === 0) {
|
|
2357
|
-
return translations;
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
const defaultKeys = Object.keys(translations);
|
|
2361
|
-
defaultKeys.forEach(key => {
|
|
2362
|
-
if (overrideKeys.indexOf(key) === -1) {
|
|
2363
|
-
console.error('Seamly: Missing translation key:', key);
|
|
2364
|
-
}
|
|
2365
|
-
});
|
|
2366
|
-
return i18n_objectSpread(i18n_objectSpread({}, translations), overrides);
|
|
2367
|
-
}); // Hooks
|
|
2368
|
-
|
|
2369
|
-
function i18n_useI18n() {
|
|
2370
|
-
const translations = useSelector(getCombinedTranslations);
|
|
2371
|
-
const t = useCallback((key, values = {}) => {
|
|
2372
|
-
const translation = translations[key];
|
|
2373
|
-
|
|
2374
|
-
if (typeof translation === 'function') {
|
|
2375
|
-
return translation(values);
|
|
2376
|
-
} else {
|
|
2377
|
-
return translation;
|
|
2378
|
-
}
|
|
2379
|
-
}, [translations]);
|
|
2380
|
-
return {
|
|
2381
|
-
t
|
|
2382
|
-
};
|
|
2383
|
-
}
|
|
2384
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
function createMiddleware() {
|
|
2389
|
-
return ({
|
|
2390
|
-
dispatch
|
|
2391
|
-
}) => next => action => {
|
|
2392
|
-
var _action$config, _action$config2, _action$config2$defau;
|
|
2393
|
-
|
|
2394
|
-
const result = next(action);
|
|
2395
|
-
|
|
2396
|
-
switch (action.type) {
|
|
2397
|
-
case String(Actions.initialize):
|
|
2398
|
-
case String(Actions.update):
|
|
2399
|
-
if (action !== null && action !== void 0 && (_action$config = action.config) !== null && _action$config !== void 0 && _action$config.translations) {
|
|
2400
|
-
dispatch(initI18n(action.config.translations));
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
if (action !== null && action !== void 0 && (_action$config2 = action.config) !== null && _action$config2 !== void 0 && (_action$config2$defau = _action$config2.defaults) !== null && _action$config2$defau !== void 0 && _action$config2$defau.agentName) {
|
|
2404
|
-
var _action$config3, _action$config3$defau;
|
|
2405
|
-
|
|
2406
|
-
dispatch({
|
|
2407
|
-
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
2408
|
-
title: action === null || action === void 0 ? void 0 : (_action$config3 = action.config) === null || _action$config3 === void 0 ? void 0 : (_action$config3$defau = _action$config3.defaults) === null || _action$config3$defau === void 0 ? void 0 : _action$config3$defau.agentName
|
|
2409
|
-
});
|
|
2410
|
-
}
|
|
2411
|
-
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
return result;
|
|
2415
|
-
};
|
|
2416
|
-
}
|
|
2417
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
2425
|
-
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; }
|
|
2426
|
-
|
|
2427
|
-
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; }
|
|
2428
|
-
|
|
2429
|
-
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; }
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
const seamly_state_hooks_selectState = state => state.state;
|
|
2436
|
-
const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
|
|
2437
|
-
const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
|
|
2438
|
-
events
|
|
2439
|
-
}, config) => {
|
|
2440
|
-
var _config$messages$time, _config$messages;
|
|
2441
|
-
|
|
2442
|
-
const {
|
|
2443
|
-
enabled,
|
|
2444
|
-
threshold
|
|
2445
|
-
} = (_config$messages$time = config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) !== null && _config$messages$time !== void 0 ? _config$messages$time : {};
|
|
2446
|
-
|
|
2447
|
-
if (!enabled) {
|
|
2448
|
-
return events;
|
|
2449
|
-
}
|
|
2450
|
-
|
|
2451
|
-
const mappedEvents = [];
|
|
2452
|
-
let previousEvent = null;
|
|
2453
|
-
events.forEach((event, idx) => {
|
|
2454
|
-
// always add timeIndicator to first message
|
|
2455
|
-
if (idx === 0) {
|
|
2456
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2457
|
-
timeIndicator: event.payload.occurredAt
|
|
2458
|
-
})); // else check if diff is greater than threshold
|
|
2459
|
-
} else {
|
|
2460
|
-
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
2461
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2462
|
-
timeIndicator
|
|
2463
|
-
}));
|
|
2464
|
-
}
|
|
2465
|
-
|
|
2466
|
-
previousEvent = event;
|
|
2467
|
-
});
|
|
2468
|
-
return mappedEvents;
|
|
2469
|
-
});
|
|
2470
|
-
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
2471
|
-
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
2472
|
-
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
2473
|
-
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
2474
|
-
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
2475
|
-
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
2476
|
-
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
2477
|
-
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2478
|
-
var _filteredEvents;
|
|
2138
|
+
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
2139
|
+
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
2140
|
+
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
2141
|
+
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
2142
|
+
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
2143
|
+
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
2144
|
+
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
2145
|
+
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2146
|
+
var _filteredEvents;
|
|
2479
2147
|
|
|
2480
2148
|
const filteredEvents = events.filter(event => event.type === 'message');
|
|
2481
2149
|
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
@@ -2571,39 +2239,879 @@ const useFocusIfSeamlyContainedFocus = () => {
|
|
|
2571
2239
|
runIfElementContainsOrHasFocus(containerElementRef.current, focusFn);
|
|
2572
2240
|
}, []);
|
|
2573
2241
|
};
|
|
2574
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
|
|
2242
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
|
|
2243
|
+
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
const useSeamlyAppContainerClassNames = () => {
|
|
2247
|
+
return useConfig().appContainerClassNames;
|
|
2248
|
+
};
|
|
2249
|
+
const useSeamlyMessageContainerClassNames = event => {
|
|
2250
|
+
const {
|
|
2251
|
+
fromClient
|
|
2252
|
+
} = event.payload;
|
|
2253
|
+
const classNames = ['message'];
|
|
2254
|
+
|
|
2255
|
+
if (event.type === 'info') {
|
|
2256
|
+
classNames.push('message--source-info');
|
|
2257
|
+
} else if (!fromClient) {
|
|
2258
|
+
classNames.push('message--source-agent');
|
|
2259
|
+
} else {
|
|
2260
|
+
classNames.push('message--source-user');
|
|
2261
|
+
}
|
|
2262
|
+
|
|
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
|
+
|
|
2280
|
+
const next = async () => {
|
|
2281
|
+
if (!isRunning) {
|
|
2282
|
+
while (tasks.length) {
|
|
2283
|
+
const task = tasks.shift();
|
|
2284
|
+
isRunning = true; // eslint-disable-next-line no-await-in-loop
|
|
2285
|
+
|
|
2286
|
+
await task().catch(() => {});
|
|
2287
|
+
isRunning = false;
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2291
|
+
|
|
2292
|
+
const runExclusively = async task => {
|
|
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
|
+
};
|
|
2305
|
+
|
|
2306
|
+
return {
|
|
2307
|
+
next,
|
|
2308
|
+
runExclusively
|
|
2309
|
+
};
|
|
2310
|
+
}
|
|
2311
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/utils.js
|
|
2312
|
+
|
|
2313
|
+
const {
|
|
2314
|
+
createAction: i18n_utils_createAction,
|
|
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
|
|
2320
|
+
|
|
2321
|
+
|
|
2322
|
+
const selectTranslations = createSelector(i18n_utils_selectState, state => state.translations);
|
|
2323
|
+
const selectInitialLocale = createSelector(i18n_utils_selectState, state => state.initialLocale);
|
|
2324
|
+
const selectLocale = createSelector(i18n_utils_selectState, state => state.locale);
|
|
2325
|
+
|
|
2326
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/actions.js
|
|
2327
|
+
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
const setInitialLocale = i18n_utils_createAction('setInitialLocale', locale => ({
|
|
2331
|
+
locale
|
|
2332
|
+
}));
|
|
2333
|
+
const mutex = createMutex();
|
|
2334
|
+
const setLocale = i18n_utils_createThunk('setLocale', async (locale, {
|
|
2335
|
+
getState,
|
|
2336
|
+
extra: {
|
|
2337
|
+
api
|
|
2338
|
+
}
|
|
2339
|
+
}) => {
|
|
2340
|
+
return mutex.runExclusively(() => {
|
|
2341
|
+
if (locale === selectLocale(getState())) {
|
|
2342
|
+
return undefined;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
return api.getTranslations(locale);
|
|
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"];
|
|
2355
|
+
|
|
2356
|
+
if (_i == null) return;
|
|
2357
|
+
var _arr = [];
|
|
2358
|
+
var _n = true;
|
|
2359
|
+
var _d = false;
|
|
2360
|
+
|
|
2361
|
+
var _s, _e;
|
|
2362
|
+
|
|
2363
|
+
try {
|
|
2364
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
2365
|
+
_arr.push(_s.value);
|
|
2366
|
+
|
|
2367
|
+
if (i && _arr.length === i) break;
|
|
2368
|
+
}
|
|
2369
|
+
} catch (err) {
|
|
2370
|
+
_d = true;
|
|
2371
|
+
_e = err;
|
|
2372
|
+
} finally {
|
|
2373
|
+
try {
|
|
2374
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
2375
|
+
} finally {
|
|
2376
|
+
if (_d) throw _e;
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
return _arr;
|
|
2381
|
+
}
|
|
2382
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
2383
|
+
function _arrayLikeToArray(arr, len) {
|
|
2384
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2385
|
+
|
|
2386
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
2387
|
+
arr2[i] = arr[i];
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
return arr2;
|
|
2391
|
+
}
|
|
2392
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
2393
|
+
|
|
2394
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
2395
|
+
if (!o) return;
|
|
2396
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
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
|
|
2407
|
+
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
function _slicedToArray(arr, i) {
|
|
2412
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
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");
|
|
2418
|
+
}
|
|
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
|
+
|
|
2431
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
2432
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
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;
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
return obj;
|
|
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
|
+
}
|
|
2520
|
+
|
|
2521
|
+
//# sourceMappingURL=array-utils.es.js.map
|
|
2522
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/function-utils/function-utils.es.js
|
|
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
|
+
}
|
|
2542
|
+
|
|
2543
|
+
var key = args.length ? args.map(function (arg) {
|
|
2544
|
+
return arg === null ? 'null' : arg === undefined ? 'undefined' : typeof arg === 'function' ? arg.toString() : arg instanceof Date ? arg.toISOString() : JSON.stringify(arg);
|
|
2545
|
+
}).join('|') : '_(no-args)_';
|
|
2546
|
+
|
|
2547
|
+
if (Object.prototype.hasOwnProperty.call(cache, key)) {
|
|
2548
|
+
return cache[key];
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
var result = func.apply(void 0, args);
|
|
2552
|
+
cache[key] = result;
|
|
2553
|
+
return result;
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
|
|
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
|
+
/*
|
|
2567
|
+
* Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
2568
|
+
*
|
|
2569
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2570
|
+
* you may not use this file except in compliance with the License.
|
|
2571
|
+
* You may obtain a copy of the License at
|
|
2572
|
+
*
|
|
2573
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2574
|
+
*
|
|
2575
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2576
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2577
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2578
|
+
* See the License for the specific language governing permissions and
|
|
2579
|
+
* limitations under the License.
|
|
2580
|
+
*/
|
|
2581
|
+
|
|
2582
|
+
/**
|
|
2583
|
+
* Most branch-based type handlers are based around "cases".
|
|
2584
|
+
* For example, `select` and `plural` compare compare a value
|
|
2585
|
+
* to "case keys" to choose a subtranslation.
|
|
2586
|
+
*
|
|
2587
|
+
* This util splits "matches" portions provided to the aforementioned
|
|
2588
|
+
* handlers into case strings, and extracts any prepended arguments
|
|
2589
|
+
* (for example, `plural` supports an `offset:n` argument used for
|
|
2590
|
+
* populating the magic `#` variable).
|
|
2591
|
+
*
|
|
2592
|
+
* @param {String} string
|
|
2593
|
+
* @return {Object} The `cases` key points to a map of all cases.
|
|
2594
|
+
* The `arguments` key points to a list of prepended arguments.
|
|
2595
|
+
*/
|
|
2596
|
+
function parseCases(string) {
|
|
2597
|
+
var isWhitespace = function isWhitespace(ch) {
|
|
2598
|
+
return /\s/.test(ch);
|
|
2599
|
+
};
|
|
2600
|
+
|
|
2601
|
+
var args = [];
|
|
2602
|
+
var cases = {};
|
|
2603
|
+
var currTermStart = 0;
|
|
2604
|
+
var latestTerm = null;
|
|
2605
|
+
var inTerm = false;
|
|
2606
|
+
var i = 0;
|
|
2607
|
+
|
|
2608
|
+
while (i < string.length) {
|
|
2609
|
+
// Term ended
|
|
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.
|
|
2613
|
+
|
|
2614
|
+
if (string[i] === '{') {
|
|
2615
|
+
i--;
|
|
2616
|
+
}
|
|
2617
|
+
} // New term
|
|
2618
|
+
else if (!inTerm && !isWhitespace(string[i])) {
|
|
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.
|
|
2621
|
+
|
|
2622
|
+
if (latestTerm && caseBody) {
|
|
2623
|
+
var branchEndIndex = findClosingBracket(string, i);
|
|
2624
|
+
|
|
2625
|
+
if (branchEndIndex === -1) {
|
|
2626
|
+
throw new Error("Unbalanced curly braces in string: \"".concat(string, "\""));
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
cases[latestTerm] = string.slice(i + 1, branchEndIndex); // Don't include the braces
|
|
2630
|
+
|
|
2631
|
+
i = branchEndIndex; // Will be moved up where needed at end of loop.
|
|
2632
|
+
|
|
2633
|
+
latestTerm = null;
|
|
2634
|
+
} else {
|
|
2635
|
+
if (latestTerm) {
|
|
2636
|
+
args.push(latestTerm);
|
|
2637
|
+
latestTerm = null;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
inTerm = true;
|
|
2641
|
+
currTermStart = i;
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
i++;
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
if (inTerm) {
|
|
2649
|
+
latestTerm = string.slice(currTermStart);
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2652
|
+
if (latestTerm) {
|
|
2653
|
+
args.push(latestTerm);
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
return {
|
|
2657
|
+
args: args,
|
|
2658
|
+
cases: cases
|
|
2659
|
+
};
|
|
2660
|
+
}
|
|
2661
|
+
/**
|
|
2662
|
+
* Finds the index of the matching closing curly bracket, including through
|
|
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
|
+
*/
|
|
2670
|
+
|
|
2671
|
+
function findClosingBracket(string, fromIndex) {
|
|
2672
|
+
var depth = 0;
|
|
2673
|
+
|
|
2674
|
+
for (var i = fromIndex + 1; i < string.length; i++) {
|
|
2675
|
+
var char = string.charAt(i);
|
|
2676
|
+
|
|
2677
|
+
if (char === '}') {
|
|
2678
|
+
if (depth === 0) {
|
|
2679
|
+
return i;
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
depth--;
|
|
2683
|
+
} else if (char === '{') {
|
|
2684
|
+
depth++;
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
return -1;
|
|
2689
|
+
}
|
|
2690
|
+
/**
|
|
2691
|
+
* Split a `{key, type, format}` block into those 3 parts, taking into account
|
|
2692
|
+
* nested message syntax that can exist in the `format` part.
|
|
2693
|
+
*
|
|
2694
|
+
* @param {String} block
|
|
2695
|
+
* @return {Array}
|
|
2696
|
+
* An array with `key`, `type`, and `format` items in that order, if present
|
|
2697
|
+
* in the formatted argument block.
|
|
2698
|
+
*/
|
|
2699
|
+
|
|
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
|
+
|
|
2715
|
+
function split(string, separator, limit) {
|
|
2716
|
+
var accumulator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
2717
|
+
|
|
2718
|
+
if (!string) {
|
|
2719
|
+
return accumulator;
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
if (limit === 1) {
|
|
2723
|
+
accumulator.push(string);
|
|
2724
|
+
return accumulator;
|
|
2725
|
+
}
|
|
2726
|
+
|
|
2727
|
+
var indexOfDelimiter = string.indexOf(separator);
|
|
2728
|
+
|
|
2729
|
+
if (indexOfDelimiter === -1) {
|
|
2730
|
+
accumulator.push(string);
|
|
2731
|
+
return accumulator;
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
var head = string.substring(0, indexOfDelimiter).trim();
|
|
2735
|
+
var tail = string.substring(indexOfDelimiter + separator.length + 1).trim();
|
|
2736
|
+
accumulator.push(head);
|
|
2737
|
+
return split(tail, separator, limit - 1, accumulator);
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
/**
|
|
2741
|
+
* The main class for formatting messages.
|
|
2742
|
+
*
|
|
2743
|
+
* @author Emanuel Rabina
|
|
2744
|
+
*/
|
|
2745
|
+
|
|
2746
|
+
var MessageFormatter = /*#__PURE__*/function () {
|
|
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;
|
|
2759
|
+
|
|
2760
|
+
var typeHandlers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2761
|
+
|
|
2762
|
+
_classCallCheck(this, MessageFormatter);
|
|
2763
|
+
|
|
2764
|
+
defineProperty_defineProperty(this, "format", memoize(function (message) {
|
|
2765
|
+
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2766
|
+
return flatten(_this.process(message, values)).join('');
|
|
2767
|
+
}));
|
|
2768
|
+
|
|
2769
|
+
this.locale = locale;
|
|
2770
|
+
this.typeHandlers = typeHandlers;
|
|
2771
|
+
}
|
|
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
|
+
|
|
2781
|
+
|
|
2782
|
+
_createClass(MessageFormatter, [{
|
|
2783
|
+
key: "process",
|
|
2784
|
+
value:
|
|
2785
|
+
/**
|
|
2786
|
+
* Process an ICU message syntax string using `values` for placeholder data
|
|
2787
|
+
* and any currently-registered type handlers. The result of this method is
|
|
2788
|
+
* an array of the component parts after they have been processed in turn by
|
|
2789
|
+
* their own type handlers. This raw output is useful for other renderers,
|
|
2790
|
+
* eg: React where components can be used instead of being forced to return
|
|
2791
|
+
* raw strings.
|
|
2792
|
+
*
|
|
2793
|
+
* This method is used by {@link MessageFormatter#format} where it acts as a
|
|
2794
|
+
* string renderer.
|
|
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] : {};
|
|
2802
|
+
|
|
2803
|
+
if (!message) {
|
|
2804
|
+
return [];
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
var blockStartIndex = message.indexOf('{');
|
|
2808
|
+
|
|
2809
|
+
if (blockStartIndex !== -1) {
|
|
2810
|
+
var blockEndIndex = findClosingBracket(message, blockStartIndex);
|
|
2811
|
+
|
|
2812
|
+
if (blockEndIndex !== -1) {
|
|
2813
|
+
var block = message.substring(blockStartIndex, blockEndIndex + 1);
|
|
2814
|
+
|
|
2815
|
+
if (block) {
|
|
2816
|
+
var result = [];
|
|
2817
|
+
var head = message.substring(0, blockStartIndex);
|
|
2818
|
+
|
|
2819
|
+
if (head) {
|
|
2820
|
+
result.push(head);
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
var _splitFormattedArgume = splitFormattedArgument(block),
|
|
2824
|
+
_splitFormattedArgume2 = _slicedToArray(_splitFormattedArgume, 3),
|
|
2825
|
+
key = _splitFormattedArgume2[0],
|
|
2826
|
+
type = _splitFormattedArgume2[1],
|
|
2827
|
+
format = _splitFormattedArgume2[2];
|
|
2828
|
+
|
|
2829
|
+
var body = values[key];
|
|
2830
|
+
|
|
2831
|
+
if (body === null || body === undefined) {
|
|
2832
|
+
body = '';
|
|
2833
|
+
}
|
|
2834
|
+
|
|
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
|
+
|
|
2839
|
+
if (tail) {
|
|
2840
|
+
result.push(this.process(tail, values));
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
return result;
|
|
2844
|
+
}
|
|
2845
|
+
} else {
|
|
2846
|
+
throw new Error("Unbalanced curly braces in string: \"".concat(message, "\""));
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
return [message];
|
|
2851
|
+
}
|
|
2852
|
+
}]);
|
|
2853
|
+
|
|
2854
|
+
return MessageFormatter;
|
|
2855
|
+
}();
|
|
2856
|
+
|
|
2857
|
+
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; }
|
|
2858
|
+
|
|
2859
|
+
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; }
|
|
2860
|
+
var pluralFormatter;
|
|
2861
|
+
var keyCounter = 0; // All the special keywords that can be used in `plural` blocks for the various branches
|
|
2862
|
+
|
|
2863
|
+
var ONE = 'one';
|
|
2864
|
+
var OTHER$1 = 'other';
|
|
2865
|
+
/**
|
|
2866
|
+
* @private
|
|
2867
|
+
* @param {String} caseBody
|
|
2868
|
+
* @param {Number} value
|
|
2869
|
+
* @return {Object} {caseBody: string, numberValues: object}
|
|
2870
|
+
*/
|
|
2871
|
+
|
|
2872
|
+
function replaceNumberSign(caseBody, value) {
|
|
2873
|
+
var i = 0;
|
|
2874
|
+
var output = '';
|
|
2875
|
+
var numBraces = 0;
|
|
2876
|
+
var numberValues = {};
|
|
2877
|
+
|
|
2878
|
+
while (i < caseBody.length) {
|
|
2879
|
+
if (caseBody[i] === '#' && !numBraces) {
|
|
2880
|
+
var keyParam = "__hashToken".concat(keyCounter++);
|
|
2881
|
+
output += "{".concat(keyParam, ", number}");
|
|
2882
|
+
numberValues[keyParam] = value;
|
|
2883
|
+
} else {
|
|
2884
|
+
output += caseBody[i];
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
if (caseBody[i] === '{') {
|
|
2888
|
+
numBraces++;
|
|
2889
|
+
} else if (caseBody[i] === '}') {
|
|
2890
|
+
numBraces--;
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
i++;
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
return {
|
|
2897
|
+
caseBody: output,
|
|
2898
|
+
numberValues: numberValues
|
|
2899
|
+
};
|
|
2900
|
+
}
|
|
2901
|
+
/**
|
|
2902
|
+
* Handler for `plural` statements within ICU message syntax strings. Returns
|
|
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
|
+
*/
|
|
2915
|
+
|
|
2916
|
+
|
|
2917
|
+
function pluralTypeHandler(value) {
|
|
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;
|
|
2922
|
+
|
|
2923
|
+
var _parseCases = parseCases(matches),
|
|
2924
|
+
args = _parseCases.args,
|
|
2925
|
+
cases = _parseCases.cases;
|
|
2926
|
+
|
|
2927
|
+
var intValue = parseInt(value);
|
|
2928
|
+
args.forEach(function (arg) {
|
|
2929
|
+
if (arg.startsWith('offset:')) {
|
|
2930
|
+
intValue -= parseInt(arg.slice('offset:'.length));
|
|
2931
|
+
}
|
|
2932
|
+
});
|
|
2933
|
+
var keywordPossibilities = [];
|
|
2934
|
+
|
|
2935
|
+
if ('PluralRules' in Intl) {
|
|
2936
|
+
// Effectively memoize because instantiation of `Int.*` objects is expensive.
|
|
2937
|
+
if (pluralFormatter === undefined || pluralFormatter.resolvedOptions().locale !== locale) {
|
|
2938
|
+
pluralFormatter = new Intl.PluralRules(locale);
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
var pluralKeyword = pluralFormatter.select(intValue); // Other is always added last with least priority, so we don't want to add it here.
|
|
2942
|
+
|
|
2943
|
+
if (pluralKeyword !== OTHER$1) {
|
|
2944
|
+
keywordPossibilities.push(pluralKeyword);
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
if (intValue === 1) {
|
|
2949
|
+
keywordPossibilities.push(ONE);
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
keywordPossibilities.push("=".concat(intValue), OTHER$1);
|
|
2953
|
+
|
|
2954
|
+
for (var i = 0; i < keywordPossibilities.length; i++) {
|
|
2955
|
+
var keyword = keywordPossibilities[i];
|
|
2956
|
+
|
|
2957
|
+
if (keyword in cases) {
|
|
2958
|
+
var _replaceNumberSign = replaceNumberSign(cases[keyword], intValue),
|
|
2959
|
+
caseBody = _replaceNumberSign.caseBody,
|
|
2960
|
+
numberValues = _replaceNumberSign.numberValues;
|
|
2961
|
+
|
|
2962
|
+
return format(caseBody, icu_message_formatter_es_objectSpread(icu_message_formatter_es_objectSpread({}, values), numberValues));
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
return value;
|
|
2967
|
+
}
|
|
2968
|
+
|
|
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
|
+
|
|
3000
|
+
function selectTypeHandler(value) {
|
|
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;
|
|
3004
|
+
|
|
3005
|
+
var _parseCases = parseCases(matches),
|
|
3006
|
+
cases = _parseCases.cases;
|
|
3007
|
+
|
|
3008
|
+
if (value in cases) {
|
|
3009
|
+
return format(cases[value], values);
|
|
3010
|
+
} else if (OTHER in cases) {
|
|
3011
|
+
return format(cases[OTHER], values);
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
return value;
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
|
|
3018
|
+
//# sourceMappingURL=icu-message-formatter.es.js.map
|
|
3019
|
+
|
|
3020
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/hooks.js
|
|
3021
|
+
|
|
3022
|
+
|
|
3023
|
+
|
|
3024
|
+
// The passed in locale (en-GB) is only used to call Intl.PluralRules.select() in
|
|
3025
|
+
// pluralTypeHandler. Since we only use exact plural matches (=0, =1 etc) we can
|
|
3026
|
+
// safely use en-GB all the time.
|
|
3027
|
+
|
|
3028
|
+
const formatter = new MessageFormatter('en-GB', {
|
|
3029
|
+
plural: pluralTypeHandler,
|
|
3030
|
+
select: selectTypeHandler
|
|
3031
|
+
});
|
|
3032
|
+
function hooks_useI18n() {
|
|
3033
|
+
const translations = useSelector(Selectors.selectTranslations);
|
|
3034
|
+
const locale = useSelector(Selectors.selectLocale);
|
|
3035
|
+
const initialLocale = useSelector(Selectors.selectInitialLocale);
|
|
3036
|
+
const t = useCallback((key, values = {}) => {
|
|
3037
|
+
const translation = translations[key];
|
|
3038
|
+
|
|
3039
|
+
if (!translation) {
|
|
3040
|
+
return null;
|
|
3041
|
+
}
|
|
3042
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
3058
|
+
|
|
3059
|
+
|
|
3060
|
+
const defaultState = {
|
|
3061
|
+
translations: {
|
|
3062
|
+
'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
|
|
3063
|
+
'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
|
|
3064
|
+
'errors.configError.title': 'Chat configuration error.',
|
|
3065
|
+
'errors.general.buttonText': 'Restart chat',
|
|
3066
|
+
'errors.general.message': 'Do you want to start a new chat session?',
|
|
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
|
|
3075
|
+
};
|
|
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
|
+
|
|
3097
|
+
return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3098
|
+
isLoading: false,
|
|
3099
|
+
locale,
|
|
3100
|
+
translations: Object.keys(translations).sort().reduce((accum, key) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, accum), {}, {
|
|
3101
|
+
[key]: translations[key]
|
|
3102
|
+
}), {})
|
|
3103
|
+
});
|
|
3104
|
+
},
|
|
3105
|
+
[setLocale.rejected]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3106
|
+
isLoading: false
|
|
3107
|
+
})
|
|
3108
|
+
}, defaultState));
|
|
3109
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/index.js
|
|
2575
3110
|
|
|
2576
3111
|
|
|
2577
3112
|
|
|
2578
|
-
const useSeamlyAppContainerClassNames = () => {
|
|
2579
|
-
return useConfig().appContainerClassNames;
|
|
2580
|
-
};
|
|
2581
|
-
const useSeamlyMessageContainerClassNames = event => {
|
|
2582
|
-
const {
|
|
2583
|
-
fromClient
|
|
2584
|
-
} = event.payload;
|
|
2585
|
-
const classNames = ['message'];
|
|
2586
3113
|
|
|
2587
|
-
if (event.type === 'info') {
|
|
2588
|
-
classNames.push('message--source-info');
|
|
2589
|
-
} else if (!fromClient) {
|
|
2590
|
-
classNames.push('message--source-agent');
|
|
2591
|
-
} else {
|
|
2592
|
-
classNames.push('message--source-user');
|
|
2593
|
-
}
|
|
2594
3114
|
|
|
2595
|
-
return classNames;
|
|
2596
|
-
};
|
|
2597
|
-
const useCobrowsingContainer = () => {
|
|
2598
|
-
const {
|
|
2599
|
-
cobrowsingContainerId: id
|
|
2600
|
-
} = useSeamlyStateContext();
|
|
2601
|
-
const focusContainer = useElementFocusingById(id);
|
|
2602
|
-
return {
|
|
2603
|
-
id,
|
|
2604
|
-
focusContainer
|
|
2605
|
-
};
|
|
2606
|
-
};
|
|
2607
3115
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-option-hooks.js
|
|
2608
3116
|
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; }
|
|
2609
3117
|
|
|
@@ -2834,46 +3342,26 @@ const utility_hooks_useStableCallback = callback => {
|
|
|
2834
3342
|
return isFunction ? (...args) => callbackRef.current(...args) : undefined;
|
|
2835
3343
|
}, [isFunction]);
|
|
2836
3344
|
};
|
|
2837
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/
|
|
3345
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/utils.js
|
|
2838
3346
|
|
|
2839
3347
|
const {
|
|
2840
|
-
createAction:
|
|
3348
|
+
createAction: interrupt_utils_createAction,
|
|
3349
|
+
createReducer: interrupt_utils_createReducer,
|
|
3350
|
+
selectState: interrupt_utils_selectState
|
|
2841
3351
|
} = createDomain('interrupt');
|
|
2842
|
-
|
|
3352
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/actions.js
|
|
3353
|
+
|
|
3354
|
+
const set = interrupt_utils_createAction('set', error => ({
|
|
2843
3355
|
error
|
|
2844
3356
|
}));
|
|
2845
|
-
const clear =
|
|
2846
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
|
|
2847
|
-
function interrupt_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2848
|
-
|
|
2849
|
-
function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { interrupt_reducer_ownKeys(Object(source), true).forEach(function (key) { interrupt_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { interrupt_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2850
|
-
|
|
2851
|
-
function interrupt_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
const interrupt_reducer_initialState = {
|
|
2856
|
-
error: undefined
|
|
2857
|
-
};
|
|
2858
|
-
/* harmony default export */ const interrupt_reducer = (createReducer('interrupt', {
|
|
2859
|
-
[set]: (state, {
|
|
2860
|
-
error
|
|
2861
|
-
}) => {
|
|
2862
|
-
return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
|
|
2863
|
-
error
|
|
2864
|
-
});
|
|
2865
|
-
},
|
|
2866
|
-
[clear]: () => {
|
|
2867
|
-
return interrupt_reducer_initialState;
|
|
2868
|
-
}
|
|
2869
|
-
}, interrupt_reducer_initialState));
|
|
3357
|
+
const clear = interrupt_utils_createAction('clear');
|
|
2870
3358
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.js
|
|
2871
3359
|
|
|
2872
3360
|
|
|
2873
|
-
const
|
|
2874
|
-
const selectError = createSelector(selectors_selectState, ({
|
|
3361
|
+
const selectError = createSelector(interrupt_utils_selectState, ({
|
|
2875
3362
|
error
|
|
2876
3363
|
}) => error);
|
|
3364
|
+
|
|
2877
3365
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.js
|
|
2878
3366
|
function hooks_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2879
3367
|
|
|
@@ -3010,6 +3498,30 @@ function middleware_createMiddleware() {
|
|
|
3010
3498
|
return next(action);
|
|
3011
3499
|
};
|
|
3012
3500
|
}
|
|
3501
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
|
|
3502
|
+
function interrupt_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3503
|
+
|
|
3504
|
+
function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { interrupt_reducer_ownKeys(Object(source), true).forEach(function (key) { interrupt_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { interrupt_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
3505
|
+
|
|
3506
|
+
function interrupt_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3507
|
+
|
|
3508
|
+
|
|
3509
|
+
|
|
3510
|
+
const interrupt_reducer_initialState = {
|
|
3511
|
+
error: undefined
|
|
3512
|
+
};
|
|
3513
|
+
/* harmony default export */ const interrupt_reducer = (interrupt_utils_createReducer({
|
|
3514
|
+
[set]: (state, {
|
|
3515
|
+
error
|
|
3516
|
+
}) => {
|
|
3517
|
+
return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
|
|
3518
|
+
error
|
|
3519
|
+
});
|
|
3520
|
+
},
|
|
3521
|
+
[clear]: () => {
|
|
3522
|
+
return interrupt_reducer_initialState;
|
|
3523
|
+
}
|
|
3524
|
+
}, interrupt_reducer_initialState));
|
|
3013
3525
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
|
|
3014
3526
|
|
|
3015
3527
|
|
|
@@ -3017,6 +3529,103 @@ function middleware_createMiddleware() {
|
|
|
3017
3529
|
|
|
3018
3530
|
|
|
3019
3531
|
|
|
3532
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
|
|
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;
|
|
3557
|
+
|
|
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
|
+
|
|
3570
|
+
try {
|
|
3571
|
+
if (api.hasConversation()) {
|
|
3572
|
+
var _initialState$transla;
|
|
3573
|
+
|
|
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
|
+
|
|
3581
|
+
if ('userResponded' in initialState) {
|
|
3582
|
+
dispatch(setHasResponded(initialState.userResponded));
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
} catch (error) {
|
|
3586
|
+
dispatch(set(error));
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3589
|
+
await dispatch(setLocale(locale));
|
|
3590
|
+
} catch (error) {
|
|
3591
|
+
dispatch(set(error));
|
|
3592
|
+
}
|
|
3593
|
+
});
|
|
3594
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
|
|
3595
|
+
|
|
3596
|
+
|
|
3597
|
+
const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
|
|
3598
|
+
|
|
3599
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
|
|
3600
|
+
|
|
3601
|
+
|
|
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
|
+
|
|
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
|
+
|
|
3610
|
+
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; }
|
|
3611
|
+
|
|
3612
|
+
|
|
3613
|
+
|
|
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
|
+
|
|
3626
|
+
|
|
3627
|
+
|
|
3628
|
+
|
|
3020
3629
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-commands.js
|
|
3021
3630
|
function use_seamly_commands_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3022
3631
|
|
|
@@ -3036,6 +3645,7 @@ function use_seamly_commands_defineProperty(obj, key, value) { if (key in obj) {
|
|
|
3036
3645
|
|
|
3037
3646
|
|
|
3038
3647
|
|
|
3648
|
+
|
|
3039
3649
|
const {
|
|
3040
3650
|
ADD_EVENT: use_seamly_commands_ADD_EVENT,
|
|
3041
3651
|
CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
|
|
@@ -3054,7 +3664,7 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3054
3664
|
const appConfig = useConfig();
|
|
3055
3665
|
const dispatch = useSeamlyDispatchContext();
|
|
3056
3666
|
const eventBus = useContext(SeamlyEventBusContext);
|
|
3057
|
-
const hasResponded =
|
|
3667
|
+
const hasResponded = useUserHasResponded();
|
|
3058
3668
|
const hasConversation = useSeamlyHasConversation();
|
|
3059
3669
|
const {
|
|
3060
3670
|
visible: visibility
|
|
@@ -3080,10 +3690,10 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3080
3690
|
});
|
|
3081
3691
|
}, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
|
|
3082
3692
|
const reset = useCallback(async () => {
|
|
3693
|
+
dispatch(InterruptActions.clear());
|
|
3083
3694
|
dispatch({
|
|
3084
3695
|
type: use_seamly_commands_CLEAR_EVENTS
|
|
3085
3696
|
});
|
|
3086
|
-
dispatch(InterruptActions.clear());
|
|
3087
3697
|
dispatch({
|
|
3088
3698
|
type: use_seamly_commands_SET_IS_LOADING,
|
|
3089
3699
|
isLoading: true
|
|
@@ -3109,20 +3719,16 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3109
3719
|
});
|
|
3110
3720
|
|
|
3111
3721
|
try {
|
|
3112
|
-
const {
|
|
3113
|
-
accountConfig = {},
|
|
3114
|
-
initialState = {}
|
|
3115
|
-
} = await api.reset();
|
|
3116
3722
|
const {
|
|
3117
3723
|
features
|
|
3118
|
-
} =
|
|
3724
|
+
} = await api.reset();
|
|
3119
3725
|
dispatch({
|
|
3120
3726
|
type: use_seamly_commands_SET_FEATURES,
|
|
3121
3727
|
features
|
|
3122
3728
|
});
|
|
3123
3729
|
dispatch({
|
|
3124
3730
|
type: use_seamly_commands_SET_INITIAL_STATE,
|
|
3125
|
-
initialState
|
|
3731
|
+
initialState: {}
|
|
3126
3732
|
});
|
|
3127
3733
|
} catch (error) {
|
|
3128
3734
|
dispatch(InterruptActions.set(error));
|
|
@@ -3350,24 +3956,21 @@ const useSeamlyTyping = () => {
|
|
|
3350
3956
|
const {
|
|
3351
3957
|
sendAction
|
|
3352
3958
|
} = useSeamlyCommands();
|
|
3353
|
-
const {
|
|
3354
|
-
typing: typingConfig
|
|
3355
|
-
} = useConfig();
|
|
3356
3959
|
const {
|
|
3357
3960
|
features
|
|
3358
3961
|
} = useSeamlyOptions();
|
|
3359
3962
|
const {
|
|
3360
3963
|
typingPeekahead
|
|
3361
3964
|
} = features || {};
|
|
3362
|
-
const
|
|
3363
|
-
const
|
|
3965
|
+
const typingTimerId = useRef(null);
|
|
3966
|
+
const sendEndTypingTimerId = useRef(null);
|
|
3364
3967
|
const isTyping = useRef(false);
|
|
3365
|
-
const
|
|
3968
|
+
const typingIntervalId = useRef(null);
|
|
3366
3969
|
useEffect(() => {
|
|
3367
3970
|
return () => {
|
|
3368
|
-
clearInterval(
|
|
3369
|
-
clearTimeout(
|
|
3370
|
-
clearTimeout(
|
|
3971
|
+
clearInterval(typingIntervalId.current);
|
|
3972
|
+
clearTimeout(typingTimerId.current);
|
|
3973
|
+
clearTimeout(sendEndTypingTimerId.current);
|
|
3371
3974
|
};
|
|
3372
3975
|
}, []);
|
|
3373
3976
|
|
|
@@ -3387,32 +3990,28 @@ const useSeamlyTyping = () => {
|
|
|
3387
3990
|
return;
|
|
3388
3991
|
}
|
|
3389
3992
|
|
|
3390
|
-
if (!typingConfig) {
|
|
3391
|
-
return;
|
|
3392
|
-
}
|
|
3393
|
-
|
|
3394
3993
|
isTyping.current = true;
|
|
3395
3994
|
|
|
3396
|
-
if (!
|
|
3995
|
+
if (!typingIntervalId.current) {
|
|
3397
3996
|
sendTypingState(true, e.target.value);
|
|
3398
|
-
|
|
3997
|
+
typingIntervalId.current = setInterval(() => {
|
|
3399
3998
|
if (!isTyping.current) {
|
|
3400
|
-
clearInterval(
|
|
3401
|
-
|
|
3999
|
+
clearInterval(typingIntervalId.current);
|
|
4000
|
+
typingIntervalId.current = null;
|
|
3402
4001
|
} else if (typingPeekahead && typingPeekahead.enabled) {
|
|
3403
4002
|
sendTypingState(true, e.target.value);
|
|
3404
4003
|
}
|
|
3405
|
-
},
|
|
4004
|
+
}, typingTimeout);
|
|
3406
4005
|
}
|
|
3407
4006
|
|
|
3408
|
-
clearTimeout(
|
|
3409
|
-
clearTimeout(
|
|
3410
|
-
|
|
4007
|
+
clearTimeout(typingTimerId.current);
|
|
4008
|
+
clearTimeout(sendEndTypingTimerId.current);
|
|
4009
|
+
typingTimerId.current = setTimeout(() => {
|
|
3411
4010
|
isTyping.current = false;
|
|
3412
4011
|
}, 300);
|
|
3413
|
-
|
|
4012
|
+
sendEndTypingTimerId.current = setTimeout(() => {
|
|
3414
4013
|
sendTypingState(false, e.target.value);
|
|
3415
|
-
},
|
|
4014
|
+
}, typingTimeout);
|
|
3416
4015
|
};
|
|
3417
4016
|
};
|
|
3418
4017
|
const useSeamlyEntry = () => {
|
|
@@ -3505,6 +4104,7 @@ const use_seamly_stored_visibility_useSeamlyStoredVisibility = () => {
|
|
|
3505
4104
|
|
|
3506
4105
|
|
|
3507
4106
|
|
|
4107
|
+
|
|
3508
4108
|
const {
|
|
3509
4109
|
SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
|
|
3510
4110
|
} = seamly_utils_seamlyActions;
|
|
@@ -3523,7 +4123,7 @@ const use_seamly_visibility_useSeamlyVisibility = () => {
|
|
|
3523
4123
|
} = useSeamlyCommands();
|
|
3524
4124
|
const dispatch = useSeamlyDispatchContext();
|
|
3525
4125
|
const [storedVisibility, setStoredVisibility] = useSeamlyStoredVisibility();
|
|
3526
|
-
const hasResponded =
|
|
4126
|
+
const hasResponded = useUserHasResponded();
|
|
3527
4127
|
const hasConversation = useSeamlyHasConversation();
|
|
3528
4128
|
const unreadMessageCount = useSeamlyUnreadCount();
|
|
3529
4129
|
const isVisible = visible ? visible !== visibilityStates.hidden : false;
|
|
@@ -4053,6 +4653,123 @@ function hooks_useTranslationsContainer() {
|
|
|
4053
4653
|
focusContainer
|
|
4054
4654
|
};
|
|
4055
4655
|
}
|
|
4656
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/middleware.js
|
|
4657
|
+
|
|
4658
|
+
|
|
4659
|
+
|
|
4660
|
+
function translations_middleware_createMiddleware() {
|
|
4661
|
+
return ({
|
|
4662
|
+
dispatch,
|
|
4663
|
+
getState
|
|
4664
|
+
}) => next => action => {
|
|
4665
|
+
var _action$history, _action$history$trans, _action$initialState, _action$initialState$, _action$event, _action$event$payload, _action$event$payload2;
|
|
4666
|
+
|
|
4667
|
+
const result = next(action);
|
|
4668
|
+
|
|
4669
|
+
switch (action.type) {
|
|
4670
|
+
case String(seamlyActions.SET_HISTORY):
|
|
4671
|
+
if ((_action$history = action.history) !== null && _action$history !== void 0 && (_action$history$trans = _action$history.translation) !== null && _action$history$trans !== void 0 && _action$history$trans.enabled) {
|
|
4672
|
+
dispatch(Actions.enable(action.history.translation.locale));
|
|
4673
|
+
}
|
|
4674
|
+
|
|
4675
|
+
break;
|
|
4676
|
+
|
|
4677
|
+
case String(seamlyActions.SET_INITIAL_STATE):
|
|
4678
|
+
if ((_action$initialState = action.initialState) !== null && _action$initialState !== void 0 && (_action$initialState$ = _action$initialState.translation) !== null && _action$initialState$ !== void 0 && _action$initialState$.enabled) {
|
|
4679
|
+
dispatch(Actions.enable(action.initialState.translation.locale));
|
|
4680
|
+
dispatch(I18nActions.setLocale(action.locale));
|
|
4681
|
+
}
|
|
4682
|
+
|
|
4683
|
+
break;
|
|
4684
|
+
|
|
4685
|
+
case String(seamlyActions.ADD_EVENT):
|
|
4686
|
+
if (action.event.type === 'info' && ((_action$event = action.event) === null || _action$event === void 0 ? void 0 : (_action$event$payload = _action$event.payload) === null || _action$event$payload === void 0 ? void 0 : (_action$event$payload2 = _action$event$payload.body) === null || _action$event$payload2 === void 0 ? void 0 : _action$event$payload2.subtype) === 'new_translation' && action.event.payload.body.translationEnabled) {
|
|
4687
|
+
dispatch(I18nActions.setLocale(action.event.payload.body.translationLocale));
|
|
4688
|
+
}
|
|
4689
|
+
|
|
4690
|
+
break;
|
|
4691
|
+
|
|
4692
|
+
case String(Actions.disable):
|
|
4693
|
+
const initialLocale = I18nSelectors.selectInitialLocale(getState());
|
|
4694
|
+
dispatch(I18nActions.setLocale(initialLocale));
|
|
4695
|
+
break;
|
|
4696
|
+
}
|
|
4697
|
+
|
|
4698
|
+
return result;
|
|
4699
|
+
};
|
|
4700
|
+
}
|
|
4701
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/reducer.js
|
|
4702
|
+
function translations_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4703
|
+
|
|
4704
|
+
function translations_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { translations_reducer_ownKeys(Object(source), true).forEach(function (key) { translations_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { translations_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4705
|
+
|
|
4706
|
+
function translations_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4707
|
+
|
|
4708
|
+
|
|
4709
|
+
|
|
4710
|
+
|
|
4711
|
+
|
|
4712
|
+
const translations_reducer_initialState = {
|
|
4713
|
+
isActive: false,
|
|
4714
|
+
currentLocale: undefined,
|
|
4715
|
+
isAvailable: false,
|
|
4716
|
+
languages: [],
|
|
4717
|
+
originalPayloadIds: [],
|
|
4718
|
+
containerId: id_randomId()
|
|
4719
|
+
};
|
|
4720
|
+
/* harmony default export */ const translations_reducer = (translations_utils_createReducer({
|
|
4721
|
+
[seamly_utils_seamlyActions.SET_FEATURES]: (state, action) => {
|
|
4722
|
+
var _action$features;
|
|
4723
|
+
|
|
4724
|
+
const feature = action === null || action === void 0 ? void 0 : (_action$features = action.features) === null || _action$features === void 0 ? void 0 : _action$features.translation;
|
|
4725
|
+
|
|
4726
|
+
if (!feature) {
|
|
4727
|
+
return state;
|
|
4728
|
+
}
|
|
4729
|
+
|
|
4730
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4731
|
+
isAvailable: feature.enabled === true,
|
|
4732
|
+
languages: feature.languages || []
|
|
4733
|
+
});
|
|
4734
|
+
},
|
|
4735
|
+
[seamly_utils_seamlyActions.CLEAR_FEATURES]: () => translations_reducer_initialState,
|
|
4736
|
+
[enable]: (state, {
|
|
4737
|
+
locale
|
|
4738
|
+
}) => {
|
|
4739
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4740
|
+
isActive: true,
|
|
4741
|
+
currentLocale: locale
|
|
4742
|
+
});
|
|
4743
|
+
},
|
|
4744
|
+
[disable]: state => {
|
|
4745
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4746
|
+
isActive: false,
|
|
4747
|
+
currentLocale: undefined
|
|
4748
|
+
});
|
|
4749
|
+
},
|
|
4750
|
+
[enableEvent]: (state, {
|
|
4751
|
+
payloadId
|
|
4752
|
+
}) => {
|
|
4753
|
+
if (!state.originalPayloadIds.includes(payloadId)) {
|
|
4754
|
+
return state;
|
|
4755
|
+
}
|
|
4756
|
+
|
|
4757
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4758
|
+
originalPayloadIds: state.originalPayloadIds.filter(id => id !== payloadId)
|
|
4759
|
+
});
|
|
4760
|
+
},
|
|
4761
|
+
[disableEvent]: (state, {
|
|
4762
|
+
payloadId
|
|
4763
|
+
}) => {
|
|
4764
|
+
if (state.originalPayloadIds.includes(payloadId)) {
|
|
4765
|
+
return state;
|
|
4766
|
+
}
|
|
4767
|
+
|
|
4768
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4769
|
+
originalPayloadIds: [...state.originalPayloadIds, payloadId]
|
|
4770
|
+
});
|
|
4771
|
+
}
|
|
4772
|
+
}, translations_reducer_initialState));
|
|
4056
4773
|
;// CONCATENATED MODULE: ./src/javascripts/lib/css.js
|
|
4057
4774
|
|
|
4058
4775
|
/**
|
|
@@ -4538,6 +5255,9 @@ function form_TranslationsOptionsDialogForm({
|
|
|
4538
5255
|
languages,
|
|
4539
5256
|
currentLocale
|
|
4540
5257
|
} = useTranslations();
|
|
5258
|
+
const {
|
|
5259
|
+
locale: uiLocale
|
|
5260
|
+
} = useI18n();
|
|
4541
5261
|
const languageName = useMemo(() => {
|
|
4542
5262
|
var _languages$find;
|
|
4543
5263
|
|
|
@@ -4547,11 +5267,11 @@ function form_TranslationsOptionsDialogForm({
|
|
|
4547
5267
|
return [{
|
|
4548
5268
|
value: '',
|
|
4549
5269
|
label: t('translations.settings.defaultOptionLabel')
|
|
4550
|
-
}, ...languages.map(language => ({
|
|
5270
|
+
}, ...languages.filter(language => language.locale.toLowerCase() !== String(uiLocale).toLowerCase()).map(language => ({
|
|
4551
5271
|
value: language.locale,
|
|
4552
5272
|
label: language.nativeName
|
|
4553
5273
|
}))];
|
|
4554
|
-
}, [t, languages]);
|
|
5274
|
+
}, [t, languages, uiLocale]);
|
|
4555
5275
|
return _jsxs(Form, {
|
|
4556
5276
|
noValidate: "true",
|
|
4557
5277
|
children: [_jsx("p", {
|
|
@@ -4969,7 +5689,9 @@ function TranslationsChatStatus() {
|
|
|
4969
5689
|
return _jsx(ChatStatus, {
|
|
4970
5690
|
type: "translations",
|
|
4971
5691
|
id: id,
|
|
4972
|
-
label: t('translations.status.label',
|
|
5692
|
+
label: t('translations.status.label', {
|
|
5693
|
+
language: languageName
|
|
5694
|
+
}),
|
|
4973
5695
|
onButtonClick: handleClickStop,
|
|
4974
5696
|
buttonText: t('translations.status.stopText'),
|
|
4975
5697
|
srButtonText: t('translations.status.srStopText')
|
|
@@ -4983,6 +5705,7 @@ function TranslationsChatStatus() {
|
|
|
4983
5705
|
|
|
4984
5706
|
|
|
4985
5707
|
|
|
5708
|
+
|
|
4986
5709
|
;// CONCATENATED MODULE: ./src/javascripts/style-guide/components/static-core.js
|
|
4987
5710
|
const static_core_excluded = ["translations", "interrupt", "config"];
|
|
4988
5711
|
|
|
@@ -4999,6 +5722,7 @@ function static_core_objectWithoutPropertiesLoose(source, excluded) { if (source
|
|
|
4999
5722
|
|
|
5000
5723
|
|
|
5001
5724
|
|
|
5725
|
+
|
|
5002
5726
|
const bareApi = {
|
|
5003
5727
|
send: () => {},
|
|
5004
5728
|
reset: () => {
|
|
@@ -5012,6 +5736,7 @@ const bareApi = {
|
|
|
5012
5736
|
|
|
5013
5737
|
const SeamlyTestCore = ({
|
|
5014
5738
|
state,
|
|
5739
|
+
translations,
|
|
5015
5740
|
children
|
|
5016
5741
|
}) => {
|
|
5017
5742
|
const liveMsgRef = (0,hooks_namespaceObject.useRef)(() => {});
|
|
@@ -5030,10 +5755,11 @@ const SeamlyTestCore = ({
|
|
|
5030
5755
|
const newStore = (0,web_ui_namespaceObject.createReduxStore)({
|
|
5031
5756
|
reducers: {
|
|
5032
5757
|
state: stateReducer,
|
|
5758
|
+
[String(app_reducer)]: app_reducer,
|
|
5033
5759
|
[String(config_reducer)]: config_reducer,
|
|
5034
5760
|
[String(reducer)]: reducer,
|
|
5035
5761
|
[String(translations_reducer)]: translations_reducer,
|
|
5036
|
-
[String(
|
|
5762
|
+
[String(i18n_reducer)]: i18n_reducer,
|
|
5037
5763
|
[String(interrupt_reducer)]: interrupt_reducer
|
|
5038
5764
|
},
|
|
5039
5765
|
initialState: {
|
|
@@ -5043,8 +5769,9 @@ const SeamlyTestCore = ({
|
|
|
5043
5769
|
}
|
|
5044
5770
|
});
|
|
5045
5771
|
newStore.dispatch(initialize(configSlice || {}));
|
|
5772
|
+
newStore.dispatch(setLocale.fulfilled('en-GB', translations));
|
|
5046
5773
|
return newStore;
|
|
5047
|
-
}, [state]);
|
|
5774
|
+
}, [state, translations]);
|
|
5048
5775
|
return state && (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.StoreProvider, {
|
|
5049
5776
|
store: store,
|
|
5050
5777
|
children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.SeamlyEventBusContext.Provider, {
|
|
@@ -5696,7 +6423,7 @@ const imageMessage = {
|
|
|
5696
6423
|
description: 'Plaatje',
|
|
5697
6424
|
isZoomable: false,
|
|
5698
6425
|
type: 'image',
|
|
5699
|
-
url: 'https://
|
|
6426
|
+
url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg'
|
|
5700
6427
|
},
|
|
5701
6428
|
fromClient: false,
|
|
5702
6429
|
fromHistory: true,
|
|
@@ -5724,7 +6451,7 @@ const imageMessageWithLightbox = {
|
|
|
5724
6451
|
description: 'Plaatje',
|
|
5725
6452
|
isZoomable: true,
|
|
5726
6453
|
type: 'image',
|
|
5727
|
-
url: 'https://
|
|
6454
|
+
url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-portrait.jpg'
|
|
5728
6455
|
},
|
|
5729
6456
|
fromClient: false,
|
|
5730
6457
|
fromHistory: true,
|
|
@@ -5872,7 +6599,7 @@ const fileDownloadPayload = {
|
|
|
5872
6599
|
contentType: 'image/jpg',
|
|
5873
6600
|
filename: 'placeholder.jpg',
|
|
5874
6601
|
filesize: 991078,
|
|
5875
|
-
url: 'https://
|
|
6602
|
+
url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg'
|
|
5876
6603
|
}
|
|
5877
6604
|
};
|
|
5878
6605
|
const fileDownloadAgentMessage = {
|
|
@@ -6000,7 +6727,7 @@ const cardAskText = {
|
|
|
6000
6727
|
},
|
|
6001
6728
|
buttonText: 'Ask about pizzas!',
|
|
6002
6729
|
description: 'Pizza Margherita is a **typical Neapolitan pizza**.\n\nIt is made with San Marzano tomatoes, mozzarella cheese, fresh basil, salt, and extra-virgin olive oil.',
|
|
6003
|
-
image: 'https://
|
|
6730
|
+
image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-square.jpg',
|
|
6004
6731
|
title: 'Pizza Margherita'
|
|
6005
6732
|
}
|
|
6006
6733
|
}
|
|
@@ -6018,7 +6745,7 @@ const cardNavigate = {
|
|
|
6018
6745
|
},
|
|
6019
6746
|
buttonText: 'Order now!',
|
|
6020
6747
|
description: 'Pizza Margherita is a **typical Neapolitan pizza**.',
|
|
6021
|
-
image: 'https://
|
|
6748
|
+
image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-landscape.jpg',
|
|
6022
6749
|
title: 'Pizza Margherita'
|
|
6023
6750
|
}
|
|
6024
6751
|
}
|
|
@@ -6034,7 +6761,7 @@ const cardTopic = {
|
|
|
6034
6761
|
type: 'topic'
|
|
6035
6762
|
},
|
|
6036
6763
|
buttonText: 'Set topic! (title & description optional)',
|
|
6037
|
-
image: 'https://
|
|
6764
|
+
image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-portrait.jpg'
|
|
6038
6765
|
}
|
|
6039
6766
|
}
|
|
6040
6767
|
};
|
|
@@ -6311,9 +7038,9 @@ const standardState = {
|
|
|
6311
7038
|
showDisclaimer: true
|
|
6312
7039
|
})
|
|
6313
7040
|
}),
|
|
6314
|
-
|
|
7041
|
+
chatStatusBar: states_objectSpread(states_objectSpread({
|
|
6315
7042
|
category: categoryKeys.features,
|
|
6316
|
-
headingText: `
|
|
7043
|
+
headingText: `Chat status bar`,
|
|
6317
7044
|
description: ''
|
|
6318
7045
|
}, baseState), {}, {
|
|
6319
7046
|
options: {
|
|
@@ -7084,6 +7811,7 @@ function app_defineProperty(obj, key, value) { if (key in obj) { Object.definePr
|
|
|
7084
7811
|
const StyleGuideApp = ({
|
|
7085
7812
|
config,
|
|
7086
7813
|
styleGuideConfig,
|
|
7814
|
+
translations,
|
|
7087
7815
|
headingLevel = 2
|
|
7088
7816
|
}) => {
|
|
7089
7817
|
const [staticState, setStaticState] = (0,hooks_namespaceObject.useState)(null);
|
|
@@ -7215,7 +7943,7 @@ const StyleGuideApp = ({
|
|
|
7215
7943
|
}), (0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
7216
7944
|
children: showStyleGuide && (0,jsx_runtime_namespaceObject.jsx)(view, {
|
|
7217
7945
|
customComponents: styleGuideConfig.customComponents,
|
|
7218
|
-
translations:
|
|
7946
|
+
translations: translations,
|
|
7219
7947
|
state: staticState
|
|
7220
7948
|
})
|
|
7221
7949
|
})]
|
|
@@ -7252,7 +7980,6 @@ function style_guide_engine_objectWithoutPropertiesLoose(source, excluded) { if
|
|
|
7252
7980
|
|
|
7253
7981
|
|
|
7254
7982
|
|
|
7255
|
-
|
|
7256
7983
|
class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
|
|
7257
7984
|
constructor(_ref, externalApi) {
|
|
7258
7985
|
let {
|
|
@@ -7264,23 +7991,28 @@ class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
|
|
|
7264
7991
|
this.styleGuideConfig = styleGuideConfig || {};
|
|
7265
7992
|
}
|
|
7266
7993
|
|
|
7267
|
-
render() {
|
|
7994
|
+
async render() {
|
|
7268
7995
|
const restComponents = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config.customComponents || {}), {}, {
|
|
7269
7996
|
view: undefined
|
|
7270
7997
|
});
|
|
7271
7998
|
|
|
7999
|
+
const api = new web_ui_namespaceObject.API({
|
|
8000
|
+
namespace: this.config.namespace,
|
|
8001
|
+
config: this.config.api
|
|
8002
|
+
});
|
|
8003
|
+
api.URLS = {
|
|
8004
|
+
translations: `/client/${this.config.api.key}/translations/{version}/{locale}.json`
|
|
8005
|
+
};
|
|
8006
|
+
const translations = await api.getTranslations(this.config.context.locale || 'en-GB');
|
|
8007
|
+
|
|
7272
8008
|
const renderConfig = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config), {}, {
|
|
7273
|
-
customComponents: Object.keys(restComponents).length ? restComponents : undefined
|
|
7274
|
-
translations: this.config.translations || style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, (en_default())), {}, {
|
|
7275
|
-
disclaimer: style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, (en_default()).disclaimer), {}, {
|
|
7276
|
-
content: 'This chat session will be saved to help us improve our service delivery. <a href="https://seamly.ai/">More information</a>'
|
|
7277
|
-
})
|
|
7278
|
-
})
|
|
8009
|
+
customComponents: Object.keys(restComponents).length ? restComponents : undefined
|
|
7279
8010
|
});
|
|
7280
8011
|
|
|
7281
8012
|
(0,external_preact_namespaceObject.render)((0,jsx_runtime_namespaceObject.jsx)(app, {
|
|
7282
8013
|
config: renderConfig,
|
|
7283
|
-
styleGuideConfig: this.styleGuideConfig
|
|
8014
|
+
styleGuideConfig: this.styleGuideConfig,
|
|
8015
|
+
translations: translations
|
|
7284
8016
|
}), this.parentElement);
|
|
7285
8017
|
}
|
|
7286
8018
|
|