@seamly/web-ui 18.3.1 → 19.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/lib/index.debug.js +344 -69
- 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 +5241 -5181
- 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 +2332 -2225
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.LICENSE.txt +1 -1
- package/build/dist/lib/style-guide.js +1477 -791
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +26 -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 +24 -6
- 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 +35 -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 +58 -0
- package/src/javascripts/domains/i18n/selectors.js +15 -0
- package/src/javascripts/domains/i18n/utils.js +9 -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 +11 -8
- 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 +12 -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-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/defaults.js +0 -3
- 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
|
|
|
@@ -1165,13 +1149,6 @@ function createThunk(type, thunkCreator) {
|
|
|
1165
1149
|
|
|
1166
1150
|
return fn;
|
|
1167
1151
|
}
|
|
1168
|
-
function createDomain(domain) {
|
|
1169
|
-
return {
|
|
1170
|
-
createAction: prefixType(domain, createAction, DOMAIN_DELIMITER),
|
|
1171
|
-
createActions: prefixType(domain, createActions, DOMAIN_DELIMITER),
|
|
1172
|
-
createThunk: prefixType(domain, createThunk, DOMAIN_DELIMITER)
|
|
1173
|
-
};
|
|
1174
|
-
}
|
|
1175
1152
|
function createReducer(domain, handlers = {}, defaultState) {
|
|
1176
1153
|
const reducer = (state, action) => {
|
|
1177
1154
|
if (state === undefined) {
|
|
@@ -1187,12 +1164,44 @@ function createReducer(domain, handlers = {}, defaultState) {
|
|
|
1187
1164
|
|
|
1188
1165
|
return reducer;
|
|
1189
1166
|
}
|
|
1190
|
-
|
|
1167
|
+
function createDomain(domain) {
|
|
1168
|
+
return {
|
|
1169
|
+
createAction: prefixType(domain, createAction, DOMAIN_DELIMITER),
|
|
1170
|
+
createActions: prefixType(domain, createActions, DOMAIN_DELIMITER),
|
|
1171
|
+
createThunk: prefixType(domain, createThunk, DOMAIN_DELIMITER),
|
|
1172
|
+
createReducer: (handlers, defaultState) => createReducer(domain, handlers, defaultState),
|
|
1173
|
+
selectState: state => state[domain]
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/utils.js
|
|
1191
1177
|
|
|
1192
1178
|
const {
|
|
1193
|
-
createActions:
|
|
1179
|
+
createActions: utils_createActions,
|
|
1180
|
+
createReducer: utils_createReducer,
|
|
1181
|
+
selectState
|
|
1194
1182
|
} = createDomain('forms');
|
|
1195
|
-
|
|
1183
|
+
function utils_validate(values, schema = {}) {
|
|
1184
|
+
return Object.entries(schema).reduce((errors, [key, validations]) => {
|
|
1185
|
+
if (validations && !Array.isArray(validations)) {
|
|
1186
|
+
// eslint-disable-next-line no-param-reassign
|
|
1187
|
+
validations = [validations];
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
for (let i = 0; i < ((_validations = validations) === null || _validations === void 0 ? void 0 : _validations.length) ?? 0; i++) {
|
|
1191
|
+
var _validations;
|
|
1192
|
+
|
|
1193
|
+
if (!validations[i].fn(values[key], validations[i].compareValue)) {
|
|
1194
|
+
errors[key] = validations[i].errorText;
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
return errors;
|
|
1200
|
+
}, {});
|
|
1201
|
+
}
|
|
1202
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/actions.js
|
|
1203
|
+
|
|
1204
|
+
const [registerForm, deregisterForm] = utils_createActions('form', {
|
|
1196
1205
|
register: (formId, persistData) => ({
|
|
1197
1206
|
formId,
|
|
1198
1207
|
persistData
|
|
@@ -1201,7 +1210,7 @@ const [registerForm, deregisterForm] = actions_createActions('form', {
|
|
|
1201
1210
|
formId
|
|
1202
1211
|
})
|
|
1203
1212
|
});
|
|
1204
|
-
const [registerControl, deregisterControl, updateControlValue, updateControlTouched] =
|
|
1213
|
+
const [registerControl, deregisterControl, updateControlValue, updateControlTouched] = utils_createActions('control', {
|
|
1205
1214
|
register: (formId, name) => ({
|
|
1206
1215
|
formId,
|
|
1207
1216
|
name
|
|
@@ -1355,119 +1364,11 @@ const arrayContentEquals = (a, b) => {
|
|
|
1355
1364
|
return a.every((value, idx) => b[idx] === value);
|
|
1356
1365
|
};
|
|
1357
1366
|
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
|
-
const formState = persistData ? state[formId] ?? reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1396
|
-
persistData
|
|
1397
|
-
}) : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1398
|
-
persistData
|
|
1399
|
-
});
|
|
1400
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1401
|
-
[formId]: formState
|
|
1402
|
-
});
|
|
1403
|
-
},
|
|
1404
|
-
[deregisterForm]: (state, {
|
|
1405
|
-
formId
|
|
1406
|
-
}) => {
|
|
1407
|
-
var _newState$formId;
|
|
1408
|
-
|
|
1409
|
-
const newState = reducer_objectSpread({}, state);
|
|
1410
|
-
|
|
1411
|
-
if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
|
|
1412
|
-
delete newState[formId];
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
return newState;
|
|
1416
|
-
},
|
|
1417
|
-
// Form control handlers
|
|
1418
|
-
[registerControl]: (state, {
|
|
1419
|
-
name,
|
|
1420
|
-
formId
|
|
1421
|
-
}) => {
|
|
1422
|
-
return updateFormControl(state, formId, name);
|
|
1423
|
-
},
|
|
1424
|
-
[deregisterControl]: (state, {
|
|
1425
|
-
formId,
|
|
1426
|
-
name
|
|
1427
|
-
}) => {
|
|
1428
|
-
const form = state[formId];
|
|
1429
|
-
|
|
1430
|
-
if (!form) {
|
|
1431
|
-
return state;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
if (form.persistData) {
|
|
1435
|
-
return state;
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
const controls = reducer_objectSpread({}, form.controls);
|
|
1439
|
-
|
|
1440
|
-
delete controls[name];
|
|
1441
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1442
|
-
[formId]: reducer_objectSpread(reducer_objectSpread({}, form), {}, {
|
|
1443
|
-
controls
|
|
1444
|
-
})
|
|
1445
|
-
});
|
|
1446
|
-
},
|
|
1447
|
-
[updateControlValue]: (state, {
|
|
1448
|
-
formId,
|
|
1449
|
-
name,
|
|
1450
|
-
value
|
|
1451
|
-
}) => {
|
|
1452
|
-
return updateFormControl(state, formId, name, {
|
|
1453
|
-
value
|
|
1454
|
-
});
|
|
1455
|
-
},
|
|
1456
|
-
[updateControlTouched]: (state, {
|
|
1457
|
-
formId,
|
|
1458
|
-
name,
|
|
1459
|
-
touched
|
|
1460
|
-
}) => {
|
|
1461
|
-
return updateFormControl(state, formId, name, {
|
|
1462
|
-
touched
|
|
1463
|
-
});
|
|
1464
|
-
}
|
|
1465
|
-
}, reducer_initialState));
|
|
1466
1367
|
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/selectors.js
|
|
1467
1368
|
|
|
1468
1369
|
|
|
1469
1370
|
|
|
1470
|
-
const getState =
|
|
1371
|
+
const getState = selectState;
|
|
1471
1372
|
const selectors_getFormById = createSelector(getState, getPropSelector('formId'), (forms, formId) => forms[formId]);
|
|
1472
1373
|
const getFormControlsByFormId = createSelector(selectors_getFormById, form => (form === null || form === void 0 ? void 0 : form.controls) || {});
|
|
1473
1374
|
const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId, controls => {
|
|
@@ -1529,6 +1430,7 @@ function hooks_useSelector(selector, deps = []) {
|
|
|
1529
1430
|
const valueRef = useRef(); // instead of accepting a stabilized selector, we stick to the signature
|
|
1530
1431
|
// of useCallback, as that makes the exposed api much more dev-friendly
|
|
1531
1432
|
// otherwise you'd have to stabilize selectors externally
|
|
1433
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1532
1434
|
|
|
1533
1435
|
const selectorCb = useCallback(selector, deps); // we're keeping the selector in a ref to compare against
|
|
1534
1436
|
// we need this both in the store subscription and for
|
|
@@ -1778,6 +1680,114 @@ function provider_FormProvider(_ref) {
|
|
|
1778
1680
|
children: children
|
|
1779
1681
|
}));
|
|
1780
1682
|
}
|
|
1683
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/reducer.js
|
|
1684
|
+
function reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1685
|
+
|
|
1686
|
+
function reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reducer_ownKeys(Object(source), true).forEach(function (key) { reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1687
|
+
|
|
1688
|
+
function reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1689
|
+
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
const reducer_initialState = {};
|
|
1693
|
+
const initialFormState = {
|
|
1694
|
+
controls: {}
|
|
1695
|
+
};
|
|
1696
|
+
const initialControlState = {
|
|
1697
|
+
value: '',
|
|
1698
|
+
touched: false
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1701
|
+
function updateFormControl(state, formId, name, controlState) {
|
|
1702
|
+
var _state$formId;
|
|
1703
|
+
|
|
1704
|
+
const currentControlState = ((_state$formId = state[formId]) === null || _state$formId === void 0 ? void 0 : _state$formId.controls[name]) || initialControlState;
|
|
1705
|
+
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1706
|
+
[formId]: reducer_objectSpread(reducer_objectSpread({}, state[formId]), {}, {
|
|
1707
|
+
controls: reducer_objectSpread(reducer_objectSpread({}, state[formId].controls), {}, {
|
|
1708
|
+
[name]: reducer_objectSpread(reducer_objectSpread({}, currentControlState), controlState)
|
|
1709
|
+
})
|
|
1710
|
+
})
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
/* harmony default export */ const reducer = (utils_createReducer({
|
|
1715
|
+
// Form handlers
|
|
1716
|
+
[registerForm]: (state, {
|
|
1717
|
+
formId,
|
|
1718
|
+
persistData
|
|
1719
|
+
}) => {
|
|
1720
|
+
const formState = persistData ? state[formId] ?? reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1721
|
+
persistData
|
|
1722
|
+
}) : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1723
|
+
persistData
|
|
1724
|
+
});
|
|
1725
|
+
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1726
|
+
[formId]: formState
|
|
1727
|
+
});
|
|
1728
|
+
},
|
|
1729
|
+
[deregisterForm]: (state, {
|
|
1730
|
+
formId
|
|
1731
|
+
}) => {
|
|
1732
|
+
var _newState$formId;
|
|
1733
|
+
|
|
1734
|
+
const newState = reducer_objectSpread({}, state);
|
|
1735
|
+
|
|
1736
|
+
if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
|
|
1737
|
+
delete newState[formId];
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
return newState;
|
|
1741
|
+
},
|
|
1742
|
+
// Form control handlers
|
|
1743
|
+
[registerControl]: (state, {
|
|
1744
|
+
name,
|
|
1745
|
+
formId
|
|
1746
|
+
}) => {
|
|
1747
|
+
return updateFormControl(state, formId, name);
|
|
1748
|
+
},
|
|
1749
|
+
[deregisterControl]: (state, {
|
|
1750
|
+
formId,
|
|
1751
|
+
name
|
|
1752
|
+
}) => {
|
|
1753
|
+
const form = state[formId];
|
|
1754
|
+
|
|
1755
|
+
if (!form) {
|
|
1756
|
+
return state;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
if (form.persistData) {
|
|
1760
|
+
return state;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
const controls = reducer_objectSpread({}, form.controls);
|
|
1764
|
+
|
|
1765
|
+
delete controls[name];
|
|
1766
|
+
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1767
|
+
[formId]: reducer_objectSpread(reducer_objectSpread({}, form), {}, {
|
|
1768
|
+
controls
|
|
1769
|
+
})
|
|
1770
|
+
});
|
|
1771
|
+
},
|
|
1772
|
+
[updateControlValue]: (state, {
|
|
1773
|
+
formId,
|
|
1774
|
+
name,
|
|
1775
|
+
value
|
|
1776
|
+
}) => {
|
|
1777
|
+
return updateFormControl(state, formId, name, {
|
|
1778
|
+
value
|
|
1779
|
+
});
|
|
1780
|
+
},
|
|
1781
|
+
[updateControlTouched]: (state, {
|
|
1782
|
+
formId,
|
|
1783
|
+
name,
|
|
1784
|
+
touched
|
|
1785
|
+
}) => {
|
|
1786
|
+
return updateFormControl(state, formId, name, {
|
|
1787
|
+
touched
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
}, reducer_initialState));
|
|
1781
1791
|
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/index.js
|
|
1782
1792
|
|
|
1783
1793
|
|
|
@@ -1785,18 +1795,22 @@ function provider_FormProvider(_ref) {
|
|
|
1785
1795
|
|
|
1786
1796
|
|
|
1787
1797
|
|
|
1788
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/
|
|
1798
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
1789
1799
|
|
|
1790
1800
|
const {
|
|
1791
|
-
createActions:
|
|
1801
|
+
createActions: translations_utils_createActions,
|
|
1802
|
+
createReducer: translations_utils_createReducer,
|
|
1803
|
+
selectState: utils_selectState
|
|
1792
1804
|
} = createDomain('translations');
|
|
1793
|
-
|
|
1805
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
1806
|
+
|
|
1807
|
+
const [enable, disable] = translations_utils_createActions('translate', {
|
|
1794
1808
|
enable: locale => ({
|
|
1795
1809
|
locale
|
|
1796
1810
|
}),
|
|
1797
1811
|
disable: () => ({})
|
|
1798
1812
|
});
|
|
1799
|
-
const [enableEvent, disableEvent] =
|
|
1813
|
+
const [enableEvent, disableEvent] = translations_utils_createActions('event', {
|
|
1800
1814
|
enable: payloadId => ({
|
|
1801
1815
|
payloadId
|
|
1802
1816
|
}),
|
|
@@ -1804,93 +1818,11 @@ const [enableEvent, disableEvent] = translations_actions_createActions('event',
|
|
|
1804
1818
|
payloadId
|
|
1805
1819
|
})
|
|
1806
1820
|
});
|
|
1807
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/
|
|
1808
|
-
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; }
|
|
1809
|
-
|
|
1810
|
-
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; }
|
|
1811
|
-
|
|
1812
|
-
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; }
|
|
1821
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/selectors.js
|
|
1813
1822
|
|
|
1814
1823
|
|
|
1815
1824
|
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
const translations_reducer_initialState = {
|
|
1819
|
-
isActive: false,
|
|
1820
|
-
currentLocale: undefined,
|
|
1821
|
-
isAvailable: false,
|
|
1822
|
-
languages: [],
|
|
1823
|
-
originalPayloadIds: [],
|
|
1824
|
-
containerId: id_randomId()
|
|
1825
|
-
};
|
|
1826
|
-
/* harmony default export */ const translations_reducer = (createReducer('translations', {
|
|
1827
|
-
[seamly_utils_seamlyActions.SET_FEATURES]: (state, action) => {
|
|
1828
|
-
var _action$features;
|
|
1829
|
-
|
|
1830
|
-
const feature = action === null || action === void 0 ? void 0 : (_action$features = action.features) === null || _action$features === void 0 ? void 0 : _action$features.translation;
|
|
1831
|
-
|
|
1832
|
-
if (!feature) {
|
|
1833
|
-
return state;
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1837
|
-
isAvailable: feature.enabled === true,
|
|
1838
|
-
languages: feature.languages || []
|
|
1839
|
-
});
|
|
1840
|
-
},
|
|
1841
|
-
[seamly_utils_seamlyActions.SET_HISTORY]: (state, {
|
|
1842
|
-
history
|
|
1843
|
-
}) => {
|
|
1844
|
-
var _history$translation, _history$translation2;
|
|
1845
|
-
|
|
1846
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1847
|
-
isActive: history === null || history === void 0 ? void 0 : (_history$translation = history.translation) === null || _history$translation === void 0 ? void 0 : _history$translation.enabled,
|
|
1848
|
-
currentLocale: history === null || history === void 0 ? void 0 : (_history$translation2 = history.translation) === null || _history$translation2 === void 0 ? void 0 : _history$translation2.locale
|
|
1849
|
-
});
|
|
1850
|
-
},
|
|
1851
|
-
[seamly_utils_seamlyActions.CLEAR_FEATURES]: () => translations_reducer_initialState,
|
|
1852
|
-
[enable]: (state, {
|
|
1853
|
-
locale
|
|
1854
|
-
}) => {
|
|
1855
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1856
|
-
isActive: true,
|
|
1857
|
-
currentLocale: locale
|
|
1858
|
-
});
|
|
1859
|
-
},
|
|
1860
|
-
[disable]: state => {
|
|
1861
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1862
|
-
isActive: false,
|
|
1863
|
-
currentLocale: undefined
|
|
1864
|
-
});
|
|
1865
|
-
},
|
|
1866
|
-
[enableEvent]: (state, {
|
|
1867
|
-
payloadId
|
|
1868
|
-
}) => {
|
|
1869
|
-
if (!state.originalPayloadIds.includes(payloadId)) {
|
|
1870
|
-
return state;
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1874
|
-
originalPayloadIds: state.originalPayloadIds.filter(id => id !== payloadId)
|
|
1875
|
-
});
|
|
1876
|
-
},
|
|
1877
|
-
[disableEvent]: (state, {
|
|
1878
|
-
payloadId
|
|
1879
|
-
}) => {
|
|
1880
|
-
if (state.originalPayloadIds.includes(payloadId)) {
|
|
1881
|
-
return state;
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1885
|
-
originalPayloadIds: [...state.originalPayloadIds, payloadId]
|
|
1886
|
-
});
|
|
1887
|
-
}
|
|
1888
|
-
}, translations_reducer_initialState));
|
|
1889
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/selectors.js
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
const selectors_getState = state => state[String(translations_reducer)];
|
|
1825
|
+
const selectors_getState = utils_selectState;
|
|
1894
1826
|
const getOriginalPayloadIds = createSelector(selectors_getState, state => state.originalPayloadIds);
|
|
1895
1827
|
const getIsPayloadTranslated = createSelector(getOriginalPayloadIds, getPropSelector('payloadId'), (payloadIds, payloadId) => !payloadIds.includes(payloadId));
|
|
1896
1828
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-api-context.js
|
|
@@ -1920,23 +1852,81 @@ const seamly_api_hooks_useSeamlyHasConversation = () => {
|
|
|
1920
1852
|
const url = useSeamlyConversationUrl();
|
|
1921
1853
|
return !!url;
|
|
1922
1854
|
};
|
|
1923
|
-
|
|
1924
|
-
const {
|
|
1925
|
-
get
|
|
1926
|
-
} = seamly_api_hooks_useSeamlyObjectStore();
|
|
1927
|
-
return get ? !!get('userResponded') : false;
|
|
1928
|
-
};
|
|
1929
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
|
|
1855
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/utils.js
|
|
1930
1856
|
|
|
1931
1857
|
const {
|
|
1932
|
-
createAction:
|
|
1858
|
+
createAction: utils_createAction,
|
|
1859
|
+
createThunk: utils_createThunk,
|
|
1860
|
+
createReducer: config_utils_createReducer,
|
|
1861
|
+
selectState: config_utils_selectState
|
|
1933
1862
|
} = createDomain('config');
|
|
1934
|
-
|
|
1863
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
|
|
1864
|
+
|
|
1865
|
+
const initialize = utils_createAction('initialize', config => ({
|
|
1935
1866
|
config
|
|
1936
1867
|
}));
|
|
1937
|
-
const update =
|
|
1868
|
+
const update = utils_createAction('update', config => ({
|
|
1938
1869
|
config
|
|
1939
1870
|
}));
|
|
1871
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/selectors.js
|
|
1872
|
+
function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1873
|
+
|
|
1874
|
+
function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { selectors_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1875
|
+
|
|
1876
|
+
function selectors_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1877
|
+
|
|
1878
|
+
|
|
1879
|
+
|
|
1880
|
+
|
|
1881
|
+
const selectConfig = createSelector(config_utils_selectState, config => {
|
|
1882
|
+
let newConfig = selectors_objectSpread({
|
|
1883
|
+
visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized,
|
|
1884
|
+
appContainerClassNames: config.appContainerClassNames || []
|
|
1885
|
+
}, config);
|
|
1886
|
+
|
|
1887
|
+
if (typeof newConfig.appContainerClassNames === 'function') {
|
|
1888
|
+
newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
|
|
1889
|
+
appContainerClassNames: newConfig.appContainerClassNames(newConfig)
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
return newConfig;
|
|
1894
|
+
});
|
|
1895
|
+
|
|
1896
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
function hooks_useConfig() {
|
|
1900
|
+
return useSelector(Selectors.selectConfig);
|
|
1901
|
+
}
|
|
1902
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
|
|
1903
|
+
|
|
1904
|
+
|
|
1905
|
+
function createMiddleware() {
|
|
1906
|
+
return ({
|
|
1907
|
+
dispatch
|
|
1908
|
+
}) => next => action => {
|
|
1909
|
+
var _action$config, _action$config$defaul;
|
|
1910
|
+
|
|
1911
|
+
const result = next(action);
|
|
1912
|
+
|
|
1913
|
+
switch (action.type) {
|
|
1914
|
+
case String(Actions.initialize):
|
|
1915
|
+
case String(Actions.update):
|
|
1916
|
+
if (action !== null && action !== void 0 && (_action$config = action.config) !== null && _action$config !== void 0 && (_action$config$defaul = _action$config.defaults) !== null && _action$config$defaul !== void 0 && _action$config$defaul.agentName) {
|
|
1917
|
+
var _action$config2, _action$config2$defau;
|
|
1918
|
+
|
|
1919
|
+
dispatch({
|
|
1920
|
+
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
1921
|
+
title: action === null || action === void 0 ? void 0 : (_action$config2 = action.config) === null || _action$config2 === void 0 ? void 0 : (_action$config2$defau = _action$config2.defaults) === null || _action$config2$defau === void 0 ? void 0 : _action$config2$defau.agentName
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
return result;
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1940
1930
|
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
1941
1931
|
const CSS_NAME = 'cvco';
|
|
1942
1932
|
const apiVersion = '2';
|
|
@@ -1949,7 +1939,9 @@ const config_screenReaderDebounceDelaySeconds = 10;
|
|
|
1949
1939
|
const activitySendDelay = 15000;
|
|
1950
1940
|
const maxCharacterWarningLimit = 50;
|
|
1951
1941
|
const maxCharacterSrDebounceDelay = 300;
|
|
1952
|
-
const config_defaultTransitionTimeMs = 300;
|
|
1942
|
+
const config_defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
|
|
1943
|
+
|
|
1944
|
+
const config_typingTimeout = 2000;
|
|
1953
1945
|
const defaultConfig = {
|
|
1954
1946
|
namespace: 'default',
|
|
1955
1947
|
layoutMode: 'window',
|
|
@@ -1971,14 +1963,10 @@ const defaultConfig = {
|
|
|
1971
1963
|
|
|
1972
1964
|
}
|
|
1973
1965
|
},
|
|
1974
|
-
typing: {
|
|
1975
|
-
timeout: 2000 // How long to wait before we decide the user isn't typing
|
|
1976
|
-
|
|
1977
|
-
},
|
|
1978
1966
|
appContainerClassNames: config => [`app--layout-${config.layoutMode}`, `namespace--${config.namespace}`]
|
|
1979
1967
|
};
|
|
1980
1968
|
;// CONCATENATED MODULE: ./src/javascripts/domains/config/reducer.js
|
|
1981
|
-
const reducer_excluded = ["messages"
|
|
1969
|
+
const reducer_excluded = ["messages"];
|
|
1982
1970
|
|
|
1983
1971
|
function reducer_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = reducer_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1984
1972
|
|
|
@@ -2003,15 +1991,14 @@ const config_reducer_initialState = config_reducer_objectSpread(config_reducer_o
|
|
|
2003
1991
|
defaults: {}
|
|
2004
1992
|
});
|
|
2005
1993
|
|
|
2006
|
-
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', '
|
|
1994
|
+
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback'];
|
|
2007
1995
|
|
|
2008
1996
|
const updateState = (state, {
|
|
2009
1997
|
config
|
|
2010
1998
|
}) => {
|
|
2011
1999
|
const _pick = pick(config, configKeys),
|
|
2012
2000
|
{
|
|
2013
|
-
messages
|
|
2014
|
-
typing
|
|
2001
|
+
messages
|
|
2015
2002
|
} = _pick,
|
|
2016
2003
|
partialConfig = reducer_objectWithoutProperties(_pick, reducer_excluded);
|
|
2017
2004
|
|
|
@@ -2027,16 +2014,10 @@ const updateState = (state, {
|
|
|
2027
2014
|
});
|
|
2028
2015
|
}
|
|
2029
2016
|
|
|
2030
|
-
if (typing) {
|
|
2031
|
-
newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), {}, {
|
|
2032
|
-
typing: config_reducer_objectSpread(config_reducer_objectSpread({}, newState.typing), typing)
|
|
2033
|
-
});
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
2017
|
return newState;
|
|
2037
2018
|
};
|
|
2038
2019
|
|
|
2039
|
-
/* harmony default export */ const config_reducer = (
|
|
2020
|
+
/* harmony default export */ const config_reducer = (config_utils_createReducer({
|
|
2040
2021
|
[initialize]: (state, action) => {
|
|
2041
2022
|
return updateState(state, action);
|
|
2042
2023
|
},
|
|
@@ -2044,448 +2025,80 @@ const updateState = (state, {
|
|
|
2044
2025
|
return updateState(state, action);
|
|
2045
2026
|
}
|
|
2046
2027
|
}, config_reducer_initialState));
|
|
2047
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/
|
|
2048
|
-
function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2049
|
-
|
|
2050
|
-
function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { selectors_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2051
|
-
|
|
2052
|
-
function selectors_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2028
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
2056
2029
|
|
|
2057
|
-
const selectState = state => state[String(config_reducer)];
|
|
2058
|
-
const selectConfig = createSelector(selectState, config => {
|
|
2059
|
-
let newConfig = selectors_objectSpread({
|
|
2060
|
-
visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized,
|
|
2061
|
-
appContainerClassNames: config.appContainerClassNames || []
|
|
2062
|
-
}, config);
|
|
2063
2030
|
|
|
2064
|
-
if (typeof newConfig.appContainerClassNames === 'function') {
|
|
2065
|
-
newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
|
|
2066
|
-
appContainerClassNames: newConfig.appContainerClassNames(newConfig)
|
|
2067
|
-
});
|
|
2068
|
-
}
|
|
2069
2031
|
|
|
2070
|
-
return newConfig;
|
|
2071
|
-
});
|
|
2072
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
|
|
2073
2032
|
|
|
2074
2033
|
|
|
2075
|
-
function hooks_useConfig() {
|
|
2076
|
-
return useSelector(Selectors.selectConfig);
|
|
2077
|
-
}
|
|
2078
|
-
;// CONCATENATED MODULE: ./translations/en.js
|
|
2079
|
-
// Please note: All texts containing the string 'srText' are short for
|
|
2080
|
-
// Screen Reader Text. These texts are invisible on screen but broadcast
|
|
2081
|
-
// to screen readers. Avoid undue verbosity, but ensure that a user who cannot
|
|
2082
|
-
// see the screen will get both the message content as well as the context
|
|
2083
|
-
// in which the message occurred if not already clear from the current
|
|
2084
|
-
// position of the keyboard focus.
|
|
2085
|
-
// Example: An error occurs in the chat window and this error has an 'srText'
|
|
2086
|
-
// entry. Because the error could occur while the user is NOT chatting in the window,
|
|
2087
|
-
// add context such as "Something went wrong with the chat session" as just saying
|
|
2088
|
-
// "Something went wrong" would not be clear enough for users who cannot see the
|
|
2089
|
-
// source of the error on screen.
|
|
2090
|
-
/* harmony default export */ const en = ({
|
|
2091
|
-
'carousel.controls.next': 'Next',
|
|
2092
|
-
'carousel.controls.previous': 'Previous',
|
|
2093
|
-
'carousel.slide.label': ({
|
|
2094
|
-
index,
|
|
2095
|
-
total
|
|
2096
|
-
}) => `${index} of ${total}`,
|
|
2097
|
-
'dateTime.srText': ({
|
|
2098
|
-
date,
|
|
2099
|
-
time
|
|
2100
|
-
}) => `Messages starting ${date} at ${time}:`,
|
|
2101
|
-
'dateTime.today': 'Today',
|
|
2102
|
-
'dateTime.yesterday': 'Yesterday',
|
|
2103
|
-
'disclaimer.content': 'This chat session will be saved to help us improve our service delivery.',
|
|
2104
|
-
'disclaimer.title': 'Privacy disclaimer',
|
|
2105
|
-
'dividerKeys.newTopic': 'New topic started.',
|
|
2106
|
-
'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
|
|
2107
|
-
'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
|
|
2108
|
-
'errors.configError.title': 'Chat configuration error.',
|
|
2109
|
-
'errors.general.buttonText': 'Restart chat',
|
|
2110
|
-
'errors.general.message': 'Do you want to start a new chat session?',
|
|
2111
|
-
'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
|
|
2112
|
-
'errors.general.title': 'Something went wrong',
|
|
2113
|
-
'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.',
|
|
2114
|
-
'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.',
|
|
2115
|
-
'errors.seamlyOffline.title': 'Connection issues',
|
|
2116
|
-
'faq.headingText': 'Suggested topics',
|
|
2117
|
-
'faq.srAvailableText': 'Suggested topics are available in the chat.',
|
|
2118
|
-
'faq.srUnavailableText': 'Suggested topics are no longer available in the chat.',
|
|
2119
|
-
'faq.srUpdatedText': 'There are new suggested topics in the chat.',
|
|
2120
|
-
'fileUpload.cancelButtonText': 'Cancel upload',
|
|
2121
|
-
'fileUpload.contentHint': size => `Select a file of maximum ${size}`,
|
|
2122
|
-
'fileUpload.errors.general': 'Something went wrong with the upload. Please cancel the upload and try again.',
|
|
2123
|
-
'fileUpload.errors.noFile': 'Please select a file to upload',
|
|
2124
|
-
'fileUpload.errors.tooLarge': 'The selected file is too large, please upload a smaller file',
|
|
2125
|
-
'fileUpload.errors.unavailable': 'Uploading files is no longer possible. Please cancel the upload and try again later.',
|
|
2126
|
-
'fileUpload.errors.virusFound': 'The selected file is unsafe, please upload a different file.',
|
|
2127
|
-
'fileUpload.errors.wrongType': 'The selected file type is not supported. Please cancel the upload and upload a different file.',
|
|
2128
|
-
'fileUpload.fileUnavailableText': 'This download link has expired',
|
|
2129
|
-
'fileUpload.labelText': 'Select file',
|
|
2130
|
-
'fileUpload.selectedText': fileName => {
|
|
2131
|
-
if (fileName) {
|
|
2132
|
-
return fileName;
|
|
2133
|
-
} else {
|
|
2134
|
-
return 'No file selected';
|
|
2135
|
-
}
|
|
2136
|
-
},
|
|
2137
|
-
'fileUpload.srAvailableText': 'File uploads are now available in the chat.',
|
|
2138
|
-
'fileUpload.srCompleteText': 'Upload complete.',
|
|
2139
|
-
'fileUpload.srFileDownloadText': fileName => `Download file ${fileName}.`,
|
|
2140
|
-
'fileUpload.srFileUploadedText': fileName => `Uploaded file ${fileName}.`,
|
|
2141
|
-
'fileUpload.srProgressLabel': fileName => `${fileName} upload progress status`,
|
|
2142
|
-
'fileUpload.srStartedText': 'Upload started.',
|
|
2143
|
-
'fileUpload.srUnavailableText': 'File uploads in the chat are no longer available.',
|
|
2144
|
-
'fileUpload.toggleButtonText': 'Upload files',
|
|
2145
|
-
'fileUpload.uploadButtonText': 'Upload file',
|
|
2146
|
-
'header.collapseApp': 'collapse chat',
|
|
2147
|
-
'header.title': 'You\'re talking to',
|
|
2148
|
-
'idleDetachWarning.continueButton': 'Continue conversation',
|
|
2149
|
-
'idleDetachWarning.countdownText': 'Your conversation will automatically end in:',
|
|
2150
|
-
'idleDetachWarning.countdownTimer': ({
|
|
2151
|
-
minutes,
|
|
2152
|
-
seconds
|
|
2153
|
-
}) => {
|
|
2154
|
-
switch (minutes) {
|
|
2155
|
-
case 1:
|
|
2156
|
-
switch (seconds) {
|
|
2157
|
-
case 1:
|
|
2158
|
-
return '1 minute, 1 second';
|
|
2159
2034
|
|
|
2160
|
-
|
|
2161
|
-
|
|
2035
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
2036
|
+
function seamly_state_hooks_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2162
2037
|
|
|
2163
|
-
|
|
2164
|
-
return `1 minute, ${seconds} seconds`;
|
|
2165
|
-
}
|
|
2038
|
+
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; }
|
|
2166
2039
|
|
|
2167
|
-
|
|
2168
|
-
switch (seconds) {
|
|
2169
|
-
case 1:
|
|
2170
|
-
return '1 second';
|
|
2040
|
+
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; }
|
|
2171
2041
|
|
|
2172
|
-
case 0:
|
|
2173
|
-
default:
|
|
2174
|
-
return `${seconds} seconds`;
|
|
2175
|
-
}
|
|
2176
2042
|
|
|
2177
|
-
default:
|
|
2178
|
-
switch (seconds) {
|
|
2179
|
-
case 1:
|
|
2180
|
-
return `${minutes} minutes, 1 second`;
|
|
2181
2043
|
|
|
2182
|
-
case 0:
|
|
2183
|
-
return `${minutes} minutes`;
|
|
2184
2044
|
|
|
2185
|
-
default:
|
|
2186
|
-
return `${minutes} minutes, ${seconds} seconds`;
|
|
2187
|
-
}
|
|
2188
2045
|
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
'info.cobrowsing.cobrowsingEnded': 'Screen sharing has ended',
|
|
2196
|
-
'info.cobrowsing.cobrowsingStarted': 'Screen sharing is now enabled. The agent can see the page you\'re currently on',
|
|
2197
|
-
'info.sendTranscript.accepted': ({
|
|
2198
|
-
emailAddress
|
|
2199
|
-
}) => `A transcript will be sent to ${emailAddress}`,
|
|
2200
|
-
'input.inputLabel': limit => {
|
|
2201
|
-
if (limit) {
|
|
2202
|
-
return `Your message (max. ${limit} characters)`;
|
|
2203
|
-
}
|
|
2046
|
+
const seamly_state_hooks_selectState = state => state.state;
|
|
2047
|
+
const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
|
|
2048
|
+
const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
|
|
2049
|
+
events
|
|
2050
|
+
}, config) => {
|
|
2051
|
+
var _config$messages;
|
|
2204
2052
|
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
return `Your message (max. ${limit} characters)`;
|
|
2210
|
-
}
|
|
2053
|
+
const {
|
|
2054
|
+
enabled,
|
|
2055
|
+
threshold
|
|
2056
|
+
} = (config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) ?? {};
|
|
2211
2057
|
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
'input.srCharacterLimitText': limit => {
|
|
2216
|
-
switch (limit) {
|
|
2217
|
-
case 1:
|
|
2218
|
-
return '1 character remaining.';
|
|
2219
|
-
|
|
2220
|
-
case 0:
|
|
2221
|
-
default:
|
|
2222
|
-
return `${limit} characters remaining.`;
|
|
2223
|
-
}
|
|
2224
|
-
},
|
|
2225
|
-
'lightbox.closeLabel': 'Close',
|
|
2226
|
-
'lightbox.heading': 'Enlarged chat image',
|
|
2227
|
-
'message.choicePrompts.cancelChooseAgain': 'Cancel choice change',
|
|
2228
|
-
'message.choicePrompts.chooseAgain': 'Change your choice',
|
|
2229
|
-
'message.image.srTextEnlargeButtonLabel': ({
|
|
2230
|
-
description
|
|
2231
|
-
}) => `Enlarge ${description}`,
|
|
2232
|
-
'message.srNewEventCount': ({
|
|
2233
|
-
newCount
|
|
2234
|
-
}) => {
|
|
2235
|
-
switch (newCount) {
|
|
2236
|
-
case 1:
|
|
2237
|
-
return `There is 1 new chat message.`;
|
|
2058
|
+
if (!enabled) {
|
|
2059
|
+
return events;
|
|
2060
|
+
}
|
|
2238
2061
|
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2062
|
+
const mappedEvents = [];
|
|
2063
|
+
let previousEvent = null;
|
|
2064
|
+
events.forEach((event, idx) => {
|
|
2065
|
+
// always add timeIndicator to first message
|
|
2066
|
+
if (idx === 0) {
|
|
2067
|
+
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2068
|
+
timeIndicator: event.payload.occurredAt
|
|
2069
|
+
})); // else check if diff is greater than threshold
|
|
2070
|
+
} else {
|
|
2071
|
+
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
2072
|
+
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2073
|
+
timeIndicator
|
|
2074
|
+
}));
|
|
2242
2075
|
}
|
|
2243
|
-
},
|
|
2244
|
-
'message.srTextUnreadCount': ({
|
|
2245
|
-
unreadCount
|
|
2246
|
-
}) => {
|
|
2247
|
-
switch (unreadCount) {
|
|
2248
|
-
case 1:
|
|
2249
|
-
return `There is 1 new unread chat message.`;
|
|
2250
2076
|
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
}
|
|
2255
|
-
},
|
|
2256
|
-
'options.cancelButtonText': 'Cancel',
|
|
2257
|
-
'options.cobrowsing.cobrowsingActiveText': 'Sharing screen',
|
|
2258
|
-
'options.cobrowsing.cobrowsingUnavailable': 'Screen sharing is currently unavailable.',
|
|
2259
|
-
'options.cobrowsing.description': 'This allows the agent to see the page you\'re currently on. Nothing else is shared.',
|
|
2260
|
-
'options.cobrowsing.labelTurnOff': 'Turn screen sharing off',
|
|
2261
|
-
'options.cobrowsing.labelTurnOn': 'Turn screen sharing on',
|
|
2262
|
-
'options.cobrowsing.menuTitle': 'Screen sharing',
|
|
2263
|
-
'options.cobrowsing.srCobrowsingAvailable': 'Screen sharing is now available.',
|
|
2264
|
-
'options.cobrowsing.srStartedCobrowsingText': 'Screen sharing has been started.',
|
|
2265
|
-
'options.cobrowsing.srStopCobrowsingText': 'Stop screen sharing',
|
|
2266
|
-
'options.cobrowsing.srStoppedCobrowsingText': 'Screen sharing has been stopped.',
|
|
2267
|
-
'options.cobrowsing.stopCobrowsingText': 'Stop',
|
|
2268
|
-
'options.cobrowsing.title': 'Share my screen',
|
|
2269
|
-
'options.openButtonText': 'Options',
|
|
2270
|
-
'options.saveButtonText': 'Save',
|
|
2271
|
-
'options.sendTranscript.description': 'Enter the email address you would like to send the chat transcript to.',
|
|
2272
|
-
'options.sendTranscript.invalidEmailText': 'Please enter a valid email address',
|
|
2273
|
-
'options.sendTranscript.label': 'Email address',
|
|
2274
|
-
'options.sendTranscript.menuTitle': 'Send transcript',
|
|
2275
|
-
'options.sendTranscript.noEmailText': 'Please enter an email address',
|
|
2276
|
-
'options.sendTranscript.sendButtonText': 'Send',
|
|
2277
|
-
'options.sendTranscript.title': 'Send chat transcript',
|
|
2278
|
-
'options.unavailableText': 'unavailable',
|
|
2279
|
-
'resumeConversationPrompt.continueButton': 'Resume conversation',
|
|
2280
|
-
'resumeConversationPrompt.detachButton': 'Ask new question',
|
|
2281
|
-
'resumeConversationPrompt.title': name => `Would you like to continue the conversation with ${name}?`,
|
|
2282
|
-
skiplinkText: 'Skip to chat input',
|
|
2283
|
-
'toggleButton.resumeTitle': 'Resume chat with',
|
|
2284
|
-
'toggleButton.subtitle': 'Start a chat with us',
|
|
2285
|
-
'toggleButton.title': 'Have a question?',
|
|
2286
|
-
'translations.divider.restartButtonText': 'Start again',
|
|
2287
|
-
'translations.divider.startText': language => `Translating to ${language}`,
|
|
2288
|
-
'translations.divider.stopText': language => `Translating to ${language} ended`,
|
|
2289
|
-
'translations.settings.cancelButtonText': 'Cancel',
|
|
2290
|
-
'translations.settings.currentTranslationLabel': 'Currently translating to',
|
|
2291
|
-
'translations.settings.defaultOptionLabel': 'Choose language',
|
|
2292
|
-
'translations.settings.description': 'Automatic translations might contain errors.',
|
|
2293
|
-
'translations.settings.endButtonText': 'Stop translating',
|
|
2294
|
-
'translations.settings.inputLabel': 'Translate chat to',
|
|
2295
|
-
'translations.settings.noLocaleText': 'Choose a language to translate to',
|
|
2296
|
-
'translations.settings.openButtonText': 'Translation',
|
|
2297
|
-
'translations.settings.startButtonText': 'Start translating',
|
|
2298
|
-
'translations.settings.title': 'Translation',
|
|
2299
|
-
'translations.status.label': language => `Translating to ${language}`,
|
|
2300
|
-
'translations.status.srStopText': 'Stop translating',
|
|
2301
|
-
'translations.status.stopText': 'Stop',
|
|
2302
|
-
'translations.toggle.hideButtonText': 'Show original',
|
|
2303
|
-
'translations.toggle.showButtonText': 'Show translation',
|
|
2304
|
-
'window.srModalLayoutLabel': 'Chat window',
|
|
2305
|
-
'window.srTexts.onClose': 'The chat is closed.',
|
|
2306
|
-
'window.srTexts.onHistoryLoad': 'Chat history has been loaded.',
|
|
2307
|
-
'window.srTexts.onLoad': 'Chat is available on this page.',
|
|
2308
|
-
'window.srTexts.onOpen': 'The chat is opened.'
|
|
2077
|
+
previousEvent = event;
|
|
2078
|
+
});
|
|
2079
|
+
return mappedEvents;
|
|
2309
2080
|
});
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
// Actions
|
|
2323
|
-
|
|
2324
|
-
const {
|
|
2325
|
-
createAction: i18n_createAction
|
|
2326
|
-
} = createDomain('i18n');
|
|
2327
|
-
const i18n_initI18n = i18n_createAction('init', overrides => ({
|
|
2328
|
-
overrides
|
|
2329
|
-
}));
|
|
2330
|
-
const i18n_Actions = {
|
|
2331
|
-
initI18n: i18n_initI18n
|
|
2332
|
-
}; // Reducer
|
|
2081
|
+
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
2082
|
+
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
2083
|
+
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
2084
|
+
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
2085
|
+
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
2086
|
+
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
2087
|
+
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
2088
|
+
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2089
|
+
var _filteredEvents;
|
|
2333
2090
|
|
|
2334
|
-
const
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
}
|
|
2346
|
-
}, defaultState); // Selectors
|
|
2347
|
-
|
|
2348
|
-
const i18n_getState = state => state[String(Reducer)];
|
|
2349
|
-
const getTranslations = createSelector(i18n_getState, state => state.translations);
|
|
2350
|
-
const getOverrides = createSelector(i18n_getState, state => state.overrides || {});
|
|
2351
|
-
const getCombinedTranslations = createSelector(getTranslations, getOverrides, (translations, overrides) => {
|
|
2352
|
-
const overrideKeys = Object.keys(overrides);
|
|
2353
|
-
|
|
2354
|
-
if (overrideKeys.length === 0) {
|
|
2355
|
-
return translations;
|
|
2356
|
-
}
|
|
2357
|
-
|
|
2358
|
-
const defaultKeys = Object.keys(translations);
|
|
2359
|
-
defaultKeys.forEach(key => {
|
|
2360
|
-
if (overrideKeys.indexOf(key) === -1) {
|
|
2361
|
-
console.error('Seamly: Missing translation key:', key);
|
|
2362
|
-
}
|
|
2363
|
-
});
|
|
2364
|
-
return i18n_objectSpread(i18n_objectSpread({}, translations), overrides);
|
|
2365
|
-
}); // Hooks
|
|
2366
|
-
|
|
2367
|
-
function i18n_useI18n() {
|
|
2368
|
-
const translations = useSelector(getCombinedTranslations);
|
|
2369
|
-
const t = useCallback((key, values = {}) => {
|
|
2370
|
-
const translation = translations[key];
|
|
2371
|
-
|
|
2372
|
-
if (typeof translation === 'function') {
|
|
2373
|
-
return translation(values);
|
|
2374
|
-
} else {
|
|
2375
|
-
return translation;
|
|
2376
|
-
}
|
|
2377
|
-
}, [translations]);
|
|
2378
|
-
return {
|
|
2379
|
-
t
|
|
2380
|
-
};
|
|
2381
|
-
}
|
|
2382
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
function createMiddleware() {
|
|
2387
|
-
return ({
|
|
2388
|
-
dispatch
|
|
2389
|
-
}) => next => action => {
|
|
2390
|
-
var _action$config, _action$config2, _action$config2$defau;
|
|
2391
|
-
|
|
2392
|
-
const result = next(action);
|
|
2393
|
-
|
|
2394
|
-
switch (action.type) {
|
|
2395
|
-
case String(Actions.initialize):
|
|
2396
|
-
case String(Actions.update):
|
|
2397
|
-
if (action !== null && action !== void 0 && (_action$config = action.config) !== null && _action$config !== void 0 && _action$config.translations) {
|
|
2398
|
-
dispatch(initI18n(action.config.translations));
|
|
2399
|
-
}
|
|
2400
|
-
|
|
2401
|
-
if (action !== null && action !== void 0 && (_action$config2 = action.config) !== null && _action$config2 !== void 0 && (_action$config2$defau = _action$config2.defaults) !== null && _action$config2$defau !== void 0 && _action$config2$defau.agentName) {
|
|
2402
|
-
var _action$config3, _action$config3$defau;
|
|
2403
|
-
|
|
2404
|
-
dispatch({
|
|
2405
|
-
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
2406
|
-
title: action === null || action === void 0 ? void 0 : (_action$config3 = action.config) === null || _action$config3 === void 0 ? void 0 : (_action$config3$defau = _action$config3.defaults) === null || _action$config3$defau === void 0 ? void 0 : _action$config3$defau.agentName
|
|
2407
|
-
});
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
}
|
|
2411
|
-
|
|
2412
|
-
return result;
|
|
2413
|
-
};
|
|
2414
|
-
}
|
|
2415
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
2423
|
-
function seamly_state_hooks_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2424
|
-
|
|
2425
|
-
function seamly_state_hooks_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { seamly_state_hooks_ownKeys(Object(source), true).forEach(function (key) { seamly_state_hooks_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { seamly_state_hooks_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2426
|
-
|
|
2427
|
-
function seamly_state_hooks_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
const seamly_state_hooks_selectState = state => state.state;
|
|
2434
|
-
const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
|
|
2435
|
-
const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
|
|
2436
|
-
events
|
|
2437
|
-
}, config) => {
|
|
2438
|
-
var _config$messages;
|
|
2439
|
-
|
|
2440
|
-
const {
|
|
2441
|
-
enabled,
|
|
2442
|
-
threshold
|
|
2443
|
-
} = (config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) ?? {};
|
|
2444
|
-
|
|
2445
|
-
if (!enabled) {
|
|
2446
|
-
return events;
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
|
-
const mappedEvents = [];
|
|
2450
|
-
let previousEvent = null;
|
|
2451
|
-
events.forEach((event, idx) => {
|
|
2452
|
-
// always add timeIndicator to first message
|
|
2453
|
-
if (idx === 0) {
|
|
2454
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2455
|
-
timeIndicator: event.payload.occurredAt
|
|
2456
|
-
})); // else check if diff is greater than threshold
|
|
2457
|
-
} else {
|
|
2458
|
-
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
2459
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2460
|
-
timeIndicator
|
|
2461
|
-
}));
|
|
2462
|
-
}
|
|
2463
|
-
|
|
2464
|
-
previousEvent = event;
|
|
2465
|
-
});
|
|
2466
|
-
return mappedEvents;
|
|
2467
|
-
});
|
|
2468
|
-
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
2469
|
-
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
2470
|
-
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
2471
|
-
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
2472
|
-
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
2473
|
-
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
2474
|
-
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
2475
|
-
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2476
|
-
var _filteredEvents;
|
|
2477
|
-
|
|
2478
|
-
const filteredEvents = events.filter(event => event.type === 'message');
|
|
2479
|
-
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
2480
|
-
});
|
|
2481
|
-
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
2482
|
-
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
2483
|
-
const useSeamlyCurrentAgent = () => {
|
|
2484
|
-
const {
|
|
2485
|
-
participants,
|
|
2486
|
-
currentAgent
|
|
2487
|
-
} = seamly_state_hooks_useSeamlyStateContext().participantInfo;
|
|
2488
|
-
return currentAgent ? participants[currentAgent] : null;
|
|
2091
|
+
const filteredEvents = events.filter(event => event.type === 'message');
|
|
2092
|
+
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
2093
|
+
});
|
|
2094
|
+
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
2095
|
+
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
2096
|
+
const useSeamlyCurrentAgent = () => {
|
|
2097
|
+
const {
|
|
2098
|
+
participants,
|
|
2099
|
+
currentAgent
|
|
2100
|
+
} = seamly_state_hooks_useSeamlyStateContext().participantInfo;
|
|
2101
|
+
return currentAgent ? participants[currentAgent] : null;
|
|
2489
2102
|
};
|
|
2490
2103
|
const useSeamlyServiceData = key => seamly_state_hooks_useSeamlyStateContext().serviceData[key];
|
|
2491
2104
|
const useEntryTextLimit = () => {
|
|
@@ -2566,42 +2179,894 @@ const useFocusIfSeamlyContainedFocus = () => {
|
|
|
2566
2179
|
focusWithRaf(elementToFocus);
|
|
2567
2180
|
};
|
|
2568
2181
|
|
|
2569
|
-
runIfElementContainsOrHasFocus(containerElementRef.current, focusFn);
|
|
2570
|
-
}, []);
|
|
2182
|
+
runIfElementContainsOrHasFocus(containerElementRef.current, focusFn);
|
|
2183
|
+
}, []);
|
|
2184
|
+
};
|
|
2185
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
|
|
2186
|
+
|
|
2187
|
+
|
|
2188
|
+
|
|
2189
|
+
const useSeamlyAppContainerClassNames = () => {
|
|
2190
|
+
return useConfig().appContainerClassNames;
|
|
2191
|
+
};
|
|
2192
|
+
const useSeamlyMessageContainerClassNames = event => {
|
|
2193
|
+
const {
|
|
2194
|
+
fromClient
|
|
2195
|
+
} = event.payload;
|
|
2196
|
+
const classNames = ['message'];
|
|
2197
|
+
|
|
2198
|
+
if (event.type === 'info') {
|
|
2199
|
+
classNames.push('message--source-info');
|
|
2200
|
+
} else if (!fromClient) {
|
|
2201
|
+
classNames.push('message--source-agent');
|
|
2202
|
+
} else {
|
|
2203
|
+
classNames.push('message--source-user');
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
return classNames;
|
|
2207
|
+
};
|
|
2208
|
+
const useCobrowsingContainer = () => {
|
|
2209
|
+
const {
|
|
2210
|
+
cobrowsingContainerId: id
|
|
2211
|
+
} = useSeamlyStateContext();
|
|
2212
|
+
const focusContainer = useElementFocusingById(id);
|
|
2213
|
+
return {
|
|
2214
|
+
id,
|
|
2215
|
+
focusContainer
|
|
2216
|
+
};
|
|
2217
|
+
};
|
|
2218
|
+
;// CONCATENATED MODULE: ./src/javascripts/lib/mutex.js
|
|
2219
|
+
function createMutex() {
|
|
2220
|
+
let isRunning = false;
|
|
2221
|
+
const tasks = [];
|
|
2222
|
+
|
|
2223
|
+
const next = async () => {
|
|
2224
|
+
if (!isRunning) {
|
|
2225
|
+
while (tasks.length) {
|
|
2226
|
+
const task = tasks.shift();
|
|
2227
|
+
isRunning = true; // eslint-disable-next-line no-await-in-loop
|
|
2228
|
+
|
|
2229
|
+
await task().catch(() => {});
|
|
2230
|
+
isRunning = false;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
};
|
|
2234
|
+
|
|
2235
|
+
const runExclusively = async task => {
|
|
2236
|
+
const prms = new Promise((resolve, reject) => {
|
|
2237
|
+
tasks.push(async () => {
|
|
2238
|
+
try {
|
|
2239
|
+
resolve(await task());
|
|
2240
|
+
} catch (e) {
|
|
2241
|
+
reject(e);
|
|
2242
|
+
}
|
|
2243
|
+
});
|
|
2244
|
+
});
|
|
2245
|
+
next();
|
|
2246
|
+
return prms;
|
|
2247
|
+
};
|
|
2248
|
+
|
|
2249
|
+
return {
|
|
2250
|
+
next,
|
|
2251
|
+
runExclusively
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/utils.js
|
|
2255
|
+
|
|
2256
|
+
const {
|
|
2257
|
+
createAction: i18n_utils_createAction,
|
|
2258
|
+
createActions: i18n_utils_createActions,
|
|
2259
|
+
createThunk: i18n_utils_createThunk,
|
|
2260
|
+
createReducer: i18n_utils_createReducer,
|
|
2261
|
+
selectState: i18n_utils_selectState
|
|
2262
|
+
} = createDomain('i18n');
|
|
2263
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.js
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
const selectTranslations = createSelector(i18n_utils_selectState, state => state.translations);
|
|
2267
|
+
const selectInitialLocale = createSelector(i18n_utils_selectState, state => state.initialLocale);
|
|
2268
|
+
const selectLocale = createSelector(i18n_utils_selectState, state => state.locale);
|
|
2269
|
+
|
|
2270
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/actions.js
|
|
2271
|
+
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
const setInitialLocale = i18n_utils_createAction('setInitialLocale', locale => ({
|
|
2275
|
+
locale
|
|
2276
|
+
}));
|
|
2277
|
+
const [setLocaleStart, setLocaleResolve, setLocaleReject] = i18n_utils_createActions('setLocale', {
|
|
2278
|
+
start: locale => ({
|
|
2279
|
+
locale
|
|
2280
|
+
}),
|
|
2281
|
+
resolve: (locale, translations) => ({
|
|
2282
|
+
locale,
|
|
2283
|
+
translations
|
|
2284
|
+
}),
|
|
2285
|
+
reject: (locale, error) => ({
|
|
2286
|
+
locale,
|
|
2287
|
+
error
|
|
2288
|
+
})
|
|
2289
|
+
});
|
|
2290
|
+
const mutex = createMutex();
|
|
2291
|
+
const setLocale = i18n_utils_createThunk('setLocale', locale => async (dispatch, getState, {
|
|
2292
|
+
api
|
|
2293
|
+
}) => {
|
|
2294
|
+
await mutex.runExclusively(async () => {
|
|
2295
|
+
const currentLocale = selectLocale(getState());
|
|
2296
|
+
|
|
2297
|
+
if (currentLocale === locale) {
|
|
2298
|
+
return;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
dispatch(setLocaleStart(locale));
|
|
2302
|
+
|
|
2303
|
+
try {
|
|
2304
|
+
const translations = await api.getTranslations(locale);
|
|
2305
|
+
dispatch(setLocaleResolve(locale, translations));
|
|
2306
|
+
} catch (error) {
|
|
2307
|
+
dispatch(setLocaleReject(locale, error));
|
|
2308
|
+
}
|
|
2309
|
+
});
|
|
2310
|
+
});
|
|
2311
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
2312
|
+
function _arrayWithHoles(arr) {
|
|
2313
|
+
if (Array.isArray(arr)) return arr;
|
|
2314
|
+
}
|
|
2315
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
2316
|
+
function _iterableToArrayLimit(arr, i) {
|
|
2317
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
2318
|
+
|
|
2319
|
+
if (_i == null) return;
|
|
2320
|
+
var _arr = [];
|
|
2321
|
+
var _n = true;
|
|
2322
|
+
var _d = false;
|
|
2323
|
+
|
|
2324
|
+
var _s, _e;
|
|
2325
|
+
|
|
2326
|
+
try {
|
|
2327
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
2328
|
+
_arr.push(_s.value);
|
|
2329
|
+
|
|
2330
|
+
if (i && _arr.length === i) break;
|
|
2331
|
+
}
|
|
2332
|
+
} catch (err) {
|
|
2333
|
+
_d = true;
|
|
2334
|
+
_e = err;
|
|
2335
|
+
} finally {
|
|
2336
|
+
try {
|
|
2337
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
2338
|
+
} finally {
|
|
2339
|
+
if (_d) throw _e;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
return _arr;
|
|
2344
|
+
}
|
|
2345
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
2346
|
+
function _arrayLikeToArray(arr, len) {
|
|
2347
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2348
|
+
|
|
2349
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
2350
|
+
arr2[i] = arr[i];
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
return arr2;
|
|
2354
|
+
}
|
|
2355
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
2356
|
+
|
|
2357
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
2358
|
+
if (!o) return;
|
|
2359
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
2360
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2361
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2362
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
2363
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
2364
|
+
}
|
|
2365
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
2366
|
+
function _nonIterableRest() {
|
|
2367
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2368
|
+
}
|
|
2369
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
2370
|
+
|
|
2371
|
+
|
|
2372
|
+
|
|
2373
|
+
|
|
2374
|
+
function _slicedToArray(arr, i) {
|
|
2375
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
2376
|
+
}
|
|
2377
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
2378
|
+
function _classCallCheck(instance, Constructor) {
|
|
2379
|
+
if (!(instance instanceof Constructor)) {
|
|
2380
|
+
throw new TypeError("Cannot call a class as a function");
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
2384
|
+
function _defineProperties(target, props) {
|
|
2385
|
+
for (var i = 0; i < props.length; i++) {
|
|
2386
|
+
var descriptor = props[i];
|
|
2387
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
2388
|
+
descriptor.configurable = true;
|
|
2389
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2390
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
2395
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
2396
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
2397
|
+
return Constructor;
|
|
2398
|
+
}
|
|
2399
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
2400
|
+
function defineProperty_defineProperty(obj, key, value) {
|
|
2401
|
+
if (key in obj) {
|
|
2402
|
+
Object.defineProperty(obj, key, {
|
|
2403
|
+
value: value,
|
|
2404
|
+
enumerable: true,
|
|
2405
|
+
configurable: true,
|
|
2406
|
+
writable: true
|
|
2407
|
+
});
|
|
2408
|
+
} else {
|
|
2409
|
+
obj[key] = value;
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
return obj;
|
|
2413
|
+
}
|
|
2414
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/array-utils/array-utils.es.js
|
|
2415
|
+
/*
|
|
2416
|
+
* Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
2417
|
+
*
|
|
2418
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2419
|
+
* you may not use this file except in compliance with the License.
|
|
2420
|
+
* You may obtain a copy of the License at
|
|
2421
|
+
*
|
|
2422
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2423
|
+
*
|
|
2424
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2425
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2426
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2427
|
+
* See the License for the specific language governing permissions and
|
|
2428
|
+
* limitations under the License.
|
|
2429
|
+
*/
|
|
2430
|
+
|
|
2431
|
+
/**
|
|
2432
|
+
* Flattens an array of arrays of infinite depth into a single-dimension array.
|
|
2433
|
+
*
|
|
2434
|
+
* > This is now natively in JavaScript as the `flat` method on an Array
|
|
2435
|
+
* > instance. [Check MDN for which browsers have access to this feature](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat).
|
|
2436
|
+
* > If you can't use `flat`, then this method will do the job 🙂
|
|
2437
|
+
*
|
|
2438
|
+
* @param {Array} array
|
|
2439
|
+
* @return {Array} Flattened array.
|
|
2440
|
+
*/
|
|
2441
|
+
function flatten(array) {
|
|
2442
|
+
return array.reduce(function (accumulator, value) {
|
|
2443
|
+
return accumulator.concat(Array.isArray(value) ? flatten(value) : value);
|
|
2444
|
+
}, []);
|
|
2445
|
+
}
|
|
2446
|
+
/**
|
|
2447
|
+
* Creates an array of numbers from the starting value (inclusive) to the end
|
|
2448
|
+
* (exclusive), with an optional step (the gap between values).
|
|
2449
|
+
*
|
|
2450
|
+
* @param {Number} start
|
|
2451
|
+
* The value to start at, the first item in the returned array.
|
|
2452
|
+
* @param {Number} end
|
|
2453
|
+
* The value to end with, the last item in the returned array.
|
|
2454
|
+
* @param {Number} [step=1]
|
|
2455
|
+
* The increment/gap between values, defaults to 1.
|
|
2456
|
+
* @return {Array} An array encompassing the given range.
|
|
2457
|
+
*/
|
|
2458
|
+
|
|
2459
|
+
function range(start, end) {
|
|
2460
|
+
var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
2461
|
+
return Array.apply(0, Array(Math.ceil((end - start) / step))).map(function (empty, index) {
|
|
2462
|
+
return index * step + start;
|
|
2463
|
+
});
|
|
2464
|
+
}
|
|
2465
|
+
/**
|
|
2466
|
+
* Remove and return the first item from `array` that matches the predicate
|
|
2467
|
+
* function.
|
|
2468
|
+
*
|
|
2469
|
+
* @param {Array} array
|
|
2470
|
+
* @param {Function} predicate
|
|
2471
|
+
* Invoked with the array item.
|
|
2472
|
+
* @return {Object} The matching item, or `null` if no match was found.
|
|
2473
|
+
*/
|
|
2474
|
+
|
|
2475
|
+
function remove(array, predicate) {
|
|
2476
|
+
return array.find(function (item, index) {
|
|
2477
|
+
if (predicate(item)) {
|
|
2478
|
+
array.splice(index, 1);
|
|
2479
|
+
return item;
|
|
2480
|
+
}
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
//# sourceMappingURL=array-utils.es.js.map
|
|
2485
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/function-utils/function-utils.es.js
|
|
2486
|
+
/**
|
|
2487
|
+
* A higher-order function to apply [memoization](https://en.wikipedia.org/wiki/Memoization).
|
|
2488
|
+
*
|
|
2489
|
+
* If memoizing a recursive function, then memoize and define the function at
|
|
2490
|
+
* the same time so you can make a call to the memoized function, eg:
|
|
2491
|
+
*
|
|
2492
|
+
* ```javascript
|
|
2493
|
+
* const myFunction = memoize(() => myFunction());
|
|
2494
|
+
* ```
|
|
2495
|
+
*
|
|
2496
|
+
* @param {Function} func
|
|
2497
|
+
* @return {Function}
|
|
2498
|
+
*/
|
|
2499
|
+
function memoize(func) {
|
|
2500
|
+
var cache = {};
|
|
2501
|
+
return function () {
|
|
2502
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2503
|
+
args[_key] = arguments[_key];
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
var key = args.length ? args.map(function (arg) {
|
|
2507
|
+
return arg === null ? 'null' : arg === undefined ? 'undefined' : typeof arg === 'function' ? arg.toString() : arg instanceof Date ? arg.toISOString() : JSON.stringify(arg);
|
|
2508
|
+
}).join('|') : '_(no-args)_';
|
|
2509
|
+
|
|
2510
|
+
if (Object.prototype.hasOwnProperty.call(cache, key)) {
|
|
2511
|
+
return cache[key];
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
var result = func.apply(void 0, args);
|
|
2515
|
+
cache[key] = result;
|
|
2516
|
+
return result;
|
|
2517
|
+
};
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
//# sourceMappingURL=function-utils.es.js.map
|
|
2521
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/lib/icu-message-formatter.es.js
|
|
2522
|
+
|
|
2523
|
+
|
|
2524
|
+
|
|
2525
|
+
|
|
2526
|
+
|
|
2527
|
+
|
|
2528
|
+
|
|
2529
|
+
/*
|
|
2530
|
+
* Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
2531
|
+
*
|
|
2532
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2533
|
+
* you may not use this file except in compliance with the License.
|
|
2534
|
+
* You may obtain a copy of the License at
|
|
2535
|
+
*
|
|
2536
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2537
|
+
*
|
|
2538
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2539
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2540
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2541
|
+
* See the License for the specific language governing permissions and
|
|
2542
|
+
* limitations under the License.
|
|
2543
|
+
*/
|
|
2544
|
+
|
|
2545
|
+
/**
|
|
2546
|
+
* Most branch-based type handlers are based around "cases".
|
|
2547
|
+
* For example, `select` and `plural` compare compare a value
|
|
2548
|
+
* to "case keys" to choose a subtranslation.
|
|
2549
|
+
*
|
|
2550
|
+
* This util splits "matches" portions provided to the aforementioned
|
|
2551
|
+
* handlers into case strings, and extracts any prepended arguments
|
|
2552
|
+
* (for example, `plural` supports an `offset:n` argument used for
|
|
2553
|
+
* populating the magic `#` variable).
|
|
2554
|
+
*
|
|
2555
|
+
* @param {String} string
|
|
2556
|
+
* @return {Object} The `cases` key points to a map of all cases.
|
|
2557
|
+
* The `arguments` key points to a list of prepended arguments.
|
|
2558
|
+
*/
|
|
2559
|
+
function parseCases(string) {
|
|
2560
|
+
var isWhitespace = function isWhitespace(ch) {
|
|
2561
|
+
return /\s/.test(ch);
|
|
2562
|
+
};
|
|
2563
|
+
|
|
2564
|
+
var args = [];
|
|
2565
|
+
var cases = {};
|
|
2566
|
+
var currTermStart = 0;
|
|
2567
|
+
var latestTerm = null;
|
|
2568
|
+
var inTerm = false;
|
|
2569
|
+
var i = 0;
|
|
2570
|
+
|
|
2571
|
+
while (i < string.length) {
|
|
2572
|
+
// Term ended
|
|
2573
|
+
if (inTerm && (isWhitespace(string[i]) || string[i] === '{')) {
|
|
2574
|
+
inTerm = false;
|
|
2575
|
+
latestTerm = string.slice(currTermStart, i); // We want to process the opening char again so the case will be properly registered.
|
|
2576
|
+
|
|
2577
|
+
if (string[i] === '{') {
|
|
2578
|
+
i--;
|
|
2579
|
+
}
|
|
2580
|
+
} // New term
|
|
2581
|
+
else if (!inTerm && !isWhitespace(string[i])) {
|
|
2582
|
+
var caseBody = string[i] === '{'; // If there's a previous term, we can either handle a whole
|
|
2583
|
+
// case, or add that as an argument.
|
|
2584
|
+
|
|
2585
|
+
if (latestTerm && caseBody) {
|
|
2586
|
+
var branchEndIndex = findClosingBracket(string, i);
|
|
2587
|
+
|
|
2588
|
+
if (branchEndIndex === -1) {
|
|
2589
|
+
throw new Error("Unbalanced curly braces in string: \"".concat(string, "\""));
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
cases[latestTerm] = string.slice(i + 1, branchEndIndex); // Don't include the braces
|
|
2593
|
+
|
|
2594
|
+
i = branchEndIndex; // Will be moved up where needed at end of loop.
|
|
2595
|
+
|
|
2596
|
+
latestTerm = null;
|
|
2597
|
+
} else {
|
|
2598
|
+
if (latestTerm) {
|
|
2599
|
+
args.push(latestTerm);
|
|
2600
|
+
latestTerm = null;
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
inTerm = true;
|
|
2604
|
+
currTermStart = i;
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
i++;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
if (inTerm) {
|
|
2612
|
+
latestTerm = string.slice(currTermStart);
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
if (latestTerm) {
|
|
2616
|
+
args.push(latestTerm);
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
return {
|
|
2620
|
+
args: args,
|
|
2621
|
+
cases: cases
|
|
2622
|
+
};
|
|
2623
|
+
}
|
|
2624
|
+
/**
|
|
2625
|
+
* Finds the index of the matching closing curly bracket, including through
|
|
2626
|
+
* strings that could have nested brackets.
|
|
2627
|
+
*
|
|
2628
|
+
* @param {String} string
|
|
2629
|
+
* @param {Number} fromIndex
|
|
2630
|
+
* @return {Number} The index of the matching closing bracket, or -1 if no
|
|
2631
|
+
* closing bracket could be found.
|
|
2632
|
+
*/
|
|
2633
|
+
|
|
2634
|
+
function findClosingBracket(string, fromIndex) {
|
|
2635
|
+
var depth = 0;
|
|
2636
|
+
|
|
2637
|
+
for (var i = fromIndex + 1; i < string.length; i++) {
|
|
2638
|
+
var char = string.charAt(i);
|
|
2639
|
+
|
|
2640
|
+
if (char === '}') {
|
|
2641
|
+
if (depth === 0) {
|
|
2642
|
+
return i;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
depth--;
|
|
2646
|
+
} else if (char === '{') {
|
|
2647
|
+
depth++;
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
return -1;
|
|
2652
|
+
}
|
|
2653
|
+
/**
|
|
2654
|
+
* Split a `{key, type, format}` block into those 3 parts, taking into account
|
|
2655
|
+
* nested message syntax that can exist in the `format` part.
|
|
2656
|
+
*
|
|
2657
|
+
* @param {String} block
|
|
2658
|
+
* @return {Array}
|
|
2659
|
+
* An array with `key`, `type`, and `format` items in that order, if present
|
|
2660
|
+
* in the formatted argument block.
|
|
2661
|
+
*/
|
|
2662
|
+
|
|
2663
|
+
function splitFormattedArgument(block) {
|
|
2664
|
+
return split(block.slice(1, -1), ',', 3);
|
|
2665
|
+
}
|
|
2666
|
+
/**
|
|
2667
|
+
* Like `String.prototype.split()` but where the limit parameter causes the
|
|
2668
|
+
* remainder of the string to be grouped together in a final entry.
|
|
2669
|
+
*
|
|
2670
|
+
* @private
|
|
2671
|
+
* @param {String} string
|
|
2672
|
+
* @param {String} separator
|
|
2673
|
+
* @param {Number} limit
|
|
2674
|
+
* @param {Array} [accumulator=[]]
|
|
2675
|
+
* @return {Array}
|
|
2676
|
+
*/
|
|
2677
|
+
|
|
2678
|
+
function split(string, separator, limit) {
|
|
2679
|
+
var accumulator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
2680
|
+
|
|
2681
|
+
if (!string) {
|
|
2682
|
+
return accumulator;
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
if (limit === 1) {
|
|
2686
|
+
accumulator.push(string);
|
|
2687
|
+
return accumulator;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
var indexOfDelimiter = string.indexOf(separator);
|
|
2691
|
+
|
|
2692
|
+
if (indexOfDelimiter === -1) {
|
|
2693
|
+
accumulator.push(string);
|
|
2694
|
+
return accumulator;
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
var head = string.substring(0, indexOfDelimiter).trim();
|
|
2698
|
+
var tail = string.substring(indexOfDelimiter + separator.length + 1).trim();
|
|
2699
|
+
accumulator.push(head);
|
|
2700
|
+
return split(tail, separator, limit - 1, accumulator);
|
|
2701
|
+
}
|
|
2702
|
+
|
|
2703
|
+
/**
|
|
2704
|
+
* The main class for formatting messages.
|
|
2705
|
+
*
|
|
2706
|
+
* @author Emanuel Rabina
|
|
2707
|
+
*/
|
|
2708
|
+
|
|
2709
|
+
var MessageFormatter = /*#__PURE__*/function () {
|
|
2710
|
+
/**
|
|
2711
|
+
* Creates a new formatter that can work using any of the custom type handlers
|
|
2712
|
+
* you register.
|
|
2713
|
+
*
|
|
2714
|
+
* @param {String} locale
|
|
2715
|
+
* @param {Object} [typeHandlers={}]
|
|
2716
|
+
* Optional object where the keys are the names of the types to register,
|
|
2717
|
+
* their values being the functions that will return a nicely formatted
|
|
2718
|
+
* string for the data and locale they are given.
|
|
2719
|
+
*/
|
|
2720
|
+
function MessageFormatter(locale) {
|
|
2721
|
+
var _this = this;
|
|
2722
|
+
|
|
2723
|
+
var typeHandlers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2724
|
+
|
|
2725
|
+
_classCallCheck(this, MessageFormatter);
|
|
2726
|
+
|
|
2727
|
+
defineProperty_defineProperty(this, "format", memoize(function (message) {
|
|
2728
|
+
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2729
|
+
return flatten(_this.process(message, values)).join('');
|
|
2730
|
+
}));
|
|
2731
|
+
|
|
2732
|
+
this.locale = locale;
|
|
2733
|
+
this.typeHandlers = typeHandlers;
|
|
2734
|
+
}
|
|
2735
|
+
/**
|
|
2736
|
+
* Formats an ICU message syntax string using `values` for placeholder data
|
|
2737
|
+
* and any currently-registered type handlers.
|
|
2738
|
+
*
|
|
2739
|
+
* @param {String} message
|
|
2740
|
+
* @param {Object} [values={}]
|
|
2741
|
+
* @return {String}
|
|
2742
|
+
*/
|
|
2743
|
+
|
|
2744
|
+
|
|
2745
|
+
_createClass(MessageFormatter, [{
|
|
2746
|
+
key: "process",
|
|
2747
|
+
value:
|
|
2748
|
+
/**
|
|
2749
|
+
* Process an ICU message syntax string using `values` for placeholder data
|
|
2750
|
+
* and any currently-registered type handlers. The result of this method is
|
|
2751
|
+
* an array of the component parts after they have been processed in turn by
|
|
2752
|
+
* their own type handlers. This raw output is useful for other renderers,
|
|
2753
|
+
* eg: React where components can be used instead of being forced to return
|
|
2754
|
+
* raw strings.
|
|
2755
|
+
*
|
|
2756
|
+
* This method is used by {@link MessageFormatter#format} where it acts as a
|
|
2757
|
+
* string renderer.
|
|
2758
|
+
*
|
|
2759
|
+
* @param {String} message
|
|
2760
|
+
* @param {Object} [values={}]
|
|
2761
|
+
* @return {Array}
|
|
2762
|
+
*/
|
|
2763
|
+
function process(message) {
|
|
2764
|
+
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2765
|
+
|
|
2766
|
+
if (!message) {
|
|
2767
|
+
return [];
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
var blockStartIndex = message.indexOf('{');
|
|
2771
|
+
|
|
2772
|
+
if (blockStartIndex !== -1) {
|
|
2773
|
+
var blockEndIndex = findClosingBracket(message, blockStartIndex);
|
|
2774
|
+
|
|
2775
|
+
if (blockEndIndex !== -1) {
|
|
2776
|
+
var block = message.substring(blockStartIndex, blockEndIndex + 1);
|
|
2777
|
+
|
|
2778
|
+
if (block) {
|
|
2779
|
+
var result = [];
|
|
2780
|
+
var head = message.substring(0, blockStartIndex);
|
|
2781
|
+
|
|
2782
|
+
if (head) {
|
|
2783
|
+
result.push(head);
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
var _splitFormattedArgume = splitFormattedArgument(block),
|
|
2787
|
+
_splitFormattedArgume2 = _slicedToArray(_splitFormattedArgume, 3),
|
|
2788
|
+
key = _splitFormattedArgume2[0],
|
|
2789
|
+
type = _splitFormattedArgume2[1],
|
|
2790
|
+
format = _splitFormattedArgume2[2];
|
|
2791
|
+
|
|
2792
|
+
var body = values[key];
|
|
2793
|
+
|
|
2794
|
+
if (body === null || body === undefined) {
|
|
2795
|
+
body = '';
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2798
|
+
var typeHandler = type && this.typeHandlers[type];
|
|
2799
|
+
result.push(typeHandler ? typeHandler(body, format, this.locale, values, this.process.bind(this)) : body);
|
|
2800
|
+
var tail = message.substring(blockEndIndex + 1);
|
|
2801
|
+
|
|
2802
|
+
if (tail) {
|
|
2803
|
+
result.push(this.process(tail, values));
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
return result;
|
|
2807
|
+
}
|
|
2808
|
+
} else {
|
|
2809
|
+
throw new Error("Unbalanced curly braces in string: \"".concat(message, "\""));
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
return [message];
|
|
2814
|
+
}
|
|
2815
|
+
}]);
|
|
2816
|
+
|
|
2817
|
+
return MessageFormatter;
|
|
2818
|
+
}();
|
|
2819
|
+
|
|
2820
|
+
function icu_message_formatter_es_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2821
|
+
|
|
2822
|
+
function icu_message_formatter_es_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { icu_message_formatter_es_ownKeys(Object(source), true).forEach(function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { icu_message_formatter_es_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2823
|
+
var pluralFormatter;
|
|
2824
|
+
var keyCounter = 0; // All the special keywords that can be used in `plural` blocks for the various branches
|
|
2825
|
+
|
|
2826
|
+
var ONE = 'one';
|
|
2827
|
+
var OTHER$1 = 'other';
|
|
2828
|
+
/**
|
|
2829
|
+
* @private
|
|
2830
|
+
* @param {String} caseBody
|
|
2831
|
+
* @param {Number} value
|
|
2832
|
+
* @return {Object} {caseBody: string, numberValues: object}
|
|
2833
|
+
*/
|
|
2834
|
+
|
|
2835
|
+
function replaceNumberSign(caseBody, value) {
|
|
2836
|
+
var i = 0;
|
|
2837
|
+
var output = '';
|
|
2838
|
+
var numBraces = 0;
|
|
2839
|
+
var numberValues = {};
|
|
2840
|
+
|
|
2841
|
+
while (i < caseBody.length) {
|
|
2842
|
+
if (caseBody[i] === '#' && !numBraces) {
|
|
2843
|
+
var keyParam = "__hashToken".concat(keyCounter++);
|
|
2844
|
+
output += "{".concat(keyParam, ", number}");
|
|
2845
|
+
numberValues[keyParam] = value;
|
|
2846
|
+
} else {
|
|
2847
|
+
output += caseBody[i];
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
if (caseBody[i] === '{') {
|
|
2851
|
+
numBraces++;
|
|
2852
|
+
} else if (caseBody[i] === '}') {
|
|
2853
|
+
numBraces--;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
i++;
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
return {
|
|
2860
|
+
caseBody: output,
|
|
2861
|
+
numberValues: numberValues
|
|
2862
|
+
};
|
|
2863
|
+
}
|
|
2864
|
+
/**
|
|
2865
|
+
* Handler for `plural` statements within ICU message syntax strings. Returns
|
|
2866
|
+
* a formatted string for the branch that closely matches the current value.
|
|
2867
|
+
*
|
|
2868
|
+
* See https://formatjs.io/docs/core-concepts/icu-syntax#plural-format for more
|
|
2869
|
+
* details on how the `plural` statement works.
|
|
2870
|
+
*
|
|
2871
|
+
* @param {String} value
|
|
2872
|
+
* @param {String} matches
|
|
2873
|
+
* @param {String} locale
|
|
2874
|
+
* @param {String} values
|
|
2875
|
+
* @param {Function} format
|
|
2876
|
+
* @return {String}
|
|
2877
|
+
*/
|
|
2878
|
+
|
|
2879
|
+
|
|
2880
|
+
function pluralTypeHandler(value) {
|
|
2881
|
+
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
2882
|
+
var locale = arguments.length > 2 ? arguments[2] : undefined;
|
|
2883
|
+
var values = arguments.length > 3 ? arguments[3] : undefined;
|
|
2884
|
+
var format = arguments.length > 4 ? arguments[4] : undefined;
|
|
2885
|
+
|
|
2886
|
+
var _parseCases = parseCases(matches),
|
|
2887
|
+
args = _parseCases.args,
|
|
2888
|
+
cases = _parseCases.cases;
|
|
2889
|
+
|
|
2890
|
+
var intValue = parseInt(value);
|
|
2891
|
+
args.forEach(function (arg) {
|
|
2892
|
+
if (arg.startsWith('offset:')) {
|
|
2893
|
+
intValue -= parseInt(arg.slice('offset:'.length));
|
|
2894
|
+
}
|
|
2895
|
+
});
|
|
2896
|
+
var keywordPossibilities = [];
|
|
2897
|
+
|
|
2898
|
+
if ('PluralRules' in Intl) {
|
|
2899
|
+
// Effectively memoize because instantiation of `Int.*` objects is expensive.
|
|
2900
|
+
if (pluralFormatter === undefined || pluralFormatter.resolvedOptions().locale !== locale) {
|
|
2901
|
+
pluralFormatter = new Intl.PluralRules(locale);
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
var pluralKeyword = pluralFormatter.select(intValue); // Other is always added last with least priority, so we don't want to add it here.
|
|
2905
|
+
|
|
2906
|
+
if (pluralKeyword !== OTHER$1) {
|
|
2907
|
+
keywordPossibilities.push(pluralKeyword);
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
if (intValue === 1) {
|
|
2912
|
+
keywordPossibilities.push(ONE);
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
keywordPossibilities.push("=".concat(intValue), OTHER$1);
|
|
2916
|
+
|
|
2917
|
+
for (var i = 0; i < keywordPossibilities.length; i++) {
|
|
2918
|
+
var keyword = keywordPossibilities[i];
|
|
2919
|
+
|
|
2920
|
+
if (keyword in cases) {
|
|
2921
|
+
var _replaceNumberSign = replaceNumberSign(cases[keyword], intValue),
|
|
2922
|
+
caseBody = _replaceNumberSign.caseBody,
|
|
2923
|
+
numberValues = _replaceNumberSign.numberValues;
|
|
2924
|
+
|
|
2925
|
+
return format(caseBody, icu_message_formatter_es_objectSpread(icu_message_formatter_es_objectSpread({}, values), numberValues));
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
return value;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
/*
|
|
2933
|
+
* Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
2934
|
+
*
|
|
2935
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2936
|
+
* you may not use this file except in compliance with the License.
|
|
2937
|
+
* You may obtain a copy of the License at
|
|
2938
|
+
*
|
|
2939
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2940
|
+
*
|
|
2941
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2942
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2943
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2944
|
+
* See the License for the specific language governing permissions and
|
|
2945
|
+
* limitations under the License.
|
|
2946
|
+
*/
|
|
2947
|
+
var OTHER = 'other';
|
|
2948
|
+
/**
|
|
2949
|
+
* Handler for `select` statements within ICU message syntax strings. Returns
|
|
2950
|
+
* a formatted string for the branch that closely matches the current value.
|
|
2951
|
+
*
|
|
2952
|
+
* See https://formatjs.io/docs/core-concepts/icu-syntax#select-format for more
|
|
2953
|
+
* details on how the `select` statement works.
|
|
2954
|
+
*
|
|
2955
|
+
* @param {String} value
|
|
2956
|
+
* @param {String} matches
|
|
2957
|
+
* @param {String} locale
|
|
2958
|
+
* @param {String} values
|
|
2959
|
+
* @param {Function} format
|
|
2960
|
+
* @return {String}
|
|
2961
|
+
*/
|
|
2962
|
+
|
|
2963
|
+
function selectTypeHandler(value) {
|
|
2964
|
+
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
2965
|
+
var values = arguments.length > 3 ? arguments[3] : undefined;
|
|
2966
|
+
var format = arguments.length > 4 ? arguments[4] : undefined;
|
|
2967
|
+
|
|
2968
|
+
var _parseCases = parseCases(matches),
|
|
2969
|
+
cases = _parseCases.cases;
|
|
2970
|
+
|
|
2971
|
+
if (value in cases) {
|
|
2972
|
+
return format(cases[value], values);
|
|
2973
|
+
} else if (OTHER in cases) {
|
|
2974
|
+
return format(cases[OTHER], values);
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
return value;
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2980
|
+
|
|
2981
|
+
//# sourceMappingURL=icu-message-formatter.es.js.map
|
|
2982
|
+
|
|
2983
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/hooks.js
|
|
2984
|
+
|
|
2985
|
+
|
|
2986
|
+
|
|
2987
|
+
// The passed in locale (en-GB) is only used to call Intl.PluralRules.select() in
|
|
2988
|
+
// pluralTypeHandler. Since we only use exact plural matches (=0, =1 etc) we can
|
|
2989
|
+
// safely use en-GB all the time.
|
|
2990
|
+
|
|
2991
|
+
const formatter = new MessageFormatter('en-GB', {
|
|
2992
|
+
plural: pluralTypeHandler,
|
|
2993
|
+
select: selectTypeHandler
|
|
2994
|
+
});
|
|
2995
|
+
function hooks_useI18n() {
|
|
2996
|
+
const translations = useSelector(Selectors.selectTranslations);
|
|
2997
|
+
const locale = useSelector(Selectors.selectLocale);
|
|
2998
|
+
const initialLocale = useSelector(Selectors.selectInitialLocale);
|
|
2999
|
+
const t = useCallback((key, values = {}) => {
|
|
3000
|
+
const translation = translations[key];
|
|
3001
|
+
|
|
3002
|
+
if (!translation) {
|
|
3003
|
+
return null;
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
return formatter.format(translation, values);
|
|
3007
|
+
}, [translations]);
|
|
3008
|
+
return {
|
|
3009
|
+
t,
|
|
3010
|
+
locale,
|
|
3011
|
+
initialLocale
|
|
3012
|
+
};
|
|
3013
|
+
}
|
|
3014
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/reducer.js
|
|
3015
|
+
function i18n_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3016
|
+
|
|
3017
|
+
function i18n_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { i18n_reducer_ownKeys(Object(source), true).forEach(function (key) { i18n_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { i18n_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
3018
|
+
|
|
3019
|
+
function i18n_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3020
|
+
|
|
3021
|
+
|
|
3022
|
+
|
|
3023
|
+
const defaultState = {
|
|
3024
|
+
translations: {
|
|
3025
|
+
'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
|
|
3026
|
+
'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
|
|
3027
|
+
'errors.configError.title': 'Chat configuration error.',
|
|
3028
|
+
'errors.general.buttonText': 'Restart chat',
|
|
3029
|
+
'errors.general.message': 'Do you want to start a new chat session?',
|
|
3030
|
+
'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
|
|
3031
|
+
'errors.general.title': 'Something went wrong',
|
|
3032
|
+
'errors.seamlyOffline.message': 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
|
|
3033
|
+
'errors.seamlyOffline.srText': 'The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.',
|
|
3034
|
+
'errors.seamlyOffline.title': 'Connection issues'
|
|
3035
|
+
},
|
|
3036
|
+
isLoading: false,
|
|
3037
|
+
initialLocale: undefined
|
|
2571
3038
|
};
|
|
2572
|
-
|
|
3039
|
+
/* harmony default export */ const i18n_reducer = (i18n_utils_createReducer({
|
|
3040
|
+
[setInitialLocale]: (state, {
|
|
3041
|
+
locale
|
|
3042
|
+
}) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3043
|
+
initialLocale: locale
|
|
3044
|
+
}),
|
|
3045
|
+
[setLocaleStart]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3046
|
+
isLoading: true
|
|
3047
|
+
}),
|
|
3048
|
+
[setLocaleResolve]: (state, {
|
|
3049
|
+
locale,
|
|
3050
|
+
translations
|
|
3051
|
+
}) => {
|
|
3052
|
+
return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3053
|
+
isLoading: false,
|
|
3054
|
+
locale,
|
|
3055
|
+
translations: Object.keys(translations).sort().reduce((accum, key) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, accum), {}, {
|
|
3056
|
+
[key]: translations[key]
|
|
3057
|
+
}), {})
|
|
3058
|
+
});
|
|
3059
|
+
},
|
|
3060
|
+
[setLocaleReject]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3061
|
+
isLoading: false
|
|
3062
|
+
})
|
|
3063
|
+
}, defaultState));
|
|
3064
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/index.js
|
|
2573
3065
|
|
|
2574
3066
|
|
|
2575
3067
|
|
|
2576
|
-
const useSeamlyAppContainerClassNames = () => {
|
|
2577
|
-
return useConfig().appContainerClassNames;
|
|
2578
|
-
};
|
|
2579
|
-
const useSeamlyMessageContainerClassNames = event => {
|
|
2580
|
-
const {
|
|
2581
|
-
fromClient
|
|
2582
|
-
} = event.payload;
|
|
2583
|
-
const classNames = ['message'];
|
|
2584
3068
|
|
|
2585
|
-
if (event.type === 'info') {
|
|
2586
|
-
classNames.push('message--source-info');
|
|
2587
|
-
} else if (!fromClient) {
|
|
2588
|
-
classNames.push('message--source-agent');
|
|
2589
|
-
} else {
|
|
2590
|
-
classNames.push('message--source-user');
|
|
2591
|
-
}
|
|
2592
3069
|
|
|
2593
|
-
return classNames;
|
|
2594
|
-
};
|
|
2595
|
-
const useCobrowsingContainer = () => {
|
|
2596
|
-
const {
|
|
2597
|
-
cobrowsingContainerId: id
|
|
2598
|
-
} = useSeamlyStateContext();
|
|
2599
|
-
const focusContainer = useElementFocusingById(id);
|
|
2600
|
-
return {
|
|
2601
|
-
id,
|
|
2602
|
-
focusContainer
|
|
2603
|
-
};
|
|
2604
|
-
};
|
|
2605
3070
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-option-hooks.js
|
|
2606
3071
|
function seamly_option_hooks_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2607
3072
|
|
|
@@ -2832,46 +3297,26 @@ const utility_hooks_useStableCallback = callback => {
|
|
|
2832
3297
|
return isFunction ? (...args) => callbackRef.current(...args) : undefined;
|
|
2833
3298
|
}, [isFunction]);
|
|
2834
3299
|
};
|
|
2835
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/
|
|
3300
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/utils.js
|
|
2836
3301
|
|
|
2837
3302
|
const {
|
|
2838
|
-
createAction:
|
|
3303
|
+
createAction: interrupt_utils_createAction,
|
|
3304
|
+
createReducer: interrupt_utils_createReducer,
|
|
3305
|
+
selectState: interrupt_utils_selectState
|
|
2839
3306
|
} = createDomain('interrupt');
|
|
2840
|
-
|
|
3307
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/actions.js
|
|
3308
|
+
|
|
3309
|
+
const set = interrupt_utils_createAction('set', error => ({
|
|
2841
3310
|
error
|
|
2842
3311
|
}));
|
|
2843
|
-
const clear =
|
|
2844
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
|
|
2845
|
-
function interrupt_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2846
|
-
|
|
2847
|
-
function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { interrupt_reducer_ownKeys(Object(source), true).forEach(function (key) { interrupt_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { interrupt_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2848
|
-
|
|
2849
|
-
function interrupt_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
const interrupt_reducer_initialState = {
|
|
2854
|
-
error: undefined
|
|
2855
|
-
};
|
|
2856
|
-
/* harmony default export */ const interrupt_reducer = (createReducer('interrupt', {
|
|
2857
|
-
[set]: (state, {
|
|
2858
|
-
error
|
|
2859
|
-
}) => {
|
|
2860
|
-
return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
|
|
2861
|
-
error
|
|
2862
|
-
});
|
|
2863
|
-
},
|
|
2864
|
-
[clear]: () => {
|
|
2865
|
-
return interrupt_reducer_initialState;
|
|
2866
|
-
}
|
|
2867
|
-
}, interrupt_reducer_initialState));
|
|
3312
|
+
const clear = interrupt_utils_createAction('clear');
|
|
2868
3313
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.js
|
|
2869
3314
|
|
|
2870
3315
|
|
|
2871
|
-
const
|
|
2872
|
-
const selectError = createSelector(selectors_selectState, ({
|
|
3316
|
+
const selectError = createSelector(interrupt_utils_selectState, ({
|
|
2873
3317
|
error
|
|
2874
3318
|
}) => error);
|
|
3319
|
+
|
|
2875
3320
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.js
|
|
2876
3321
|
function hooks_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2877
3322
|
|
|
@@ -3008,6 +3453,30 @@ function middleware_createMiddleware() {
|
|
|
3008
3453
|
return next(action);
|
|
3009
3454
|
};
|
|
3010
3455
|
}
|
|
3456
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
|
|
3457
|
+
function interrupt_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3458
|
+
|
|
3459
|
+
function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { interrupt_reducer_ownKeys(Object(source), true).forEach(function (key) { interrupt_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { interrupt_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
3460
|
+
|
|
3461
|
+
function interrupt_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3462
|
+
|
|
3463
|
+
|
|
3464
|
+
|
|
3465
|
+
const interrupt_reducer_initialState = {
|
|
3466
|
+
error: undefined
|
|
3467
|
+
};
|
|
3468
|
+
/* harmony default export */ const interrupt_reducer = (interrupt_utils_createReducer({
|
|
3469
|
+
[set]: (state, {
|
|
3470
|
+
error
|
|
3471
|
+
}) => {
|
|
3472
|
+
return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
|
|
3473
|
+
error
|
|
3474
|
+
});
|
|
3475
|
+
},
|
|
3476
|
+
[clear]: () => {
|
|
3477
|
+
return interrupt_reducer_initialState;
|
|
3478
|
+
}
|
|
3479
|
+
}, interrupt_reducer_initialState));
|
|
3011
3480
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
|
|
3012
3481
|
|
|
3013
3482
|
|
|
@@ -3015,6 +3484,100 @@ function middleware_createMiddleware() {
|
|
|
3015
3484
|
|
|
3016
3485
|
|
|
3017
3486
|
|
|
3487
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
|
|
3488
|
+
|
|
3489
|
+
const {
|
|
3490
|
+
createAction: app_utils_createAction,
|
|
3491
|
+
createThunk: app_utils_createThunk,
|
|
3492
|
+
createReducer: app_utils_createReducer,
|
|
3493
|
+
selectState: app_utils_selectState
|
|
3494
|
+
} = createDomain('app');
|
|
3495
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
|
|
3496
|
+
|
|
3497
|
+
|
|
3498
|
+
|
|
3499
|
+
|
|
3500
|
+
|
|
3501
|
+
const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
|
|
3502
|
+
hasResponded
|
|
3503
|
+
}));
|
|
3504
|
+
const actions_initialize = app_utils_createThunk('initialize', config => async (dispatch, getState, {
|
|
3505
|
+
api
|
|
3506
|
+
}) => {
|
|
3507
|
+
try {
|
|
3508
|
+
var _config$context;
|
|
3509
|
+
|
|
3510
|
+
dispatch(initialize(config));
|
|
3511
|
+
const {
|
|
3512
|
+
features,
|
|
3513
|
+
defaultLocale
|
|
3514
|
+
} = await api.getConfig();
|
|
3515
|
+
dispatch({
|
|
3516
|
+
type: seamly_utils_seamlyActions.SET_FEATURES,
|
|
3517
|
+
features
|
|
3518
|
+
});
|
|
3519
|
+
let locale = (config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale) || defaultLocale;
|
|
3520
|
+
dispatch(setInitialLocale(locale));
|
|
3521
|
+
|
|
3522
|
+
try {
|
|
3523
|
+
if (api.hasConversation()) {
|
|
3524
|
+
var _initialState$transla;
|
|
3525
|
+
|
|
3526
|
+
const initialState = await api.getConversationIntitialState();
|
|
3527
|
+
dispatch({
|
|
3528
|
+
type: seamly_utils_seamlyActions.SET_INITIAL_STATE,
|
|
3529
|
+
initialState
|
|
3530
|
+
});
|
|
3531
|
+
locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
|
|
3532
|
+
|
|
3533
|
+
if ('userResponded' in initialState) {
|
|
3534
|
+
dispatch(setHasResponded(initialState.userResponded));
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
} catch (error) {
|
|
3538
|
+
dispatch(set(error));
|
|
3539
|
+
}
|
|
3540
|
+
|
|
3541
|
+
await dispatch(setLocale(locale));
|
|
3542
|
+
} catch (error) {
|
|
3543
|
+
dispatch(set(error));
|
|
3544
|
+
}
|
|
3545
|
+
});
|
|
3546
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
|
|
3547
|
+
|
|
3548
|
+
|
|
3549
|
+
const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
|
|
3550
|
+
|
|
3551
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
|
|
3552
|
+
|
|
3553
|
+
|
|
3554
|
+
function hooks_useUserHasResponded() {
|
|
3555
|
+
return useSelector(Selectors.selectUserHasResponded);
|
|
3556
|
+
}
|
|
3557
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/reducer.js
|
|
3558
|
+
function app_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3559
|
+
|
|
3560
|
+
function app_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { app_reducer_ownKeys(Object(source), true).forEach(function (key) { app_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { app_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
3561
|
+
|
|
3562
|
+
function app_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3563
|
+
|
|
3564
|
+
|
|
3565
|
+
|
|
3566
|
+
const app_reducer_initialState = {
|
|
3567
|
+
userHasResponded: false
|
|
3568
|
+
};
|
|
3569
|
+
/* harmony default export */ const app_reducer = (app_utils_createReducer({
|
|
3570
|
+
[setHasResponded]: (state, {
|
|
3571
|
+
hasResponded
|
|
3572
|
+
}) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
|
|
3573
|
+
userHasResponded: hasResponded
|
|
3574
|
+
})
|
|
3575
|
+
}, app_reducer_initialState));
|
|
3576
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
|
|
3577
|
+
|
|
3578
|
+
|
|
3579
|
+
|
|
3580
|
+
|
|
3018
3581
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-commands.js
|
|
3019
3582
|
function use_seamly_commands_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3020
3583
|
|
|
@@ -3034,6 +3597,7 @@ function use_seamly_commands_defineProperty(obj, key, value) { if (key in obj) {
|
|
|
3034
3597
|
|
|
3035
3598
|
|
|
3036
3599
|
|
|
3600
|
+
|
|
3037
3601
|
const {
|
|
3038
3602
|
ADD_EVENT: use_seamly_commands_ADD_EVENT,
|
|
3039
3603
|
CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
|
|
@@ -3052,7 +3616,7 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3052
3616
|
const appConfig = useConfig();
|
|
3053
3617
|
const dispatch = useSeamlyDispatchContext();
|
|
3054
3618
|
const eventBus = useContext(SeamlyEventBusContext);
|
|
3055
|
-
const hasResponded =
|
|
3619
|
+
const hasResponded = useUserHasResponded();
|
|
3056
3620
|
const hasConversation = useSeamlyHasConversation();
|
|
3057
3621
|
const {
|
|
3058
3622
|
visible: visibility
|
|
@@ -3078,10 +3642,10 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3078
3642
|
});
|
|
3079
3643
|
}, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
|
|
3080
3644
|
const reset = useCallback(async () => {
|
|
3645
|
+
dispatch(InterruptActions.clear());
|
|
3081
3646
|
dispatch({
|
|
3082
3647
|
type: use_seamly_commands_CLEAR_EVENTS
|
|
3083
3648
|
});
|
|
3084
|
-
dispatch(InterruptActions.clear());
|
|
3085
3649
|
dispatch({
|
|
3086
3650
|
type: use_seamly_commands_SET_IS_LOADING,
|
|
3087
3651
|
isLoading: true
|
|
@@ -3107,20 +3671,16 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3107
3671
|
});
|
|
3108
3672
|
|
|
3109
3673
|
try {
|
|
3110
|
-
const {
|
|
3111
|
-
accountConfig = {},
|
|
3112
|
-
initialState = {}
|
|
3113
|
-
} = await api.reset();
|
|
3114
3674
|
const {
|
|
3115
3675
|
features
|
|
3116
|
-
} =
|
|
3676
|
+
} = await api.reset();
|
|
3117
3677
|
dispatch({
|
|
3118
3678
|
type: use_seamly_commands_SET_FEATURES,
|
|
3119
3679
|
features
|
|
3120
3680
|
});
|
|
3121
3681
|
dispatch({
|
|
3122
3682
|
type: use_seamly_commands_SET_INITIAL_STATE,
|
|
3123
|
-
initialState
|
|
3683
|
+
initialState: {}
|
|
3124
3684
|
});
|
|
3125
3685
|
} catch (error) {
|
|
3126
3686
|
dispatch(InterruptActions.set(error));
|
|
@@ -3348,24 +3908,21 @@ const useSeamlyTyping = () => {
|
|
|
3348
3908
|
const {
|
|
3349
3909
|
sendAction
|
|
3350
3910
|
} = useSeamlyCommands();
|
|
3351
|
-
const {
|
|
3352
|
-
typing: typingConfig
|
|
3353
|
-
} = useConfig();
|
|
3354
3911
|
const {
|
|
3355
3912
|
features
|
|
3356
3913
|
} = useSeamlyOptions();
|
|
3357
3914
|
const {
|
|
3358
3915
|
typingPeekahead
|
|
3359
3916
|
} = features || {};
|
|
3360
|
-
const
|
|
3361
|
-
const
|
|
3917
|
+
const typingTimerId = useRef(null);
|
|
3918
|
+
const sendEndTypingTimerId = useRef(null);
|
|
3362
3919
|
const isTyping = useRef(false);
|
|
3363
|
-
const
|
|
3920
|
+
const typingIntervalId = useRef(null);
|
|
3364
3921
|
useEffect(() => {
|
|
3365
3922
|
return () => {
|
|
3366
|
-
clearInterval(
|
|
3367
|
-
clearTimeout(
|
|
3368
|
-
clearTimeout(
|
|
3923
|
+
clearInterval(typingIntervalId.current);
|
|
3924
|
+
clearTimeout(typingTimerId.current);
|
|
3925
|
+
clearTimeout(sendEndTypingTimerId.current);
|
|
3369
3926
|
};
|
|
3370
3927
|
}, []);
|
|
3371
3928
|
|
|
@@ -3385,32 +3942,28 @@ const useSeamlyTyping = () => {
|
|
|
3385
3942
|
return;
|
|
3386
3943
|
}
|
|
3387
3944
|
|
|
3388
|
-
if (!typingConfig) {
|
|
3389
|
-
return;
|
|
3390
|
-
}
|
|
3391
|
-
|
|
3392
3945
|
isTyping.current = true;
|
|
3393
3946
|
|
|
3394
|
-
if (!
|
|
3947
|
+
if (!typingIntervalId.current) {
|
|
3395
3948
|
sendTypingState(true, e.target.value);
|
|
3396
|
-
|
|
3949
|
+
typingIntervalId.current = setInterval(() => {
|
|
3397
3950
|
if (!isTyping.current) {
|
|
3398
|
-
clearInterval(
|
|
3399
|
-
|
|
3951
|
+
clearInterval(typingIntervalId.current);
|
|
3952
|
+
typingIntervalId.current = null;
|
|
3400
3953
|
} else if (typingPeekahead && typingPeekahead.enabled) {
|
|
3401
3954
|
sendTypingState(true, e.target.value);
|
|
3402
3955
|
}
|
|
3403
|
-
},
|
|
3956
|
+
}, typingTimeout);
|
|
3404
3957
|
}
|
|
3405
3958
|
|
|
3406
|
-
clearTimeout(
|
|
3407
|
-
clearTimeout(
|
|
3408
|
-
|
|
3959
|
+
clearTimeout(typingTimerId.current);
|
|
3960
|
+
clearTimeout(sendEndTypingTimerId.current);
|
|
3961
|
+
typingTimerId.current = setTimeout(() => {
|
|
3409
3962
|
isTyping.current = false;
|
|
3410
3963
|
}, 300);
|
|
3411
|
-
|
|
3964
|
+
sendEndTypingTimerId.current = setTimeout(() => {
|
|
3412
3965
|
sendTypingState(false, e.target.value);
|
|
3413
|
-
},
|
|
3966
|
+
}, typingTimeout);
|
|
3414
3967
|
};
|
|
3415
3968
|
};
|
|
3416
3969
|
const useSeamlyEntry = () => {
|
|
@@ -3503,6 +4056,7 @@ const use_seamly_stored_visibility_useSeamlyStoredVisibility = () => {
|
|
|
3503
4056
|
|
|
3504
4057
|
|
|
3505
4058
|
|
|
4059
|
+
|
|
3506
4060
|
const {
|
|
3507
4061
|
SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
|
|
3508
4062
|
} = seamly_utils_seamlyActions;
|
|
@@ -3521,7 +4075,7 @@ const use_seamly_visibility_useSeamlyVisibility = () => {
|
|
|
3521
4075
|
} = useSeamlyCommands();
|
|
3522
4076
|
const dispatch = useSeamlyDispatchContext();
|
|
3523
4077
|
const [storedVisibility, setStoredVisibility] = useSeamlyStoredVisibility();
|
|
3524
|
-
const hasResponded =
|
|
4078
|
+
const hasResponded = useUserHasResponded();
|
|
3525
4079
|
const hasConversation = useSeamlyHasConversation();
|
|
3526
4080
|
const unreadMessageCount = useSeamlyUnreadCount();
|
|
3527
4081
|
const isVisible = visible ? visible !== visibilityStates.hidden : false;
|
|
@@ -4051,6 +4605,123 @@ function hooks_useTranslationsContainer() {
|
|
|
4051
4605
|
focusContainer
|
|
4052
4606
|
};
|
|
4053
4607
|
}
|
|
4608
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/middleware.js
|
|
4609
|
+
|
|
4610
|
+
|
|
4611
|
+
|
|
4612
|
+
function translations_middleware_createMiddleware() {
|
|
4613
|
+
return ({
|
|
4614
|
+
dispatch,
|
|
4615
|
+
getState
|
|
4616
|
+
}) => next => action => {
|
|
4617
|
+
var _action$history, _action$history$trans, _action$initialState, _action$initialState$, _action$event, _action$event$payload, _action$event$payload2;
|
|
4618
|
+
|
|
4619
|
+
const result = next(action);
|
|
4620
|
+
|
|
4621
|
+
switch (action.type) {
|
|
4622
|
+
case String(seamlyActions.SET_HISTORY):
|
|
4623
|
+
if ((_action$history = action.history) !== null && _action$history !== void 0 && (_action$history$trans = _action$history.translation) !== null && _action$history$trans !== void 0 && _action$history$trans.enabled) {
|
|
4624
|
+
dispatch(Actions.enable(action.history.translation.locale));
|
|
4625
|
+
}
|
|
4626
|
+
|
|
4627
|
+
break;
|
|
4628
|
+
|
|
4629
|
+
case String(seamlyActions.SET_INITIAL_STATE):
|
|
4630
|
+
if ((_action$initialState = action.initialState) !== null && _action$initialState !== void 0 && (_action$initialState$ = _action$initialState.translation) !== null && _action$initialState$ !== void 0 && _action$initialState$.enabled) {
|
|
4631
|
+
dispatch(Actions.enable(action.initialState.translation.locale));
|
|
4632
|
+
dispatch(I18nActions.setLocale(action.locale));
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
break;
|
|
4636
|
+
|
|
4637
|
+
case String(seamlyActions.ADD_EVENT):
|
|
4638
|
+
if (action.event.type === 'info' && ((_action$event = action.event) === null || _action$event === void 0 ? void 0 : (_action$event$payload = _action$event.payload) === null || _action$event$payload === void 0 ? void 0 : (_action$event$payload2 = _action$event$payload.body) === null || _action$event$payload2 === void 0 ? void 0 : _action$event$payload2.subtype) === 'new_translation' && action.event.payload.body.translationEnabled) {
|
|
4639
|
+
dispatch(I18nActions.setLocale(action.event.payload.body.translationLocale));
|
|
4640
|
+
}
|
|
4641
|
+
|
|
4642
|
+
break;
|
|
4643
|
+
|
|
4644
|
+
case String(Actions.disable):
|
|
4645
|
+
const initialLocale = I18nSelectors.selectInitialLocale(getState());
|
|
4646
|
+
dispatch(I18nActions.setLocale(initialLocale));
|
|
4647
|
+
break;
|
|
4648
|
+
}
|
|
4649
|
+
|
|
4650
|
+
return result;
|
|
4651
|
+
};
|
|
4652
|
+
}
|
|
4653
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/reducer.js
|
|
4654
|
+
function translations_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4655
|
+
|
|
4656
|
+
function translations_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { translations_reducer_ownKeys(Object(source), true).forEach(function (key) { translations_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { translations_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4657
|
+
|
|
4658
|
+
function translations_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4659
|
+
|
|
4660
|
+
|
|
4661
|
+
|
|
4662
|
+
|
|
4663
|
+
|
|
4664
|
+
const translations_reducer_initialState = {
|
|
4665
|
+
isActive: false,
|
|
4666
|
+
currentLocale: undefined,
|
|
4667
|
+
isAvailable: false,
|
|
4668
|
+
languages: [],
|
|
4669
|
+
originalPayloadIds: [],
|
|
4670
|
+
containerId: id_randomId()
|
|
4671
|
+
};
|
|
4672
|
+
/* harmony default export */ const translations_reducer = (translations_utils_createReducer({
|
|
4673
|
+
[seamly_utils_seamlyActions.SET_FEATURES]: (state, action) => {
|
|
4674
|
+
var _action$features;
|
|
4675
|
+
|
|
4676
|
+
const feature = action === null || action === void 0 ? void 0 : (_action$features = action.features) === null || _action$features === void 0 ? void 0 : _action$features.translation;
|
|
4677
|
+
|
|
4678
|
+
if (!feature) {
|
|
4679
|
+
return state;
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4682
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4683
|
+
isAvailable: feature.enabled === true,
|
|
4684
|
+
languages: feature.languages || []
|
|
4685
|
+
});
|
|
4686
|
+
},
|
|
4687
|
+
[seamly_utils_seamlyActions.CLEAR_FEATURES]: () => translations_reducer_initialState,
|
|
4688
|
+
[enable]: (state, {
|
|
4689
|
+
locale
|
|
4690
|
+
}) => {
|
|
4691
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4692
|
+
isActive: true,
|
|
4693
|
+
currentLocale: locale
|
|
4694
|
+
});
|
|
4695
|
+
},
|
|
4696
|
+
[disable]: state => {
|
|
4697
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4698
|
+
isActive: false,
|
|
4699
|
+
currentLocale: undefined
|
|
4700
|
+
});
|
|
4701
|
+
},
|
|
4702
|
+
[enableEvent]: (state, {
|
|
4703
|
+
payloadId
|
|
4704
|
+
}) => {
|
|
4705
|
+
if (!state.originalPayloadIds.includes(payloadId)) {
|
|
4706
|
+
return state;
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4709
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4710
|
+
originalPayloadIds: state.originalPayloadIds.filter(id => id !== payloadId)
|
|
4711
|
+
});
|
|
4712
|
+
},
|
|
4713
|
+
[disableEvent]: (state, {
|
|
4714
|
+
payloadId
|
|
4715
|
+
}) => {
|
|
4716
|
+
if (state.originalPayloadIds.includes(payloadId)) {
|
|
4717
|
+
return state;
|
|
4718
|
+
}
|
|
4719
|
+
|
|
4720
|
+
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4721
|
+
originalPayloadIds: [...state.originalPayloadIds, payloadId]
|
|
4722
|
+
});
|
|
4723
|
+
}
|
|
4724
|
+
}, translations_reducer_initialState));
|
|
4054
4725
|
;// CONCATENATED MODULE: ./src/javascripts/lib/css.js
|
|
4055
4726
|
|
|
4056
4727
|
/**
|
|
@@ -4536,6 +5207,9 @@ function form_TranslationsOptionsDialogForm({
|
|
|
4536
5207
|
languages,
|
|
4537
5208
|
currentLocale
|
|
4538
5209
|
} = useTranslations();
|
|
5210
|
+
const {
|
|
5211
|
+
locale: uiLocale
|
|
5212
|
+
} = useI18n();
|
|
4539
5213
|
const languageName = useMemo(() => {
|
|
4540
5214
|
var _languages$find;
|
|
4541
5215
|
|
|
@@ -4545,11 +5219,11 @@ function form_TranslationsOptionsDialogForm({
|
|
|
4545
5219
|
return [{
|
|
4546
5220
|
value: '',
|
|
4547
5221
|
label: t('translations.settings.defaultOptionLabel')
|
|
4548
|
-
}, ...languages.map(language => ({
|
|
5222
|
+
}, ...languages.filter(language => language.locale.toLowerCase() !== String(uiLocale).toLowerCase()).map(language => ({
|
|
4549
5223
|
value: language.locale,
|
|
4550
5224
|
label: language.nativeName
|
|
4551
5225
|
}))];
|
|
4552
|
-
}, [t, languages]);
|
|
5226
|
+
}, [t, languages, uiLocale]);
|
|
4553
5227
|
return _jsxs(Form, {
|
|
4554
5228
|
noValidate: "true",
|
|
4555
5229
|
children: [_jsx("p", {
|
|
@@ -4967,7 +5641,9 @@ function TranslationsChatStatus() {
|
|
|
4967
5641
|
return _jsx(ChatStatus, {
|
|
4968
5642
|
type: "translations",
|
|
4969
5643
|
id: id,
|
|
4970
|
-
label: t('translations.status.label',
|
|
5644
|
+
label: t('translations.status.label', {
|
|
5645
|
+
language: languageName
|
|
5646
|
+
}),
|
|
4971
5647
|
onButtonClick: handleClickStop,
|
|
4972
5648
|
buttonText: t('translations.status.stopText'),
|
|
4973
5649
|
srButtonText: t('translations.status.srStopText')
|
|
@@ -4981,6 +5657,7 @@ function TranslationsChatStatus() {
|
|
|
4981
5657
|
|
|
4982
5658
|
|
|
4983
5659
|
|
|
5660
|
+
|
|
4984
5661
|
;// CONCATENATED MODULE: ./src/javascripts/style-guide/components/static-core.js
|
|
4985
5662
|
const static_core_excluded = ["translations", "interrupt", "config"];
|
|
4986
5663
|
|
|
@@ -4997,6 +5674,7 @@ function static_core_objectWithoutPropertiesLoose(source, excluded) { if (source
|
|
|
4997
5674
|
|
|
4998
5675
|
|
|
4999
5676
|
|
|
5677
|
+
|
|
5000
5678
|
const bareApi = {
|
|
5001
5679
|
send: () => {},
|
|
5002
5680
|
reset: () => {
|
|
@@ -5010,6 +5688,7 @@ const bareApi = {
|
|
|
5010
5688
|
|
|
5011
5689
|
const SeamlyTestCore = ({
|
|
5012
5690
|
state,
|
|
5691
|
+
translations,
|
|
5013
5692
|
children
|
|
5014
5693
|
}) => {
|
|
5015
5694
|
const liveMsgRef = (0,hooks_namespaceObject.useRef)(() => {});
|
|
@@ -5028,10 +5707,11 @@ const SeamlyTestCore = ({
|
|
|
5028
5707
|
const newStore = (0,web_ui_namespaceObject.createReduxStore)({
|
|
5029
5708
|
reducers: {
|
|
5030
5709
|
state: stateReducer,
|
|
5710
|
+
[String(app_reducer)]: app_reducer,
|
|
5031
5711
|
[String(config_reducer)]: config_reducer,
|
|
5032
5712
|
[String(reducer)]: reducer,
|
|
5033
5713
|
[String(translations_reducer)]: translations_reducer,
|
|
5034
|
-
[String(
|
|
5714
|
+
[String(i18n_reducer)]: i18n_reducer,
|
|
5035
5715
|
[String(interrupt_reducer)]: interrupt_reducer
|
|
5036
5716
|
},
|
|
5037
5717
|
initialState: {
|
|
@@ -5041,8 +5721,9 @@ const SeamlyTestCore = ({
|
|
|
5041
5721
|
}
|
|
5042
5722
|
});
|
|
5043
5723
|
newStore.dispatch(initialize(configSlice || {}));
|
|
5724
|
+
newStore.dispatch(setLocaleResolve('en-GB', translations));
|
|
5044
5725
|
return newStore;
|
|
5045
|
-
}, [state]);
|
|
5726
|
+
}, [state, translations]);
|
|
5046
5727
|
return state && (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.StoreProvider, {
|
|
5047
5728
|
store: store,
|
|
5048
5729
|
children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.SeamlyEventBusContext.Provider, {
|
|
@@ -5694,7 +6375,7 @@ const imageMessage = {
|
|
|
5694
6375
|
description: 'Plaatje',
|
|
5695
6376
|
isZoomable: false,
|
|
5696
6377
|
type: 'image',
|
|
5697
|
-
url: 'https://
|
|
6378
|
+
url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg'
|
|
5698
6379
|
},
|
|
5699
6380
|
fromClient: false,
|
|
5700
6381
|
fromHistory: true,
|
|
@@ -5722,7 +6403,7 @@ const imageMessageWithLightbox = {
|
|
|
5722
6403
|
description: 'Plaatje',
|
|
5723
6404
|
isZoomable: true,
|
|
5724
6405
|
type: 'image',
|
|
5725
|
-
url: 'https://
|
|
6406
|
+
url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-portrait.jpg'
|
|
5726
6407
|
},
|
|
5727
6408
|
fromClient: false,
|
|
5728
6409
|
fromHistory: true,
|
|
@@ -5870,7 +6551,7 @@ const fileDownloadPayload = {
|
|
|
5870
6551
|
contentType: 'image/jpg',
|
|
5871
6552
|
filename: 'placeholder.jpg',
|
|
5872
6553
|
filesize: 991078,
|
|
5873
|
-
url: 'https://
|
|
6554
|
+
url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg'
|
|
5874
6555
|
}
|
|
5875
6556
|
};
|
|
5876
6557
|
const fileDownloadAgentMessage = {
|
|
@@ -5998,7 +6679,7 @@ const cardAskText = {
|
|
|
5998
6679
|
},
|
|
5999
6680
|
buttonText: 'Ask about pizzas!',
|
|
6000
6681
|
description: 'Pizza Margherita is a **typical Neapolitan pizza**.\n\nIt is made with San Marzano tomatoes, mozzarella cheese, fresh basil, salt, and extra-virgin olive oil.',
|
|
6001
|
-
image: 'https://
|
|
6682
|
+
image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-square.jpg',
|
|
6002
6683
|
title: 'Pizza Margherita'
|
|
6003
6684
|
}
|
|
6004
6685
|
}
|
|
@@ -6016,7 +6697,7 @@ const cardNavigate = {
|
|
|
6016
6697
|
},
|
|
6017
6698
|
buttonText: 'Order now!',
|
|
6018
6699
|
description: 'Pizza Margherita is a **typical Neapolitan pizza**.',
|
|
6019
|
-
image: 'https://
|
|
6700
|
+
image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-landscape.jpg',
|
|
6020
6701
|
title: 'Pizza Margherita'
|
|
6021
6702
|
}
|
|
6022
6703
|
}
|
|
@@ -6032,7 +6713,7 @@ const cardTopic = {
|
|
|
6032
6713
|
type: 'topic'
|
|
6033
6714
|
},
|
|
6034
6715
|
buttonText: 'Set topic! (title & description optional)',
|
|
6035
|
-
image: 'https://
|
|
6716
|
+
image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-portrait.jpg'
|
|
6036
6717
|
}
|
|
6037
6718
|
}
|
|
6038
6719
|
};
|
|
@@ -6309,9 +6990,9 @@ const standardState = {
|
|
|
6309
6990
|
showDisclaimer: true
|
|
6310
6991
|
})
|
|
6311
6992
|
}),
|
|
6312
|
-
|
|
6993
|
+
chatStatusBar: states_objectSpread(states_objectSpread({
|
|
6313
6994
|
category: categoryKeys.features,
|
|
6314
|
-
headingText: `
|
|
6995
|
+
headingText: `Chat status bar`,
|
|
6315
6996
|
description: ''
|
|
6316
6997
|
}, baseState), {}, {
|
|
6317
6998
|
options: {
|
|
@@ -7082,6 +7763,7 @@ function app_defineProperty(obj, key, value) { if (key in obj) { Object.definePr
|
|
|
7082
7763
|
const StyleGuideApp = ({
|
|
7083
7764
|
config,
|
|
7084
7765
|
styleGuideConfig,
|
|
7766
|
+
translations,
|
|
7085
7767
|
headingLevel = 2
|
|
7086
7768
|
}) => {
|
|
7087
7769
|
const [staticState, setStaticState] = (0,hooks_namespaceObject.useState)(null);
|
|
@@ -7213,7 +7895,7 @@ const StyleGuideApp = ({
|
|
|
7213
7895
|
}), (0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
7214
7896
|
children: showStyleGuide && (0,jsx_runtime_namespaceObject.jsx)(view, {
|
|
7215
7897
|
customComponents: styleGuideConfig.customComponents,
|
|
7216
|
-
translations:
|
|
7898
|
+
translations: translations,
|
|
7217
7899
|
state: staticState
|
|
7218
7900
|
})
|
|
7219
7901
|
})]
|
|
@@ -7250,7 +7932,6 @@ function style_guide_engine_objectWithoutPropertiesLoose(source, excluded) { if
|
|
|
7250
7932
|
|
|
7251
7933
|
|
|
7252
7934
|
|
|
7253
|
-
|
|
7254
7935
|
class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
|
|
7255
7936
|
constructor(_ref, externalApi) {
|
|
7256
7937
|
let {
|
|
@@ -7262,23 +7943,28 @@ class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
|
|
|
7262
7943
|
this.styleGuideConfig = styleGuideConfig || {};
|
|
7263
7944
|
}
|
|
7264
7945
|
|
|
7265
|
-
render() {
|
|
7946
|
+
async render() {
|
|
7266
7947
|
const restComponents = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config.customComponents || {}), {}, {
|
|
7267
7948
|
view: undefined
|
|
7268
7949
|
});
|
|
7269
7950
|
|
|
7951
|
+
const api = new web_ui_namespaceObject.API({
|
|
7952
|
+
namespace: this.config.namespace,
|
|
7953
|
+
config: this.config.api
|
|
7954
|
+
});
|
|
7955
|
+
api.URLS = {
|
|
7956
|
+
translations: '/client/wilson/translations/{version}/{locale}.json'
|
|
7957
|
+
};
|
|
7958
|
+
const translations = await api.getTranslations('en-GB');
|
|
7959
|
+
|
|
7270
7960
|
const renderConfig = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config), {}, {
|
|
7271
|
-
customComponents: Object.keys(restComponents).length ? restComponents : undefined
|
|
7272
|
-
translations: this.config.translations || style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, (en_default())), {}, {
|
|
7273
|
-
disclaimer: style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, (en_default()).disclaimer), {}, {
|
|
7274
|
-
content: 'This chat session will be saved to help us improve our service delivery. <a href="https://seamly.ai/">More information</a>'
|
|
7275
|
-
})
|
|
7276
|
-
})
|
|
7961
|
+
customComponents: Object.keys(restComponents).length ? restComponents : undefined
|
|
7277
7962
|
});
|
|
7278
7963
|
|
|
7279
7964
|
(0,external_preact_namespaceObject.render)((0,jsx_runtime_namespaceObject.jsx)(app, {
|
|
7280
7965
|
config: renderConfig,
|
|
7281
|
-
styleGuideConfig: this.styleGuideConfig
|
|
7966
|
+
styleGuideConfig: this.styleGuideConfig,
|
|
7967
|
+
translations: translations
|
|
7282
7968
|
}), this.parentElement);
|
|
7283
7969
|
}
|
|
7284
7970
|
|