@seamly/web-ui 18.3.0-beta.1 → 19.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/lib/index.debug.js +348 -73
- 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 +5247 -5187
- 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 +2334 -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 +1480 -796
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +27 -28
- package/src/javascripts/api/index.js +25 -40
- package/src/javascripts/api/producer.js +3 -6
- package/src/javascripts/config.js +3 -3
- package/src/javascripts/domains/app/actions.js +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 +14 -11
- package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +1 -1
- package/src/javascripts/ui/components/conversation/event/upload.js +2 -2
- package/src/javascripts/ui/components/core/seamly-activity-monitor.js +2 -0
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +2 -0
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +1 -7
- package/src/javascripts/ui/components/core/seamly-new-notifications.js +5 -6
- package/src/javascripts/ui/components/core/seamly-read-state.js +6 -4
- package/src/javascripts/ui/components/entry/text-entry/hooks.js +6 -4
- package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +10 -3
- package/src/javascripts/ui/components/entry/upload/file-upload-form.js +6 -3
- package/src/javascripts/ui/components/entry/upload/index.js +8 -3
- package/src/javascripts/ui/components/faq/faq.js +2 -2
- package/src/javascripts/ui/components/layout/app-frame.js +11 -8
- package/src/javascripts/ui/components/layout/interrupt.js +6 -2
- package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +1 -1
- package/src/javascripts/ui/components/widgets/upload-progress.js +1 -1
- package/src/javascripts/ui/hooks/seamly-api-hooks.js +0 -6
- package/src/javascripts/ui/hooks/seamly-entry-hooks.js +17 -21
- package/src/javascripts/ui/hooks/seamly-hooks.js +0 -1
- package/src/javascripts/ui/hooks/use-seamly-commands.js +5 -6
- package/src/javascripts/ui/hooks/use-seamly-visibility.js +3 -5
- package/src/javascripts/ui/hooks/use-single-file-upload.js +4 -1
- package/src/javascripts/ui/utils/general-utils.js +6 -13
- package/src/stylesheets/1-settings/_config.scss +2 -1
- package/src/stylesheets/3-app/_app.scss +3 -4
- package/src/stylesheets/5-components/_faq.scss +3 -8
- package/src/stylesheets/5-components/_modal.scss +3 -3
- package/webpack/config.package.js +0 -18
- package/webpack/config.site.js +6 -0
- package/webpack/defaults.js +0 -3
- package/CHANGELOG.md +0 -572
- 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,121 +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
|
-
var _state$formId2;
|
|
1396
|
-
|
|
1397
|
-
const formState = persistData ? (_state$formId2 = state[formId]) !== null && _state$formId2 !== void 0 ? _state$formId2 : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1398
|
-
persistData
|
|
1399
|
-
}) : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
1400
|
-
persistData
|
|
1401
|
-
});
|
|
1402
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1403
|
-
[formId]: formState
|
|
1404
|
-
});
|
|
1405
|
-
},
|
|
1406
|
-
[deregisterForm]: (state, {
|
|
1407
|
-
formId
|
|
1408
|
-
}) => {
|
|
1409
|
-
var _newState$formId;
|
|
1410
|
-
|
|
1411
|
-
const newState = reducer_objectSpread({}, state);
|
|
1412
|
-
|
|
1413
|
-
if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
|
|
1414
|
-
delete newState[formId];
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
return newState;
|
|
1418
|
-
},
|
|
1419
|
-
// Form control handlers
|
|
1420
|
-
[registerControl]: (state, {
|
|
1421
|
-
name,
|
|
1422
|
-
formId
|
|
1423
|
-
}) => {
|
|
1424
|
-
return updateFormControl(state, formId, name);
|
|
1425
|
-
},
|
|
1426
|
-
[deregisterControl]: (state, {
|
|
1427
|
-
formId,
|
|
1428
|
-
name
|
|
1429
|
-
}) => {
|
|
1430
|
-
const form = state[formId];
|
|
1431
|
-
|
|
1432
|
-
if (!form) {
|
|
1433
|
-
return state;
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
if (form.persistData) {
|
|
1437
|
-
return state;
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
const controls = reducer_objectSpread({}, form.controls);
|
|
1441
|
-
|
|
1442
|
-
delete controls[name];
|
|
1443
|
-
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
1444
|
-
[formId]: reducer_objectSpread(reducer_objectSpread({}, form), {}, {
|
|
1445
|
-
controls
|
|
1446
|
-
})
|
|
1447
|
-
});
|
|
1448
|
-
},
|
|
1449
|
-
[updateControlValue]: (state, {
|
|
1450
|
-
formId,
|
|
1451
|
-
name,
|
|
1452
|
-
value
|
|
1453
|
-
}) => {
|
|
1454
|
-
return updateFormControl(state, formId, name, {
|
|
1455
|
-
value
|
|
1456
|
-
});
|
|
1457
|
-
},
|
|
1458
|
-
[updateControlTouched]: (state, {
|
|
1459
|
-
formId,
|
|
1460
|
-
name,
|
|
1461
|
-
touched
|
|
1462
|
-
}) => {
|
|
1463
|
-
return updateFormControl(state, formId, name, {
|
|
1464
|
-
touched
|
|
1465
|
-
});
|
|
1466
|
-
}
|
|
1467
|
-
}, reducer_initialState));
|
|
1468
1367
|
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/selectors.js
|
|
1469
1368
|
|
|
1470
1369
|
|
|
1471
1370
|
|
|
1472
|
-
const getState =
|
|
1371
|
+
const getState = selectState;
|
|
1473
1372
|
const selectors_getFormById = createSelector(getState, getPropSelector('formId'), (forms, formId) => forms[formId]);
|
|
1474
1373
|
const getFormControlsByFormId = createSelector(selectors_getFormById, form => (form === null || form === void 0 ? void 0 : form.controls) || {});
|
|
1475
1374
|
const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId, controls => {
|
|
@@ -1531,6 +1430,7 @@ function hooks_useSelector(selector, deps = []) {
|
|
|
1531
1430
|
const valueRef = useRef(); // instead of accepting a stabilized selector, we stick to the signature
|
|
1532
1431
|
// of useCallback, as that makes the exposed api much more dev-friendly
|
|
1533
1432
|
// otherwise you'd have to stabilize selectors externally
|
|
1433
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1534
1434
|
|
|
1535
1435
|
const selectorCb = useCallback(selector, deps); // we're keeping the selector in a ref to compare against
|
|
1536
1436
|
// we need this both in the store subscription and for
|
|
@@ -1780,6 +1680,114 @@ function provider_FormProvider(_ref) {
|
|
|
1780
1680
|
children: children
|
|
1781
1681
|
}));
|
|
1782
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));
|
|
1783
1791
|
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/index.js
|
|
1784
1792
|
|
|
1785
1793
|
|
|
@@ -1787,18 +1795,22 @@ function provider_FormProvider(_ref) {
|
|
|
1787
1795
|
|
|
1788
1796
|
|
|
1789
1797
|
|
|
1790
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/
|
|
1798
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
1791
1799
|
|
|
1792
1800
|
const {
|
|
1793
|
-
createActions:
|
|
1801
|
+
createActions: translations_utils_createActions,
|
|
1802
|
+
createReducer: translations_utils_createReducer,
|
|
1803
|
+
selectState: utils_selectState
|
|
1794
1804
|
} = createDomain('translations');
|
|
1795
|
-
|
|
1805
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
1806
|
+
|
|
1807
|
+
const [enable, disable] = translations_utils_createActions('translate', {
|
|
1796
1808
|
enable: locale => ({
|
|
1797
1809
|
locale
|
|
1798
1810
|
}),
|
|
1799
1811
|
disable: () => ({})
|
|
1800
1812
|
});
|
|
1801
|
-
const [enableEvent, disableEvent] =
|
|
1813
|
+
const [enableEvent, disableEvent] = translations_utils_createActions('event', {
|
|
1802
1814
|
enable: payloadId => ({
|
|
1803
1815
|
payloadId
|
|
1804
1816
|
}),
|
|
@@ -1806,96 +1818,14 @@ const [enableEvent, disableEvent] = translations_actions_createActions('event',
|
|
|
1806
1818
|
payloadId
|
|
1807
1819
|
})
|
|
1808
1820
|
});
|
|
1809
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/
|
|
1810
|
-
function translations_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1821
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/selectors.js
|
|
1811
1822
|
|
|
1812
|
-
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; }
|
|
1813
1823
|
|
|
1814
|
-
function translations_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1815
1824
|
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
const translations_reducer_initialState = {
|
|
1821
|
-
isActive: false,
|
|
1822
|
-
currentLocale: undefined,
|
|
1823
|
-
isAvailable: false,
|
|
1824
|
-
languages: [],
|
|
1825
|
-
originalPayloadIds: [],
|
|
1826
|
-
containerId: id_randomId()
|
|
1827
|
-
};
|
|
1828
|
-
/* harmony default export */ const translations_reducer = (createReducer('translations', {
|
|
1829
|
-
[seamly_utils_seamlyActions.SET_FEATURES]: (state, action) => {
|
|
1830
|
-
var _action$features;
|
|
1831
|
-
|
|
1832
|
-
const feature = action === null || action === void 0 ? void 0 : (_action$features = action.features) === null || _action$features === void 0 ? void 0 : _action$features.translation;
|
|
1833
|
-
|
|
1834
|
-
if (!feature) {
|
|
1835
|
-
return state;
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1839
|
-
isAvailable: feature.enabled === true,
|
|
1840
|
-
languages: feature.languages || []
|
|
1841
|
-
});
|
|
1842
|
-
},
|
|
1843
|
-
[seamly_utils_seamlyActions.SET_HISTORY]: (state, {
|
|
1844
|
-
history
|
|
1845
|
-
}) => {
|
|
1846
|
-
var _history$translation, _history$translation2;
|
|
1847
|
-
|
|
1848
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1849
|
-
isActive: history === null || history === void 0 ? void 0 : (_history$translation = history.translation) === null || _history$translation === void 0 ? void 0 : _history$translation.enabled,
|
|
1850
|
-
currentLocale: history === null || history === void 0 ? void 0 : (_history$translation2 = history.translation) === null || _history$translation2 === void 0 ? void 0 : _history$translation2.locale
|
|
1851
|
-
});
|
|
1852
|
-
},
|
|
1853
|
-
[seamly_utils_seamlyActions.CLEAR_FEATURES]: () => translations_reducer_initialState,
|
|
1854
|
-
[enable]: (state, {
|
|
1855
|
-
locale
|
|
1856
|
-
}) => {
|
|
1857
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1858
|
-
isActive: true,
|
|
1859
|
-
currentLocale: locale
|
|
1860
|
-
});
|
|
1861
|
-
},
|
|
1862
|
-
[disable]: state => {
|
|
1863
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1864
|
-
isActive: false,
|
|
1865
|
-
currentLocale: undefined
|
|
1866
|
-
});
|
|
1867
|
-
},
|
|
1868
|
-
[enableEvent]: (state, {
|
|
1869
|
-
payloadId
|
|
1870
|
-
}) => {
|
|
1871
|
-
if (!state.originalPayloadIds.includes(payloadId)) {
|
|
1872
|
-
return state;
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1876
|
-
originalPayloadIds: state.originalPayloadIds.filter(id => id !== payloadId)
|
|
1877
|
-
});
|
|
1878
|
-
},
|
|
1879
|
-
[disableEvent]: (state, {
|
|
1880
|
-
payloadId
|
|
1881
|
-
}) => {
|
|
1882
|
-
if (state.originalPayloadIds.includes(payloadId)) {
|
|
1883
|
-
return state;
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
|
-
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
1887
|
-
originalPayloadIds: [...state.originalPayloadIds, payloadId]
|
|
1888
|
-
});
|
|
1889
|
-
}
|
|
1890
|
-
}, translations_reducer_initialState));
|
|
1891
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/selectors.js
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
const selectors_getState = state => state[String(translations_reducer)];
|
|
1896
|
-
const getOriginalPayloadIds = createSelector(selectors_getState, state => state.originalPayloadIds);
|
|
1897
|
-
const getIsPayloadTranslated = createSelector(getOriginalPayloadIds, getPropSelector('payloadId'), (payloadIds, payloadId) => !payloadIds.includes(payloadId));
|
|
1898
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-api-context.js
|
|
1825
|
+
const selectors_getState = utils_selectState;
|
|
1826
|
+
const getOriginalPayloadIds = createSelector(selectors_getState, state => state.originalPayloadIds);
|
|
1827
|
+
const getIsPayloadTranslated = createSelector(getOriginalPayloadIds, getPropSelector('payloadId'), (payloadIds, payloadId) => !payloadIds.includes(payloadId));
|
|
1828
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-api-context.js
|
|
1899
1829
|
|
|
1900
1830
|
const seamly_api_context_SeamlyApiContext = (0,external_preact_namespaceObject.createContext)(null);
|
|
1901
1831
|
const seamly_api_context_SeamlyEventBusContext = (0,external_preact_namespaceObject.createContext)('');
|
|
@@ -1922,23 +1852,81 @@ const seamly_api_hooks_useSeamlyHasConversation = () => {
|
|
|
1922
1852
|
const url = useSeamlyConversationUrl();
|
|
1923
1853
|
return !!url;
|
|
1924
1854
|
};
|
|
1925
|
-
|
|
1926
|
-
const {
|
|
1927
|
-
get
|
|
1928
|
-
} = seamly_api_hooks_useSeamlyObjectStore();
|
|
1929
|
-
return get ? !!get('userResponded') : false;
|
|
1930
|
-
};
|
|
1931
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
|
|
1855
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/utils.js
|
|
1932
1856
|
|
|
1933
1857
|
const {
|
|
1934
|
-
createAction:
|
|
1858
|
+
createAction: utils_createAction,
|
|
1859
|
+
createThunk: utils_createThunk,
|
|
1860
|
+
createReducer: config_utils_createReducer,
|
|
1861
|
+
selectState: config_utils_selectState
|
|
1935
1862
|
} = createDomain('config');
|
|
1936
|
-
|
|
1863
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/actions.js
|
|
1864
|
+
|
|
1865
|
+
const initialize = utils_createAction('initialize', config => ({
|
|
1937
1866
|
config
|
|
1938
1867
|
}));
|
|
1939
|
-
const update =
|
|
1868
|
+
const update = utils_createAction('update', config => ({
|
|
1940
1869
|
config
|
|
1941
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
|
+
}
|
|
1942
1930
|
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
1943
1931
|
const CSS_NAME = 'cvco';
|
|
1944
1932
|
const apiVersion = '2';
|
|
@@ -1951,7 +1939,9 @@ const config_screenReaderDebounceDelaySeconds = 10;
|
|
|
1951
1939
|
const activitySendDelay = 15000;
|
|
1952
1940
|
const maxCharacterWarningLimit = 50;
|
|
1953
1941
|
const maxCharacterSrDebounceDelay = 300;
|
|
1954
|
-
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;
|
|
1955
1945
|
const defaultConfig = {
|
|
1956
1946
|
namespace: 'default',
|
|
1957
1947
|
layoutMode: 'window',
|
|
@@ -1973,14 +1963,10 @@ const defaultConfig = {
|
|
|
1973
1963
|
|
|
1974
1964
|
}
|
|
1975
1965
|
},
|
|
1976
|
-
typing: {
|
|
1977
|
-
timeout: 2000 // How long to wait before we decide the user isn't typing
|
|
1978
|
-
|
|
1979
|
-
},
|
|
1980
1966
|
appContainerClassNames: config => [`app--layout-${config.layoutMode}`, `namespace--${config.namespace}`]
|
|
1981
1967
|
};
|
|
1982
1968
|
;// CONCATENATED MODULE: ./src/javascripts/domains/config/reducer.js
|
|
1983
|
-
const reducer_excluded = ["messages"
|
|
1969
|
+
const reducer_excluded = ["messages"];
|
|
1984
1970
|
|
|
1985
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; }
|
|
1986
1972
|
|
|
@@ -2005,15 +1991,14 @@ const config_reducer_initialState = config_reducer_objectSpread(config_reducer_o
|
|
|
2005
1991
|
defaults: {}
|
|
2006
1992
|
});
|
|
2007
1993
|
|
|
2008
|
-
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'];
|
|
2009
1995
|
|
|
2010
1996
|
const updateState = (state, {
|
|
2011
1997
|
config
|
|
2012
1998
|
}) => {
|
|
2013
1999
|
const _pick = pick(config, configKeys),
|
|
2014
2000
|
{
|
|
2015
|
-
messages
|
|
2016
|
-
typing
|
|
2001
|
+
messages
|
|
2017
2002
|
} = _pick,
|
|
2018
2003
|
partialConfig = reducer_objectWithoutProperties(_pick, reducer_excluded);
|
|
2019
2004
|
|
|
@@ -2029,16 +2014,10 @@ const updateState = (state, {
|
|
|
2029
2014
|
});
|
|
2030
2015
|
}
|
|
2031
2016
|
|
|
2032
|
-
if (typing) {
|
|
2033
|
-
newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), {}, {
|
|
2034
|
-
typing: config_reducer_objectSpread(config_reducer_objectSpread({}, newState.typing), typing)
|
|
2035
|
-
});
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
2017
|
return newState;
|
|
2039
2018
|
};
|
|
2040
2019
|
|
|
2041
|
-
/* harmony default export */ const config_reducer = (
|
|
2020
|
+
/* harmony default export */ const config_reducer = (config_utils_createReducer({
|
|
2042
2021
|
[initialize]: (state, action) => {
|
|
2043
2022
|
return updateState(state, action);
|
|
2044
2023
|
},
|
|
@@ -2046,448 +2025,80 @@ const updateState = (state, {
|
|
|
2046
2025
|
return updateState(state, action);
|
|
2047
2026
|
}
|
|
2048
2027
|
}, config_reducer_initialState));
|
|
2049
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/
|
|
2050
|
-
function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2051
|
-
|
|
2052
|
-
function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { selectors_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2053
|
-
|
|
2054
|
-
function selectors_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2028
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
2058
2029
|
|
|
2059
|
-
const selectState = state => state[String(config_reducer)];
|
|
2060
|
-
const selectConfig = createSelector(selectState, config => {
|
|
2061
|
-
let newConfig = selectors_objectSpread({
|
|
2062
|
-
visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? seamly_utils_visibilityStates.open : seamly_utils_visibilityStates.minimized,
|
|
2063
|
-
appContainerClassNames: config.appContainerClassNames || []
|
|
2064
|
-
}, config);
|
|
2065
2030
|
|
|
2066
|
-
if (typeof newConfig.appContainerClassNames === 'function') {
|
|
2067
|
-
newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
|
|
2068
|
-
appContainerClassNames: newConfig.appContainerClassNames(newConfig)
|
|
2069
|
-
});
|
|
2070
|
-
}
|
|
2071
2031
|
|
|
2072
|
-
return newConfig;
|
|
2073
|
-
});
|
|
2074
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
|
|
2075
2032
|
|
|
2076
2033
|
|
|
2077
|
-
function hooks_useConfig() {
|
|
2078
|
-
return useSelector(Selectors.selectConfig);
|
|
2079
|
-
}
|
|
2080
|
-
;// CONCATENATED MODULE: ./translations/en.js
|
|
2081
|
-
// Please note: All texts containing the string 'srText' are short for
|
|
2082
|
-
// Screen Reader Text. These texts are invisible on screen but broadcast
|
|
2083
|
-
// to screen readers. Avoid undue verbosity, but ensure that a user who cannot
|
|
2084
|
-
// see the screen will get both the message content as well as the context
|
|
2085
|
-
// in which the message occurred if not already clear from the current
|
|
2086
|
-
// position of the keyboard focus.
|
|
2087
|
-
// Example: An error occurs in the chat window and this error has an 'srText'
|
|
2088
|
-
// entry. Because the error could occur while the user is NOT chatting in the window,
|
|
2089
|
-
// add context such as "Something went wrong with the chat session" as just saying
|
|
2090
|
-
// "Something went wrong" would not be clear enough for users who cannot see the
|
|
2091
|
-
// source of the error on screen.
|
|
2092
|
-
/* harmony default export */ const en = ({
|
|
2093
|
-
'carousel.controls.next': 'Next',
|
|
2094
|
-
'carousel.controls.previous': 'Previous',
|
|
2095
|
-
'carousel.slide.label': ({
|
|
2096
|
-
index,
|
|
2097
|
-
total
|
|
2098
|
-
}) => `${index} of ${total}`,
|
|
2099
|
-
'dateTime.srText': ({
|
|
2100
|
-
date,
|
|
2101
|
-
time
|
|
2102
|
-
}) => `Messages starting ${date} at ${time}:`,
|
|
2103
|
-
'dateTime.today': 'Today',
|
|
2104
|
-
'dateTime.yesterday': 'Yesterday',
|
|
2105
|
-
'disclaimer.content': 'This chat session will be saved to help us improve our service delivery.',
|
|
2106
|
-
'disclaimer.title': 'Privacy disclaimer',
|
|
2107
|
-
'dividerKeys.newTopic': 'New topic started.',
|
|
2108
|
-
'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
|
|
2109
|
-
'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
|
|
2110
|
-
'errors.configError.title': 'Chat configuration error.',
|
|
2111
|
-
'errors.general.buttonText': 'Restart chat',
|
|
2112
|
-
'errors.general.message': 'Do you want to start a new chat session?',
|
|
2113
|
-
'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
|
|
2114
|
-
'errors.general.title': 'Something went wrong',
|
|
2115
|
-
'errors.seamlyOffline.message': 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
|
|
2116
|
-
'errors.seamlyOffline.srText': 'The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.',
|
|
2117
|
-
'errors.seamlyOffline.title': 'Connection issues',
|
|
2118
|
-
'faq.headingText': 'Suggested topics',
|
|
2119
|
-
'faq.srAvailableText': 'Suggested topics are available in the chat.',
|
|
2120
|
-
'faq.srUnavailableText': 'Suggested topics are no longer available in the chat.',
|
|
2121
|
-
'faq.srUpdatedText': 'There are new suggested topics in the chat.',
|
|
2122
|
-
'fileUpload.cancelButtonText': 'Cancel upload',
|
|
2123
|
-
'fileUpload.contentHint': size => `Select a file of maximum ${size}`,
|
|
2124
|
-
'fileUpload.errors.general': 'Something went wrong with the upload. Please cancel the upload and try again.',
|
|
2125
|
-
'fileUpload.errors.noFile': 'Please select a file to upload',
|
|
2126
|
-
'fileUpload.errors.tooLarge': 'The selected file is too large, please upload a smaller file',
|
|
2127
|
-
'fileUpload.errors.unavailable': 'Uploading files is no longer possible. Please cancel the upload and try again later.',
|
|
2128
|
-
'fileUpload.errors.virusFound': 'The selected file is unsafe, please upload a different file.',
|
|
2129
|
-
'fileUpload.errors.wrongType': 'The selected file type is not supported. Please cancel the upload and upload a different file.',
|
|
2130
|
-
'fileUpload.fileUnavailableText': 'This download link has expired',
|
|
2131
|
-
'fileUpload.labelText': 'Select file',
|
|
2132
|
-
'fileUpload.selectedText': fileName => {
|
|
2133
|
-
if (fileName) {
|
|
2134
|
-
return fileName;
|
|
2135
|
-
} else {
|
|
2136
|
-
return 'No file selected';
|
|
2137
|
-
}
|
|
2138
|
-
},
|
|
2139
|
-
'fileUpload.srAvailableText': 'File uploads are now available in the chat.',
|
|
2140
|
-
'fileUpload.srCompleteText': 'Upload complete.',
|
|
2141
|
-
'fileUpload.srFileDownloadText': fileName => `Download file ${fileName}.`,
|
|
2142
|
-
'fileUpload.srFileUploadedText': fileName => `Uploaded file ${fileName}.`,
|
|
2143
|
-
'fileUpload.srProgressLabel': fileName => `${fileName} upload progress status`,
|
|
2144
|
-
'fileUpload.srStartedText': 'Upload started.',
|
|
2145
|
-
'fileUpload.srUnavailableText': 'File uploads in the chat are no longer available.',
|
|
2146
|
-
'fileUpload.toggleButtonText': 'Upload files',
|
|
2147
|
-
'fileUpload.uploadButtonText': 'Upload file',
|
|
2148
|
-
'header.collapseApp': 'collapse chat',
|
|
2149
|
-
'header.title': 'You\'re talking to',
|
|
2150
|
-
'idleDetachWarning.continueButton': 'Continue conversation',
|
|
2151
|
-
'idleDetachWarning.countdownText': 'Your conversation will automatically end in:',
|
|
2152
|
-
'idleDetachWarning.countdownTimer': ({
|
|
2153
|
-
minutes,
|
|
2154
|
-
seconds
|
|
2155
|
-
}) => {
|
|
2156
|
-
switch (minutes) {
|
|
2157
|
-
case 1:
|
|
2158
|
-
switch (seconds) {
|
|
2159
|
-
case 1:
|
|
2160
|
-
return '1 minute, 1 second';
|
|
2161
2034
|
|
|
2162
|
-
|
|
2163
|
-
|
|
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; }
|
|
2164
2037
|
|
|
2165
|
-
|
|
2166
|
-
return `1 minute, ${seconds} seconds`;
|
|
2167
|
-
}
|
|
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; }
|
|
2168
2039
|
|
|
2169
|
-
|
|
2170
|
-
switch (seconds) {
|
|
2171
|
-
case 1:
|
|
2172
|
-
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; }
|
|
2173
2041
|
|
|
2174
|
-
case 0:
|
|
2175
|
-
default:
|
|
2176
|
-
return `${seconds} seconds`;
|
|
2177
|
-
}
|
|
2178
2042
|
|
|
2179
|
-
default:
|
|
2180
|
-
switch (seconds) {
|
|
2181
|
-
case 1:
|
|
2182
|
-
return `${minutes} minutes, 1 second`;
|
|
2183
2043
|
|
|
2184
|
-
case 0:
|
|
2185
|
-
return `${minutes} minutes`;
|
|
2186
2044
|
|
|
2187
|
-
default:
|
|
2188
|
-
return `${minutes} minutes, ${seconds} seconds`;
|
|
2189
|
-
}
|
|
2190
2045
|
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
'info.cobrowsing.cobrowsingEnded': 'Screen sharing has ended',
|
|
2198
|
-
'info.cobrowsing.cobrowsingStarted': 'Screen sharing is now enabled. The agent can see the page you\'re currently on',
|
|
2199
|
-
'info.sendTranscript.accepted': ({
|
|
2200
|
-
emailAddress
|
|
2201
|
-
}) => `A transcript will be sent to ${emailAddress}`,
|
|
2202
|
-
'input.inputLabel': limit => {
|
|
2203
|
-
if (limit) {
|
|
2204
|
-
return `Your message (max. ${limit} characters)`;
|
|
2205
|
-
}
|
|
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;
|
|
2206
2052
|
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
return `Your message (max. ${limit} characters)`;
|
|
2212
|
-
}
|
|
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) ?? {};
|
|
2213
2057
|
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
'input.srCharacterLimitText': limit => {
|
|
2218
|
-
switch (limit) {
|
|
2219
|
-
case 1:
|
|
2220
|
-
return '1 character remaining.';
|
|
2221
|
-
|
|
2222
|
-
case 0:
|
|
2223
|
-
default:
|
|
2224
|
-
return `${limit} characters remaining.`;
|
|
2225
|
-
}
|
|
2226
|
-
},
|
|
2227
|
-
'lightbox.closeLabel': 'Close',
|
|
2228
|
-
'lightbox.heading': 'Enlarged chat image',
|
|
2229
|
-
'message.choicePrompts.cancelChooseAgain': 'Cancel choice change',
|
|
2230
|
-
'message.choicePrompts.chooseAgain': 'Change your choice',
|
|
2231
|
-
'message.image.srTextEnlargeButtonLabel': ({
|
|
2232
|
-
description
|
|
2233
|
-
}) => `Enlarge ${description}`,
|
|
2234
|
-
'message.srNewEventCount': ({
|
|
2235
|
-
newCount
|
|
2236
|
-
}) => {
|
|
2237
|
-
switch (newCount) {
|
|
2238
|
-
case 1:
|
|
2239
|
-
return `There is 1 new chat message.`;
|
|
2058
|
+
if (!enabled) {
|
|
2059
|
+
return events;
|
|
2060
|
+
}
|
|
2240
2061
|
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
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
|
+
}));
|
|
2244
2075
|
}
|
|
2245
|
-
},
|
|
2246
|
-
'message.srTextUnreadCount': ({
|
|
2247
|
-
unreadCount
|
|
2248
|
-
}) => {
|
|
2249
|
-
switch (unreadCount) {
|
|
2250
|
-
case 1:
|
|
2251
|
-
return `There is 1 new unread chat message.`;
|
|
2252
2076
|
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
}
|
|
2257
|
-
},
|
|
2258
|
-
'options.cancelButtonText': 'Cancel',
|
|
2259
|
-
'options.cobrowsing.cobrowsingActiveText': 'Sharing screen',
|
|
2260
|
-
'options.cobrowsing.cobrowsingUnavailable': 'Screen sharing is currently unavailable.',
|
|
2261
|
-
'options.cobrowsing.description': 'This allows the agent to see the page you\'re currently on. Nothing else is shared.',
|
|
2262
|
-
'options.cobrowsing.labelTurnOff': 'Turn screen sharing off',
|
|
2263
|
-
'options.cobrowsing.labelTurnOn': 'Turn screen sharing on',
|
|
2264
|
-
'options.cobrowsing.menuTitle': 'Screen sharing',
|
|
2265
|
-
'options.cobrowsing.srCobrowsingAvailable': 'Screen sharing is now available.',
|
|
2266
|
-
'options.cobrowsing.srStartedCobrowsingText': 'Screen sharing has been started.',
|
|
2267
|
-
'options.cobrowsing.srStopCobrowsingText': 'Stop screen sharing',
|
|
2268
|
-
'options.cobrowsing.srStoppedCobrowsingText': 'Screen sharing has been stopped.',
|
|
2269
|
-
'options.cobrowsing.stopCobrowsingText': 'Stop',
|
|
2270
|
-
'options.cobrowsing.title': 'Share my screen',
|
|
2271
|
-
'options.openButtonText': 'Options',
|
|
2272
|
-
'options.saveButtonText': 'Save',
|
|
2273
|
-
'options.sendTranscript.description': 'Enter the email address you would like to send the chat transcript to.',
|
|
2274
|
-
'options.sendTranscript.invalidEmailText': 'Please enter a valid email address',
|
|
2275
|
-
'options.sendTranscript.label': 'Email address',
|
|
2276
|
-
'options.sendTranscript.menuTitle': 'Send transcript',
|
|
2277
|
-
'options.sendTranscript.noEmailText': 'Please enter an email address',
|
|
2278
|
-
'options.sendTranscript.sendButtonText': 'Send',
|
|
2279
|
-
'options.sendTranscript.title': 'Send chat transcript',
|
|
2280
|
-
'options.unavailableText': 'unavailable',
|
|
2281
|
-
'resumeConversationPrompt.continueButton': 'Resume conversation',
|
|
2282
|
-
'resumeConversationPrompt.detachButton': 'Ask new question',
|
|
2283
|
-
'resumeConversationPrompt.title': name => `Would you like to continue the conversation with ${name}?`,
|
|
2284
|
-
skiplinkText: 'Skip to chat input',
|
|
2285
|
-
'toggleButton.resumeTitle': 'Resume chat with',
|
|
2286
|
-
'toggleButton.subtitle': 'Start a chat with us',
|
|
2287
|
-
'toggleButton.title': 'Have a question?',
|
|
2288
|
-
'translations.divider.restartButtonText': 'Start again',
|
|
2289
|
-
'translations.divider.startText': language => `Translating to ${language}`,
|
|
2290
|
-
'translations.divider.stopText': language => `Translating to ${language} ended`,
|
|
2291
|
-
'translations.settings.cancelButtonText': 'Cancel',
|
|
2292
|
-
'translations.settings.currentTranslationLabel': 'Currently translating to',
|
|
2293
|
-
'translations.settings.defaultOptionLabel': 'Choose language',
|
|
2294
|
-
'translations.settings.description': 'Automatic translations might contain errors.',
|
|
2295
|
-
'translations.settings.endButtonText': 'Stop translating',
|
|
2296
|
-
'translations.settings.inputLabel': 'Translate chat to',
|
|
2297
|
-
'translations.settings.noLocaleText': 'Choose a language to translate to',
|
|
2298
|
-
'translations.settings.openButtonText': 'Translation',
|
|
2299
|
-
'translations.settings.startButtonText': 'Start translating',
|
|
2300
|
-
'translations.settings.title': 'Translation',
|
|
2301
|
-
'translations.status.label': language => `Translating to ${language}`,
|
|
2302
|
-
'translations.status.srStopText': 'Stop translating',
|
|
2303
|
-
'translations.status.stopText': 'Stop',
|
|
2304
|
-
'translations.toggle.hideButtonText': 'Show original',
|
|
2305
|
-
'translations.toggle.showButtonText': 'Show translation',
|
|
2306
|
-
'window.srModalLayoutLabel': 'Chat window',
|
|
2307
|
-
'window.srTexts.onClose': 'The chat is closed.',
|
|
2308
|
-
'window.srTexts.onHistoryLoad': 'Chat history has been loaded.',
|
|
2309
|
-
'window.srTexts.onLoad': 'Chat is available on this page.',
|
|
2310
|
-
'window.srTexts.onOpen': 'The chat is opened.'
|
|
2077
|
+
previousEvent = event;
|
|
2078
|
+
});
|
|
2079
|
+
return mappedEvents;
|
|
2311
2080
|
});
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
// Actions
|
|
2325
|
-
|
|
2326
|
-
const {
|
|
2327
|
-
createAction: i18n_createAction
|
|
2328
|
-
} = createDomain('i18n');
|
|
2329
|
-
const i18n_initI18n = i18n_createAction('init', overrides => ({
|
|
2330
|
-
overrides
|
|
2331
|
-
}));
|
|
2332
|
-
const i18n_Actions = {
|
|
2333
|
-
initI18n: i18n_initI18n
|
|
2334
|
-
}; // Reducer
|
|
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;
|
|
2335
2090
|
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
const
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
}
|
|
2348
|
-
}, defaultState); // Selectors
|
|
2349
|
-
|
|
2350
|
-
const i18n_getState = state => state[String(Reducer)];
|
|
2351
|
-
const getTranslations = createSelector(i18n_getState, state => state.translations);
|
|
2352
|
-
const getOverrides = createSelector(i18n_getState, state => state.overrides || {});
|
|
2353
|
-
const getCombinedTranslations = createSelector(getTranslations, getOverrides, (translations, overrides) => {
|
|
2354
|
-
const overrideKeys = Object.keys(overrides);
|
|
2355
|
-
|
|
2356
|
-
if (overrideKeys.length === 0) {
|
|
2357
|
-
return translations;
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
const defaultKeys = Object.keys(translations);
|
|
2361
|
-
defaultKeys.forEach(key => {
|
|
2362
|
-
if (overrideKeys.indexOf(key) === -1) {
|
|
2363
|
-
console.error('Seamly: Missing translation key:', key);
|
|
2364
|
-
}
|
|
2365
|
-
});
|
|
2366
|
-
return i18n_objectSpread(i18n_objectSpread({}, translations), overrides);
|
|
2367
|
-
}); // Hooks
|
|
2368
|
-
|
|
2369
|
-
function i18n_useI18n() {
|
|
2370
|
-
const translations = useSelector(getCombinedTranslations);
|
|
2371
|
-
const t = useCallback((key, values = {}) => {
|
|
2372
|
-
const translation = translations[key];
|
|
2373
|
-
|
|
2374
|
-
if (typeof translation === 'function') {
|
|
2375
|
-
return translation(values);
|
|
2376
|
-
} else {
|
|
2377
|
-
return translation;
|
|
2378
|
-
}
|
|
2379
|
-
}, [translations]);
|
|
2380
|
-
return {
|
|
2381
|
-
t
|
|
2382
|
-
};
|
|
2383
|
-
}
|
|
2384
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
function createMiddleware() {
|
|
2389
|
-
return ({
|
|
2390
|
-
dispatch
|
|
2391
|
-
}) => next => action => {
|
|
2392
|
-
var _action$config, _action$config2, _action$config2$defau;
|
|
2393
|
-
|
|
2394
|
-
const result = next(action);
|
|
2395
|
-
|
|
2396
|
-
switch (action.type) {
|
|
2397
|
-
case String(Actions.initialize):
|
|
2398
|
-
case String(Actions.update):
|
|
2399
|
-
if (action !== null && action !== void 0 && (_action$config = action.config) !== null && _action$config !== void 0 && _action$config.translations) {
|
|
2400
|
-
dispatch(initI18n(action.config.translations));
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
if (action !== null && action !== void 0 && (_action$config2 = action.config) !== null && _action$config2 !== void 0 && (_action$config2$defau = _action$config2.defaults) !== null && _action$config2$defau !== void 0 && _action$config2$defau.agentName) {
|
|
2404
|
-
var _action$config3, _action$config3$defau;
|
|
2405
|
-
|
|
2406
|
-
dispatch({
|
|
2407
|
-
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
2408
|
-
title: action === null || action === void 0 ? void 0 : (_action$config3 = action.config) === null || _action$config3 === void 0 ? void 0 : (_action$config3$defau = _action$config3.defaults) === null || _action$config3$defau === void 0 ? void 0 : _action$config3$defau.agentName
|
|
2409
|
-
});
|
|
2410
|
-
}
|
|
2411
|
-
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
return result;
|
|
2415
|
-
};
|
|
2416
|
-
}
|
|
2417
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
2425
|
-
function seamly_state_hooks_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2426
|
-
|
|
2427
|
-
function seamly_state_hooks_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { seamly_state_hooks_ownKeys(Object(source), true).forEach(function (key) { seamly_state_hooks_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { seamly_state_hooks_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2428
|
-
|
|
2429
|
-
function seamly_state_hooks_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
const seamly_state_hooks_selectState = state => state.state;
|
|
2436
|
-
const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
|
|
2437
|
-
const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
|
|
2438
|
-
events
|
|
2439
|
-
}, config) => {
|
|
2440
|
-
var _config$messages$time, _config$messages;
|
|
2441
|
-
|
|
2442
|
-
const {
|
|
2443
|
-
enabled,
|
|
2444
|
-
threshold
|
|
2445
|
-
} = (_config$messages$time = config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) !== null && _config$messages$time !== void 0 ? _config$messages$time : {};
|
|
2446
|
-
|
|
2447
|
-
if (!enabled) {
|
|
2448
|
-
return events;
|
|
2449
|
-
}
|
|
2450
|
-
|
|
2451
|
-
const mappedEvents = [];
|
|
2452
|
-
let previousEvent = null;
|
|
2453
|
-
events.forEach((event, idx) => {
|
|
2454
|
-
// always add timeIndicator to first message
|
|
2455
|
-
if (idx === 0) {
|
|
2456
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2457
|
-
timeIndicator: event.payload.occurredAt
|
|
2458
|
-
})); // else check if diff is greater than threshold
|
|
2459
|
-
} else {
|
|
2460
|
-
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
2461
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2462
|
-
timeIndicator
|
|
2463
|
-
}));
|
|
2464
|
-
}
|
|
2465
|
-
|
|
2466
|
-
previousEvent = event;
|
|
2467
|
-
});
|
|
2468
|
-
return mappedEvents;
|
|
2469
|
-
});
|
|
2470
|
-
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
2471
|
-
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
2472
|
-
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
2473
|
-
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
2474
|
-
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
2475
|
-
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
2476
|
-
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
2477
|
-
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2478
|
-
var _filteredEvents;
|
|
2479
|
-
|
|
2480
|
-
const filteredEvents = events.filter(event => event.type === 'message');
|
|
2481
|
-
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
2482
|
-
});
|
|
2483
|
-
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
2484
|
-
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
2485
|
-
const useSeamlyCurrentAgent = () => {
|
|
2486
|
-
const {
|
|
2487
|
-
participants,
|
|
2488
|
-
currentAgent
|
|
2489
|
-
} = seamly_state_hooks_useSeamlyStateContext().participantInfo;
|
|
2490
|
-
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;
|
|
2491
2102
|
};
|
|
2492
2103
|
const useSeamlyServiceData = key => seamly_state_hooks_useSeamlyStateContext().serviceData[key];
|
|
2493
2104
|
const useEntryTextLimit = () => {
|
|
@@ -2568,42 +2179,894 @@ const useFocusIfSeamlyContainedFocus = () => {
|
|
|
2568
2179
|
focusWithRaf(elementToFocus);
|
|
2569
2180
|
};
|
|
2570
2181
|
|
|
2571
|
-
runIfElementContainsOrHasFocus(containerElementRef.current, focusFn);
|
|
2572
|
-
}, []);
|
|
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
|
|
2573
3038
|
};
|
|
2574
|
-
|
|
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
|
|
2575
3065
|
|
|
2576
3066
|
|
|
2577
3067
|
|
|
2578
|
-
const useSeamlyAppContainerClassNames = () => {
|
|
2579
|
-
return useConfig().appContainerClassNames;
|
|
2580
|
-
};
|
|
2581
|
-
const useSeamlyMessageContainerClassNames = event => {
|
|
2582
|
-
const {
|
|
2583
|
-
fromClient
|
|
2584
|
-
} = event.payload;
|
|
2585
|
-
const classNames = ['message'];
|
|
2586
3068
|
|
|
2587
|
-
if (event.type === 'info') {
|
|
2588
|
-
classNames.push('message--source-info');
|
|
2589
|
-
} else if (!fromClient) {
|
|
2590
|
-
classNames.push('message--source-agent');
|
|
2591
|
-
} else {
|
|
2592
|
-
classNames.push('message--source-user');
|
|
2593
|
-
}
|
|
2594
3069
|
|
|
2595
|
-
return classNames;
|
|
2596
|
-
};
|
|
2597
|
-
const useCobrowsingContainer = () => {
|
|
2598
|
-
const {
|
|
2599
|
-
cobrowsingContainerId: id
|
|
2600
|
-
} = useSeamlyStateContext();
|
|
2601
|
-
const focusContainer = useElementFocusingById(id);
|
|
2602
|
-
return {
|
|
2603
|
-
id,
|
|
2604
|
-
focusContainer
|
|
2605
|
-
};
|
|
2606
|
-
};
|
|
2607
3070
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-option-hooks.js
|
|
2608
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; }
|
|
2609
3072
|
|
|
@@ -2834,46 +3297,26 @@ const utility_hooks_useStableCallback = callback => {
|
|
|
2834
3297
|
return isFunction ? (...args) => callbackRef.current(...args) : undefined;
|
|
2835
3298
|
}, [isFunction]);
|
|
2836
3299
|
};
|
|
2837
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/
|
|
3300
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/utils.js
|
|
2838
3301
|
|
|
2839
3302
|
const {
|
|
2840
|
-
createAction:
|
|
3303
|
+
createAction: interrupt_utils_createAction,
|
|
3304
|
+
createReducer: interrupt_utils_createReducer,
|
|
3305
|
+
selectState: interrupt_utils_selectState
|
|
2841
3306
|
} = createDomain('interrupt');
|
|
2842
|
-
|
|
3307
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/actions.js
|
|
3308
|
+
|
|
3309
|
+
const set = interrupt_utils_createAction('set', error => ({
|
|
2843
3310
|
error
|
|
2844
3311
|
}));
|
|
2845
|
-
const clear =
|
|
2846
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
|
|
2847
|
-
function interrupt_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2848
|
-
|
|
2849
|
-
function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { interrupt_reducer_ownKeys(Object(source), true).forEach(function (key) { interrupt_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { interrupt_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2850
|
-
|
|
2851
|
-
function interrupt_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
const interrupt_reducer_initialState = {
|
|
2856
|
-
error: undefined
|
|
2857
|
-
};
|
|
2858
|
-
/* harmony default export */ const interrupt_reducer = (createReducer('interrupt', {
|
|
2859
|
-
[set]: (state, {
|
|
2860
|
-
error
|
|
2861
|
-
}) => {
|
|
2862
|
-
return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
|
|
2863
|
-
error
|
|
2864
|
-
});
|
|
2865
|
-
},
|
|
2866
|
-
[clear]: () => {
|
|
2867
|
-
return interrupt_reducer_initialState;
|
|
2868
|
-
}
|
|
2869
|
-
}, interrupt_reducer_initialState));
|
|
3312
|
+
const clear = interrupt_utils_createAction('clear');
|
|
2870
3313
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.js
|
|
2871
3314
|
|
|
2872
3315
|
|
|
2873
|
-
const
|
|
2874
|
-
const selectError = createSelector(selectors_selectState, ({
|
|
3316
|
+
const selectError = createSelector(interrupt_utils_selectState, ({
|
|
2875
3317
|
error
|
|
2876
3318
|
}) => error);
|
|
3319
|
+
|
|
2877
3320
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.js
|
|
2878
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; }
|
|
2879
3322
|
|
|
@@ -3010,6 +3453,30 @@ function middleware_createMiddleware() {
|
|
|
3010
3453
|
return next(action);
|
|
3011
3454
|
};
|
|
3012
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));
|
|
3013
3480
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
|
|
3014
3481
|
|
|
3015
3482
|
|
|
@@ -3017,6 +3484,100 @@ function middleware_createMiddleware() {
|
|
|
3017
3484
|
|
|
3018
3485
|
|
|
3019
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
|
+
|
|
3020
3581
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-commands.js
|
|
3021
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; }
|
|
3022
3583
|
|
|
@@ -3036,6 +3597,7 @@ function use_seamly_commands_defineProperty(obj, key, value) { if (key in obj) {
|
|
|
3036
3597
|
|
|
3037
3598
|
|
|
3038
3599
|
|
|
3600
|
+
|
|
3039
3601
|
const {
|
|
3040
3602
|
ADD_EVENT: use_seamly_commands_ADD_EVENT,
|
|
3041
3603
|
CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
|
|
@@ -3054,7 +3616,7 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3054
3616
|
const appConfig = useConfig();
|
|
3055
3617
|
const dispatch = useSeamlyDispatchContext();
|
|
3056
3618
|
const eventBus = useContext(SeamlyEventBusContext);
|
|
3057
|
-
const hasResponded =
|
|
3619
|
+
const hasResponded = useUserHasResponded();
|
|
3058
3620
|
const hasConversation = useSeamlyHasConversation();
|
|
3059
3621
|
const {
|
|
3060
3622
|
visible: visibility
|
|
@@ -3080,10 +3642,10 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3080
3642
|
});
|
|
3081
3643
|
}, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
|
|
3082
3644
|
const reset = useCallback(async () => {
|
|
3645
|
+
dispatch(InterruptActions.clear());
|
|
3083
3646
|
dispatch({
|
|
3084
3647
|
type: use_seamly_commands_CLEAR_EVENTS
|
|
3085
3648
|
});
|
|
3086
|
-
dispatch(InterruptActions.clear());
|
|
3087
3649
|
dispatch({
|
|
3088
3650
|
type: use_seamly_commands_SET_IS_LOADING,
|
|
3089
3651
|
isLoading: true
|
|
@@ -3109,20 +3671,16 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3109
3671
|
});
|
|
3110
3672
|
|
|
3111
3673
|
try {
|
|
3112
|
-
const {
|
|
3113
|
-
accountConfig = {},
|
|
3114
|
-
initialState = {}
|
|
3115
|
-
} = await api.reset();
|
|
3116
3674
|
const {
|
|
3117
3675
|
features
|
|
3118
|
-
} =
|
|
3676
|
+
} = await api.reset();
|
|
3119
3677
|
dispatch({
|
|
3120
3678
|
type: use_seamly_commands_SET_FEATURES,
|
|
3121
3679
|
features
|
|
3122
3680
|
});
|
|
3123
3681
|
dispatch({
|
|
3124
3682
|
type: use_seamly_commands_SET_INITIAL_STATE,
|
|
3125
|
-
initialState
|
|
3683
|
+
initialState: {}
|
|
3126
3684
|
});
|
|
3127
3685
|
} catch (error) {
|
|
3128
3686
|
dispatch(InterruptActions.set(error));
|
|
@@ -3350,24 +3908,21 @@ const useSeamlyTyping = () => {
|
|
|
3350
3908
|
const {
|
|
3351
3909
|
sendAction
|
|
3352
3910
|
} = useSeamlyCommands();
|
|
3353
|
-
const {
|
|
3354
|
-
typing: typingConfig
|
|
3355
|
-
} = useConfig();
|
|
3356
3911
|
const {
|
|
3357
3912
|
features
|
|
3358
3913
|
} = useSeamlyOptions();
|
|
3359
3914
|
const {
|
|
3360
3915
|
typingPeekahead
|
|
3361
3916
|
} = features || {};
|
|
3362
|
-
const
|
|
3363
|
-
const
|
|
3917
|
+
const typingTimerId = useRef(null);
|
|
3918
|
+
const sendEndTypingTimerId = useRef(null);
|
|
3364
3919
|
const isTyping = useRef(false);
|
|
3365
|
-
const
|
|
3920
|
+
const typingIntervalId = useRef(null);
|
|
3366
3921
|
useEffect(() => {
|
|
3367
3922
|
return () => {
|
|
3368
|
-
clearInterval(
|
|
3369
|
-
clearTimeout(
|
|
3370
|
-
clearTimeout(
|
|
3923
|
+
clearInterval(typingIntervalId.current);
|
|
3924
|
+
clearTimeout(typingTimerId.current);
|
|
3925
|
+
clearTimeout(sendEndTypingTimerId.current);
|
|
3371
3926
|
};
|
|
3372
3927
|
}, []);
|
|
3373
3928
|
|
|
@@ -3387,32 +3942,28 @@ const useSeamlyTyping = () => {
|
|
|
3387
3942
|
return;
|
|
3388
3943
|
}
|
|
3389
3944
|
|
|
3390
|
-
if (!typingConfig) {
|
|
3391
|
-
return;
|
|
3392
|
-
}
|
|
3393
|
-
|
|
3394
3945
|
isTyping.current = true;
|
|
3395
3946
|
|
|
3396
|
-
if (!
|
|
3947
|
+
if (!typingIntervalId.current) {
|
|
3397
3948
|
sendTypingState(true, e.target.value);
|
|
3398
|
-
|
|
3949
|
+
typingIntervalId.current = setInterval(() => {
|
|
3399
3950
|
if (!isTyping.current) {
|
|
3400
|
-
clearInterval(
|
|
3401
|
-
|
|
3951
|
+
clearInterval(typingIntervalId.current);
|
|
3952
|
+
typingIntervalId.current = null;
|
|
3402
3953
|
} else if (typingPeekahead && typingPeekahead.enabled) {
|
|
3403
3954
|
sendTypingState(true, e.target.value);
|
|
3404
3955
|
}
|
|
3405
|
-
},
|
|
3956
|
+
}, typingTimeout);
|
|
3406
3957
|
}
|
|
3407
3958
|
|
|
3408
|
-
clearTimeout(
|
|
3409
|
-
clearTimeout(
|
|
3410
|
-
|
|
3959
|
+
clearTimeout(typingTimerId.current);
|
|
3960
|
+
clearTimeout(sendEndTypingTimerId.current);
|
|
3961
|
+
typingTimerId.current = setTimeout(() => {
|
|
3411
3962
|
isTyping.current = false;
|
|
3412
3963
|
}, 300);
|
|
3413
|
-
|
|
3964
|
+
sendEndTypingTimerId.current = setTimeout(() => {
|
|
3414
3965
|
sendTypingState(false, e.target.value);
|
|
3415
|
-
},
|
|
3966
|
+
}, typingTimeout);
|
|
3416
3967
|
};
|
|
3417
3968
|
};
|
|
3418
3969
|
const useSeamlyEntry = () => {
|
|
@@ -3505,6 +4056,7 @@ const use_seamly_stored_visibility_useSeamlyStoredVisibility = () => {
|
|
|
3505
4056
|
|
|
3506
4057
|
|
|
3507
4058
|
|
|
4059
|
+
|
|
3508
4060
|
const {
|
|
3509
4061
|
SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
|
|
3510
4062
|
} = seamly_utils_seamlyActions;
|
|
@@ -3523,7 +4075,7 @@ const use_seamly_visibility_useSeamlyVisibility = () => {
|
|
|
3523
4075
|
} = useSeamlyCommands();
|
|
3524
4076
|
const dispatch = useSeamlyDispatchContext();
|
|
3525
4077
|
const [storedVisibility, setStoredVisibility] = useSeamlyStoredVisibility();
|
|
3526
|
-
const hasResponded =
|
|
4078
|
+
const hasResponded = useUserHasResponded();
|
|
3527
4079
|
const hasConversation = useSeamlyHasConversation();
|
|
3528
4080
|
const unreadMessageCount = useSeamlyUnreadCount();
|
|
3529
4081
|
const isVisible = visible ? visible !== visibilityStates.hidden : false;
|
|
@@ -4053,6 +4605,123 @@ function hooks_useTranslationsContainer() {
|
|
|
4053
4605
|
focusContainer
|
|
4054
4606
|
};
|
|
4055
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));
|
|
4056
4725
|
;// CONCATENATED MODULE: ./src/javascripts/lib/css.js
|
|
4057
4726
|
|
|
4058
4727
|
/**
|
|
@@ -4538,6 +5207,9 @@ function form_TranslationsOptionsDialogForm({
|
|
|
4538
5207
|
languages,
|
|
4539
5208
|
currentLocale
|
|
4540
5209
|
} = useTranslations();
|
|
5210
|
+
const {
|
|
5211
|
+
locale: uiLocale
|
|
5212
|
+
} = useI18n();
|
|
4541
5213
|
const languageName = useMemo(() => {
|
|
4542
5214
|
var _languages$find;
|
|
4543
5215
|
|
|
@@ -4547,11 +5219,11 @@ function form_TranslationsOptionsDialogForm({
|
|
|
4547
5219
|
return [{
|
|
4548
5220
|
value: '',
|
|
4549
5221
|
label: t('translations.settings.defaultOptionLabel')
|
|
4550
|
-
}, ...languages.map(language => ({
|
|
5222
|
+
}, ...languages.filter(language => language.locale.toLowerCase() !== String(uiLocale).toLowerCase()).map(language => ({
|
|
4551
5223
|
value: language.locale,
|
|
4552
5224
|
label: language.nativeName
|
|
4553
5225
|
}))];
|
|
4554
|
-
}, [t, languages]);
|
|
5226
|
+
}, [t, languages, uiLocale]);
|
|
4555
5227
|
return _jsxs(Form, {
|
|
4556
5228
|
noValidate: "true",
|
|
4557
5229
|
children: [_jsx("p", {
|
|
@@ -4969,7 +5641,9 @@ function TranslationsChatStatus() {
|
|
|
4969
5641
|
return _jsx(ChatStatus, {
|
|
4970
5642
|
type: "translations",
|
|
4971
5643
|
id: id,
|
|
4972
|
-
label: t('translations.status.label',
|
|
5644
|
+
label: t('translations.status.label', {
|
|
5645
|
+
language: languageName
|
|
5646
|
+
}),
|
|
4973
5647
|
onButtonClick: handleClickStop,
|
|
4974
5648
|
buttonText: t('translations.status.stopText'),
|
|
4975
5649
|
srButtonText: t('translations.status.srStopText')
|
|
@@ -4983,6 +5657,7 @@ function TranslationsChatStatus() {
|
|
|
4983
5657
|
|
|
4984
5658
|
|
|
4985
5659
|
|
|
5660
|
+
|
|
4986
5661
|
;// CONCATENATED MODULE: ./src/javascripts/style-guide/components/static-core.js
|
|
4987
5662
|
const static_core_excluded = ["translations", "interrupt", "config"];
|
|
4988
5663
|
|
|
@@ -4999,6 +5674,7 @@ function static_core_objectWithoutPropertiesLoose(source, excluded) { if (source
|
|
|
4999
5674
|
|
|
5000
5675
|
|
|
5001
5676
|
|
|
5677
|
+
|
|
5002
5678
|
const bareApi = {
|
|
5003
5679
|
send: () => {},
|
|
5004
5680
|
reset: () => {
|
|
@@ -5012,6 +5688,7 @@ const bareApi = {
|
|
|
5012
5688
|
|
|
5013
5689
|
const SeamlyTestCore = ({
|
|
5014
5690
|
state,
|
|
5691
|
+
translations,
|
|
5015
5692
|
children
|
|
5016
5693
|
}) => {
|
|
5017
5694
|
const liveMsgRef = (0,hooks_namespaceObject.useRef)(() => {});
|
|
@@ -5030,10 +5707,11 @@ const SeamlyTestCore = ({
|
|
|
5030
5707
|
const newStore = (0,web_ui_namespaceObject.createReduxStore)({
|
|
5031
5708
|
reducers: {
|
|
5032
5709
|
state: stateReducer,
|
|
5710
|
+
[String(app_reducer)]: app_reducer,
|
|
5033
5711
|
[String(config_reducer)]: config_reducer,
|
|
5034
5712
|
[String(reducer)]: reducer,
|
|
5035
5713
|
[String(translations_reducer)]: translations_reducer,
|
|
5036
|
-
[String(
|
|
5714
|
+
[String(i18n_reducer)]: i18n_reducer,
|
|
5037
5715
|
[String(interrupt_reducer)]: interrupt_reducer
|
|
5038
5716
|
},
|
|
5039
5717
|
initialState: {
|
|
@@ -5043,8 +5721,9 @@ const SeamlyTestCore = ({
|
|
|
5043
5721
|
}
|
|
5044
5722
|
});
|
|
5045
5723
|
newStore.dispatch(initialize(configSlice || {}));
|
|
5724
|
+
newStore.dispatch(setLocaleResolve('en-GB', translations));
|
|
5046
5725
|
return newStore;
|
|
5047
|
-
}, [state]);
|
|
5726
|
+
}, [state, translations]);
|
|
5048
5727
|
return state && (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.StoreProvider, {
|
|
5049
5728
|
store: store,
|
|
5050
5729
|
children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.SeamlyEventBusContext.Provider, {
|
|
@@ -5696,7 +6375,7 @@ const imageMessage = {
|
|
|
5696
6375
|
description: 'Plaatje',
|
|
5697
6376
|
isZoomable: false,
|
|
5698
6377
|
type: 'image',
|
|
5699
|
-
url: 'https://
|
|
6378
|
+
url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg'
|
|
5700
6379
|
},
|
|
5701
6380
|
fromClient: false,
|
|
5702
6381
|
fromHistory: true,
|
|
@@ -5724,7 +6403,7 @@ const imageMessageWithLightbox = {
|
|
|
5724
6403
|
description: 'Plaatje',
|
|
5725
6404
|
isZoomable: true,
|
|
5726
6405
|
type: 'image',
|
|
5727
|
-
url: 'https://
|
|
6406
|
+
url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-portrait.jpg'
|
|
5728
6407
|
},
|
|
5729
6408
|
fromClient: false,
|
|
5730
6409
|
fromHistory: true,
|
|
@@ -5872,7 +6551,7 @@ const fileDownloadPayload = {
|
|
|
5872
6551
|
contentType: 'image/jpg',
|
|
5873
6552
|
filename: 'placeholder.jpg',
|
|
5874
6553
|
filesize: 991078,
|
|
5875
|
-
url: 'https://
|
|
6554
|
+
url: 'https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg'
|
|
5876
6555
|
}
|
|
5877
6556
|
};
|
|
5878
6557
|
const fileDownloadAgentMessage = {
|
|
@@ -6000,7 +6679,7 @@ const cardAskText = {
|
|
|
6000
6679
|
},
|
|
6001
6680
|
buttonText: 'Ask about pizzas!',
|
|
6002
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.',
|
|
6003
|
-
image: 'https://
|
|
6682
|
+
image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-square.jpg',
|
|
6004
6683
|
title: 'Pizza Margherita'
|
|
6005
6684
|
}
|
|
6006
6685
|
}
|
|
@@ -6018,7 +6697,7 @@ const cardNavigate = {
|
|
|
6018
6697
|
},
|
|
6019
6698
|
buttonText: 'Order now!',
|
|
6020
6699
|
description: 'Pizza Margherita is a **typical Neapolitan pizza**.',
|
|
6021
|
-
image: 'https://
|
|
6700
|
+
image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-landscape.jpg',
|
|
6022
6701
|
title: 'Pizza Margherita'
|
|
6023
6702
|
}
|
|
6024
6703
|
}
|
|
@@ -6034,7 +6713,7 @@ const cardTopic = {
|
|
|
6034
6713
|
type: 'topic'
|
|
6035
6714
|
},
|
|
6036
6715
|
buttonText: 'Set topic! (title & description optional)',
|
|
6037
|
-
image: 'https://
|
|
6716
|
+
image: 'https://developers.seamly.ai/clients/web-ui/static/photos/card-portrait.jpg'
|
|
6038
6717
|
}
|
|
6039
6718
|
}
|
|
6040
6719
|
};
|
|
@@ -6311,9 +6990,9 @@ const standardState = {
|
|
|
6311
6990
|
showDisclaimer: true
|
|
6312
6991
|
})
|
|
6313
6992
|
}),
|
|
6314
|
-
|
|
6993
|
+
chatStatusBar: states_objectSpread(states_objectSpread({
|
|
6315
6994
|
category: categoryKeys.features,
|
|
6316
|
-
headingText: `
|
|
6995
|
+
headingText: `Chat status bar`,
|
|
6317
6996
|
description: ''
|
|
6318
6997
|
}, baseState), {}, {
|
|
6319
6998
|
options: {
|
|
@@ -7084,6 +7763,7 @@ function app_defineProperty(obj, key, value) { if (key in obj) { Object.definePr
|
|
|
7084
7763
|
const StyleGuideApp = ({
|
|
7085
7764
|
config,
|
|
7086
7765
|
styleGuideConfig,
|
|
7766
|
+
translations,
|
|
7087
7767
|
headingLevel = 2
|
|
7088
7768
|
}) => {
|
|
7089
7769
|
const [staticState, setStaticState] = (0,hooks_namespaceObject.useState)(null);
|
|
@@ -7215,7 +7895,7 @@ const StyleGuideApp = ({
|
|
|
7215
7895
|
}), (0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
7216
7896
|
children: showStyleGuide && (0,jsx_runtime_namespaceObject.jsx)(view, {
|
|
7217
7897
|
customComponents: styleGuideConfig.customComponents,
|
|
7218
|
-
translations:
|
|
7898
|
+
translations: translations,
|
|
7219
7899
|
state: staticState
|
|
7220
7900
|
})
|
|
7221
7901
|
})]
|
|
@@ -7252,7 +7932,6 @@ function style_guide_engine_objectWithoutPropertiesLoose(source, excluded) { if
|
|
|
7252
7932
|
|
|
7253
7933
|
|
|
7254
7934
|
|
|
7255
|
-
|
|
7256
7935
|
class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
|
|
7257
7936
|
constructor(_ref, externalApi) {
|
|
7258
7937
|
let {
|
|
@@ -7264,23 +7943,28 @@ class SeamlyStyleGuideInstance extends web_ui_namespaceObject.Engine {
|
|
|
7264
7943
|
this.styleGuideConfig = styleGuideConfig || {};
|
|
7265
7944
|
}
|
|
7266
7945
|
|
|
7267
|
-
render() {
|
|
7946
|
+
async render() {
|
|
7268
7947
|
const restComponents = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config.customComponents || {}), {}, {
|
|
7269
7948
|
view: undefined
|
|
7270
7949
|
});
|
|
7271
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/${this.config.api.key}/translations/{version}/{locale}.json`
|
|
7957
|
+
};
|
|
7958
|
+
const translations = await api.getTranslations(this.config.context.locale || 'en-GB');
|
|
7959
|
+
|
|
7272
7960
|
const renderConfig = style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, this.config), {}, {
|
|
7273
|
-
customComponents: Object.keys(restComponents).length ? restComponents : undefined
|
|
7274
|
-
translations: this.config.translations || style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, (en_default())), {}, {
|
|
7275
|
-
disclaimer: style_guide_engine_objectSpread(style_guide_engine_objectSpread({}, (en_default()).disclaimer), {}, {
|
|
7276
|
-
content: 'This chat session will be saved to help us improve our service delivery. <a href="https://seamly.ai/">More information</a>'
|
|
7277
|
-
})
|
|
7278
|
-
})
|
|
7961
|
+
customComponents: Object.keys(restComponents).length ? restComponents : undefined
|
|
7279
7962
|
});
|
|
7280
7963
|
|
|
7281
7964
|
(0,external_preact_namespaceObject.render)((0,jsx_runtime_namespaceObject.jsx)(app, {
|
|
7282
7965
|
config: renderConfig,
|
|
7283
|
-
styleGuideConfig: this.styleGuideConfig
|
|
7966
|
+
styleGuideConfig: this.styleGuideConfig,
|
|
7967
|
+
translations: translations
|
|
7284
7968
|
}), this.parentElement);
|
|
7285
7969
|
}
|
|
7286
7970
|
|