@seamly/web-ui 19.1.2 → 20.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/CHANGELOG.md +625 -0
- package/build/dist/lib/components.js +2 -1
- package/build/dist/lib/components.min.js +1 -1
- package/build/dist/lib/index.debug.js +183 -128
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +45 -25
- package/build/dist/lib/index.js +7292 -7752
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.LICENSE.txt +0 -5
- package/build/dist/lib/standalone.js +5788 -6255
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.LICENSE.txt +0 -5
- package/build/dist/lib/style-guide.js +1935 -1965
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +1 -2
- package/src/icons/icon_file-32.svg +1 -1
- package/src/javascripts/api/errors/seamly-base-error.js +7 -0
- package/src/javascripts/api/index.js +48 -37
- package/src/javascripts/api/producer.js +5 -1
- package/src/javascripts/config.js +1 -5
- package/src/javascripts/domains/app/actions.js +22 -5
- package/src/javascripts/domains/config/actions.js +3 -0
- package/src/javascripts/domains/config/reducer.js +9 -0
- package/src/javascripts/domains/errors/index.js +5 -4
- package/src/javascripts/domains/forms/hooks.js +3 -1
- package/src/javascripts/domains/forms/provider.js +12 -0
- package/src/javascripts/domains/forms/reducer.js +2 -0
- package/src/javascripts/domains/i18n/hooks.js +2 -1
- package/src/javascripts/domains/i18n/reducer.js +2 -0
- package/src/javascripts/domains/interrupt/reducer.js +2 -2
- package/src/javascripts/domains/options/middleware.js +15 -31
- package/src/javascripts/domains/store/index.js +2 -1
- package/src/javascripts/domains/store/state-reducer.js +3 -8
- package/src/javascripts/domains/translations/components/options-dialog/form.js +1 -1
- package/src/javascripts/domains/translations/components/options-dialog/index.js +15 -1
- package/src/javascripts/domains/translations/reducer.js +2 -0
- package/src/javascripts/domains/visibility/actions.js +1 -1
- package/src/javascripts/domains/visibility/hooks.js +10 -8
- package/src/javascripts/domains/visibility/utils.js +1 -2
- package/src/javascripts/index.js +7 -2
- package/src/javascripts/lib/css.js +7 -1
- package/src/javascripts/lib/engine/index.js +4 -3
- package/src/javascripts/lib/external-api/index.js +38 -29
- package/src/javascripts/package/components.js +2 -1
- package/src/javascripts/style-guide/components/app.js +1 -1
- package/src/javascripts/style-guide/components/static-core.js +9 -3
- package/src/javascripts/style-guide/states.js +203 -298
- package/src/javascripts/ui/components/chat-app.js +1 -1
- package/src/javascripts/ui/components/conversation/component-filter.js +6 -0
- package/src/javascripts/ui/components/conversation/event/carousel-component/index.js +8 -1
- package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js +2 -3
- package/src/javascripts/ui/components/conversation/event/conversation-suggestions.js +70 -0
- package/src/javascripts/ui/components/conversation/event/participant.js +2 -5
- package/src/javascripts/ui/components/conversation/event/splash.js +26 -0
- package/src/javascripts/ui/components/conversation/event/text.js +1 -2
- package/src/javascripts/ui/components/core/seamly-core.js +12 -9
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +4 -10
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +1 -8
- package/src/javascripts/ui/components/entry/entry-container.js +5 -3
- package/src/javascripts/ui/components/entry/text-entry/index.js +7 -1
- package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +5 -1
- package/src/javascripts/ui/components/entry/toggle-button.js +4 -2
- package/src/javascripts/ui/components/entry/upload/file-upload-form.js +1 -1
- package/src/javascripts/ui/components/form-controls/error.js +6 -2
- package/src/javascripts/ui/components/form-controls/form.js +26 -3
- package/src/javascripts/ui/components/layout/app-frame.js +24 -15
- package/src/javascripts/ui/components/layout/chat-frame.js +0 -2
- package/src/javascripts/ui/components/layout/modal-wrapper.js +0 -80
- package/src/javascripts/ui/components/layout/pre-chat-messages.js +45 -0
- package/src/javascripts/ui/components/options/options-frame.js +9 -4
- package/src/javascripts/ui/components/options/options.js +1 -4
- package/src/javascripts/ui/components/options/transcript/index.js +15 -1
- package/src/javascripts/ui/components/options/transcript/transcript-form.js +1 -1
- package/src/javascripts/ui/components/suggestions/index.js +174 -0
- package/src/javascripts/ui/components/suggestions/suggestions-item.js +40 -0
- package/src/javascripts/ui/components/suggestions/suggestions-list.js +24 -0
- package/src/javascripts/ui/components/view/app-view.js +21 -0
- package/src/javascripts/ui/components/view/deprecated-view.js +30 -0
- package/src/javascripts/ui/components/view/index.js +27 -0
- package/src/javascripts/ui/components/view/inline-view.js +45 -0
- package/src/javascripts/ui/components/view/window-view/collapse-button.js +20 -0
- package/src/javascripts/ui/components/view/window-view/index.js +82 -0
- package/src/javascripts/ui/components/view/window-view/window-open-button.js +68 -0
- package/src/javascripts/ui/components/widgets/lightbox.js +7 -2
- package/src/javascripts/ui/hooks/component-helper-hooks.js +0 -9
- package/src/javascripts/ui/hooks/seamly-hooks.js +0 -1
- package/src/javascripts/ui/hooks/seamly-state-hooks.js +28 -4
- package/src/javascripts/ui/hooks/use-seamly-chat.js +12 -3
- package/src/javascripts/ui/hooks/use-seamly-commands.js +4 -31
- package/src/javascripts/ui/utils/seamly-utils.js +2 -14
- package/src/stylesheets/1-settings/_animations.scss +0 -6
- package/src/stylesheets/1-settings/_config.scss +34 -35
- package/src/stylesheets/2-tools/_functions.scss +0 -5
- package/src/stylesheets/2-tools/_mixins.scss +4 -16
- package/src/stylesheets/3-app/_app.scss +78 -135
- package/src/stylesheets/4-base/_a11y.scss +0 -3
- package/src/stylesheets/4-base/_elements.scss +0 -11
- package/src/stylesheets/4-base/_formelements.scss +4 -14
- package/src/stylesheets/5-components/_avatar.scss +2 -44
- package/src/stylesheets/5-components/_buttons.scss +6 -45
- package/src/stylesheets/5-components/_chat-status.scss +14 -38
- package/src/stylesheets/5-components/_choice-prompt.scss +33 -2
- package/src/stylesheets/5-components/_collapse-button.scss +16 -0
- package/src/stylesheets/5-components/_conversation.scss +26 -2
- package/src/stylesheets/5-components/_disclaimer.scss +10 -12
- package/src/stylesheets/5-components/_divider.scss +7 -4
- package/src/stylesheets/5-components/_error.scss +1 -1
- package/src/stylesheets/5-components/_form.scss +9 -0
- package/src/stylesheets/5-components/_icon.scss +10 -1
- package/src/stylesheets/5-components/_idle.scss +0 -8
- package/src/stylesheets/5-components/_input.scss +14 -20
- package/src/stylesheets/5-components/_interrupt.scss +0 -2
- package/src/stylesheets/5-components/_loader.scss +0 -32
- package/src/stylesheets/5-components/_message-author.scss +40 -0
- package/src/stylesheets/5-components/_message-body.scss +194 -0
- package/src/stylesheets/5-components/_message-card.scss +55 -0
- package/src/stylesheets/5-components/_message-carousel.scss +143 -0
- package/src/stylesheets/5-components/_message-count.scss +11 -28
- package/src/stylesheets/5-components/_message-cta.scss +23 -0
- package/src/stylesheets/5-components/_message-info.scss +11 -0
- package/src/stylesheets/5-components/_message-translation-info.scss +17 -0
- package/src/stylesheets/5-components/_message.scss +13 -364
- package/src/stylesheets/5-components/_modal.scss +28 -58
- package/src/stylesheets/5-components/_notification.scss +0 -5
- package/src/stylesheets/5-components/_options.scss +27 -42
- package/src/stylesheets/5-components/_pre-chat-messages.scss +30 -0
- package/src/stylesheets/5-components/_prompt.scss +0 -8
- package/src/stylesheets/5-components/_skip-link.scss +3 -3
- package/src/stylesheets/5-components/_suggestions.scss +96 -0
- package/src/stylesheets/5-components/_unstarted.scss +50 -0
- package/src/stylesheets/5-components/_upload.scss +26 -28
- package/src/stylesheets/5-components/_window-open-button.scss +39 -0
- package/src/stylesheets/6-webui-only/_hover.scss +151 -0
- package/src/stylesheets/6-webui-only/_scrollbar.scss +31 -0
- package/src/stylesheets/7-deprecated/1-settings/_animations.scss +43 -0
- package/src/stylesheets/7-deprecated/1-settings/_config.scss +105 -0
- package/src/stylesheets/7-deprecated/2-tools/_functions.scss +22 -0
- package/src/stylesheets/7-deprecated/2-tools/_mixins.scss +77 -0
- package/src/stylesheets/7-deprecated/3-app/_app.scss +214 -0
- package/src/stylesheets/7-deprecated/4-base/_a11y.scss +14 -0
- package/src/stylesheets/7-deprecated/4-base/_elements.scss +21 -0
- package/src/stylesheets/7-deprecated/4-base/_formelements.scss +57 -0
- package/src/stylesheets/{5-components → 7-deprecated/5-components}/_agent-info.scss +0 -0
- package/src/stylesheets/7-deprecated/5-components/_avatar.scss +64 -0
- package/src/stylesheets/7-deprecated/5-components/_buttons.scss +94 -0
- package/src/stylesheets/{5-components → 7-deprecated/5-components}/_card.scss +0 -0
- package/src/stylesheets/{5-components → 7-deprecated/5-components}/_carousel.scss +0 -0
- package/src/stylesheets/7-deprecated/5-components/_character-limit.scss +36 -0
- package/src/stylesheets/{5-components/_cobrowsing.scss → 7-deprecated/5-components/_chat-status.scss} +18 -16
- package/src/stylesheets/7-deprecated/5-components/_choice-prompt.scss +27 -0
- package/src/stylesheets/7-deprecated/5-components/_collapse-button.scss +17 -0
- package/src/stylesheets/7-deprecated/5-components/_conversation.scss +44 -0
- package/src/stylesheets/7-deprecated/5-components/_disclaimer.scss +36 -0
- package/src/stylesheets/7-deprecated/5-components/_divider.scss +91 -0
- package/src/stylesheets/7-deprecated/5-components/_error.scss +24 -0
- package/src/stylesheets/{5-components → 7-deprecated/5-components}/_faq.scss +8 -3
- package/src/stylesheets/{5-components → 7-deprecated/5-components}/_header-controls.scss +0 -0
- package/src/stylesheets/7-deprecated/5-components/_icon.scss +4 -0
- package/src/stylesheets/7-deprecated/5-components/_idle.scss +61 -0
- package/src/stylesheets/7-deprecated/5-components/_input.scss +78 -0
- package/src/stylesheets/7-deprecated/5-components/_interrupt.scss +35 -0
- package/src/stylesheets/7-deprecated/5-components/_loader.scss +78 -0
- package/src/stylesheets/7-deprecated/5-components/_message-count.scss +41 -0
- package/src/stylesheets/7-deprecated/5-components/_message.scss +385 -0
- package/src/stylesheets/7-deprecated/5-components/_modal.scss +138 -0
- package/src/stylesheets/7-deprecated/5-components/_notification.scss +20 -0
- package/src/stylesheets/7-deprecated/5-components/_options.scss +286 -0
- package/src/stylesheets/7-deprecated/5-components/_prompt.scss +44 -0
- package/src/stylesheets/7-deprecated/5-components/_skip-link.scss +21 -0
- package/src/stylesheets/{5-components → 7-deprecated/5-components}/_svg-graphic.scss +0 -0
- package/src/stylesheets/7-deprecated/5-components/_upload.scss +213 -0
- package/src/stylesheets/deprecated-view.scss +64 -0
- package/src/stylesheets/styles-webui-only.scss +3 -0
- package/src/stylesheets/styles.scss +15 -25
- package/webpack/config.site.js +4 -0
- package/webpack/defaults.js +5 -0
- package/src/.DS_Store +0 -0
- package/src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js +0 -35
- package/src/javascripts/ui/components/faq/faq.js +0 -162
- package/src/javascripts/ui/components/layout/view.js +0 -36
- package/src/javascripts/ui/components/options/cobrowsing.js +0 -110
- package/src/javascripts/ui/components/warnings/cobrowsing-active-frame.js +0 -29
- package/src/javascripts/ui/components/warnings/cobrowsing-active.js +0 -33
- package/src/stylesheets/5-components/_modal_mode.scss +0 -108
|
@@ -284,7 +284,8 @@ const payloadTypes = {
|
|
|
284
284
|
message: 'message',
|
|
285
285
|
countdown: 'countdown',
|
|
286
286
|
upload: 'upload',
|
|
287
|
-
cta: 'cta'
|
|
287
|
+
cta: 'cta',
|
|
288
|
+
splash: 'splash'
|
|
288
289
|
};
|
|
289
290
|
const entryTypes = {
|
|
290
291
|
text: 'text',
|
|
@@ -320,7 +321,6 @@ const dividerKeys = {
|
|
|
320
321
|
new_translation: 'newTranslation'
|
|
321
322
|
};
|
|
322
323
|
const featureKeys = {
|
|
323
|
-
cobrowsing: 'cobrowsing',
|
|
324
324
|
sendTranscript: 'sendTranscript',
|
|
325
325
|
typingPeekahead: 'typingPeekahead',
|
|
326
326
|
uploads: 'uploads'
|
|
@@ -650,7 +650,6 @@ const seamlyStateReducer = (state, action) => {
|
|
|
650
650
|
}
|
|
651
651
|
|
|
652
652
|
const {
|
|
653
|
-
cobrowsing,
|
|
654
653
|
entry,
|
|
655
654
|
uploads
|
|
656
655
|
} = activeServiceSettings;
|
|
@@ -659,16 +658,7 @@ const seamlyStateReducer = (state, action) => {
|
|
|
659
658
|
options: seamly_utils_objectSpread({}, entry && entry.options ? entry.options : {})
|
|
660
659
|
}), events[events.length - 1].payload);
|
|
661
660
|
|
|
662
|
-
let newFeatures = seamly_utils_objectSpread({}, state.options.features);
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
if (newFeatures.hasOwnProperty(featureKeys.cobrowsing)) {
|
|
666
|
-
newFeatures = seamly_utils_objectSpread(seamly_utils_objectSpread({}, newFeatures), {}, {
|
|
667
|
-
cobrowsing: {
|
|
668
|
-
enabled: !!(cobrowsing && cobrowsing.enabled)
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
}
|
|
661
|
+
let newFeatures = seamly_utils_objectSpread({}, state.options.features);
|
|
672
662
|
|
|
673
663
|
const newFeaturesHasUpload = newFeatures.hasOwnProperty(featureKeys.uploads); // Only set uploads if it was initialised by the account config.
|
|
674
664
|
|
|
@@ -829,8 +819,6 @@ const seamlyStateReducer = (state, action) => {
|
|
|
829
819
|
});
|
|
830
820
|
|
|
831
821
|
case SET_FEATURE_ENABLED_STATE:
|
|
832
|
-
// Only set cobrowsing if it already exists in the object.
|
|
833
|
-
// Otherwise we may set if for accounts not allowing it at all.
|
|
834
822
|
return state.options.features.hasOwnProperty(action.key) ? seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
|
|
835
823
|
options: seamly_utils_objectSpread(seamly_utils_objectSpread({}, state.options), {}, {
|
|
836
824
|
features: seamly_utils_objectSpread(seamly_utils_objectSpread({}, state.options.features), {}, {
|
|
@@ -1149,6 +1137,45 @@ const initialize = utils_createAction('initialize', config => ({
|
|
|
1149
1137
|
const update = utils_createAction('update', config => ({
|
|
1150
1138
|
config
|
|
1151
1139
|
}));
|
|
1140
|
+
const setPreChatEvents = utils_createAction('setPreChatEvents', events => ({
|
|
1141
|
+
events
|
|
1142
|
+
}));
|
|
1143
|
+
;// CONCATENATED MODULE: ./src/javascripts/lib/mutex.js
|
|
1144
|
+
function createMutex() {
|
|
1145
|
+
let isRunning = false;
|
|
1146
|
+
const tasks = [];
|
|
1147
|
+
|
|
1148
|
+
const next = async () => {
|
|
1149
|
+
if (!isRunning) {
|
|
1150
|
+
while (tasks.length) {
|
|
1151
|
+
const task = tasks.shift();
|
|
1152
|
+
isRunning = true; // eslint-disable-next-line no-await-in-loop
|
|
1153
|
+
|
|
1154
|
+
await task().catch(() => {});
|
|
1155
|
+
isRunning = false;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
const runExclusively = async task => {
|
|
1161
|
+
const prms = new Promise((resolve, reject) => {
|
|
1162
|
+
tasks.push(async () => {
|
|
1163
|
+
try {
|
|
1164
|
+
resolve(await task());
|
|
1165
|
+
} catch (e) {
|
|
1166
|
+
reject(e);
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
});
|
|
1170
|
+
next();
|
|
1171
|
+
return prms;
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
return {
|
|
1175
|
+
next,
|
|
1176
|
+
runExclusively
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1152
1179
|
;// CONCATENATED MODULE: ./node_modules/reselect/es/index.js
|
|
1153
1180
|
function defaultEqualityCheck(a, b) {
|
|
1154
1181
|
return a === b;
|
|
@@ -1270,6 +1297,43 @@ function createStructuredSelector(selectors) {
|
|
|
1270
1297
|
}, {});
|
|
1271
1298
|
});
|
|
1272
1299
|
}
|
|
1300
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/utils.js
|
|
1301
|
+
|
|
1302
|
+
const {
|
|
1303
|
+
createAction: i18n_utils_createAction,
|
|
1304
|
+
createThunk: i18n_utils_createThunk,
|
|
1305
|
+
createReducer: i18n_utils_createReducer,
|
|
1306
|
+
selectState: utils_selectState
|
|
1307
|
+
} = createDomain('i18n');
|
|
1308
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.js
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
const selectTranslations = createSelector(utils_selectState, state => state.translations);
|
|
1312
|
+
const selectInitialLocale = createSelector(utils_selectState, state => state.initialLocale);
|
|
1313
|
+
const selectLocale = createSelector(utils_selectState, state => state.locale);
|
|
1314
|
+
|
|
1315
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/actions.js
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
const setInitialLocale = i18n_utils_createAction('setInitialLocale', locale => ({
|
|
1320
|
+
locale
|
|
1321
|
+
}));
|
|
1322
|
+
const mutex = createMutex();
|
|
1323
|
+
const setLocale = i18n_utils_createThunk('setLocale', async (locale, {
|
|
1324
|
+
getState,
|
|
1325
|
+
extra: {
|
|
1326
|
+
api
|
|
1327
|
+
}
|
|
1328
|
+
}) => {
|
|
1329
|
+
return mutex.runExclusively(() => {
|
|
1330
|
+
if (locale === selectLocale(getState())) {
|
|
1331
|
+
return undefined;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
return api.getTranslations(locale);
|
|
1335
|
+
});
|
|
1336
|
+
});
|
|
1273
1337
|
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/constants.js
|
|
1274
1338
|
const StoreKey = 'visibility';
|
|
1275
1339
|
const constants_visibilityStates = {
|
|
@@ -1303,6 +1367,56 @@ const selectConfig = createSelector(selectState, config => {
|
|
|
1303
1367
|
return newConfig;
|
|
1304
1368
|
});
|
|
1305
1369
|
|
|
1370
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
|
|
1371
|
+
|
|
1372
|
+
const {
|
|
1373
|
+
createAction: app_utils_createAction,
|
|
1374
|
+
createThunk: app_utils_createThunk,
|
|
1375
|
+
createReducer: app_utils_createReducer,
|
|
1376
|
+
selectState: app_utils_selectState
|
|
1377
|
+
} = createDomain('app');
|
|
1378
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
|
|
1382
|
+
|
|
1383
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/utils.js
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
const {
|
|
1387
|
+
createAction: visibility_utils_createAction,
|
|
1388
|
+
createActions: utils_createActions,
|
|
1389
|
+
createThunk: visibility_utils_createThunk,
|
|
1390
|
+
createReducer: visibility_utils_createReducer,
|
|
1391
|
+
selectState: visibility_utils_selectState
|
|
1392
|
+
} = createDomain('visibility');
|
|
1393
|
+
const calculateVisibility = ({
|
|
1394
|
+
hasResponded,
|
|
1395
|
+
previousVisibility,
|
|
1396
|
+
requestedVisibility,
|
|
1397
|
+
config
|
|
1398
|
+
}) => {
|
|
1399
|
+
const {
|
|
1400
|
+
defaults,
|
|
1401
|
+
layoutMode,
|
|
1402
|
+
hideOnNoUserResponse
|
|
1403
|
+
} = config;
|
|
1404
|
+
const {
|
|
1405
|
+
visible: defaultVisibility
|
|
1406
|
+
} = defaults || {}; // Requesting open should override the responded check.
|
|
1407
|
+
|
|
1408
|
+
if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== constants_visibilityStates.open) {
|
|
1409
|
+
return hasResponded ? requestedVisibility || previousVisibility || constants_visibilityStates.open : constants_visibilityStates.hidden;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
const baseVisibility = constants_visibilityStates.minimized;
|
|
1413
|
+
return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
|
|
1414
|
+
};
|
|
1415
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/selectors.js
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
const selectVisibility = createSelector(visibility_utils_selectState, state => state.visibility);
|
|
1419
|
+
|
|
1306
1420
|
;// CONCATENATED MODULE: ./src/javascripts/domains/redux/context.js
|
|
1307
1421
|
|
|
1308
1422
|
const context_StoreContext = (0,external_preact_namespaceObject.createContext)(undefined);
|
|
@@ -1407,1887 +1521,1830 @@ const hooks_useSelectorWithProps = function useSelectorWithProps(selector, props
|
|
|
1407
1521
|
function hooks_useConfig() {
|
|
1408
1522
|
return useSelector(Selectors.selectConfig);
|
|
1409
1523
|
}
|
|
1410
|
-
;// CONCATENATED MODULE: ./src/javascripts/
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
function createMiddleware() {
|
|
1414
|
-
return ({
|
|
1415
|
-
dispatch
|
|
1416
|
-
}) => next => action => {
|
|
1417
|
-
var _action$config, _action$config$defaul;
|
|
1418
|
-
|
|
1419
|
-
const result = next(action);
|
|
1420
|
-
|
|
1421
|
-
switch (action.type) {
|
|
1422
|
-
case String(Actions.initialize):
|
|
1423
|
-
case String(Actions.update):
|
|
1424
|
-
if (action !== null && action !== void 0 && (_action$config = action.config) !== null && _action$config !== void 0 && (_action$config$defaul = _action$config.defaults) !== null && _action$config$defaul !== void 0 && _action$config$defaul.agentName) {
|
|
1425
|
-
var _action$config2, _action$config2$defau;
|
|
1426
|
-
|
|
1427
|
-
dispatch({
|
|
1428
|
-
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
1429
|
-
title: action === null || action === void 0 ? void 0 : (_action$config2 = action.config) === null || _action$config2 === void 0 ? void 0 : (_action$config2$defau = _action$config2.defaults) === null || _action$config2$defau === void 0 ? void 0 : _action$config2$defau.agentName
|
|
1430
|
-
});
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
return result;
|
|
1436
|
-
};
|
|
1437
|
-
}
|
|
1438
|
-
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
1439
|
-
const CSS_NAME = 'cvco';
|
|
1440
|
-
const apiVersion = '2';
|
|
1441
|
-
const config_userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
|
|
1442
|
-
// broadcasting to the screen reader. This is done to avoid verbosity.
|
|
1443
|
-
|
|
1444
|
-
const unreadScreenReaderWait = 2000;
|
|
1445
|
-
const newMessageScreenReaderWait = 1000;
|
|
1446
|
-
const config_screenReaderDebounceDelaySeconds = 10;
|
|
1447
|
-
const activitySendDelay = 15000;
|
|
1448
|
-
const maxCharacterWarningLimit = 50;
|
|
1449
|
-
const maxCharacterSrDebounceDelay = 300;
|
|
1450
|
-
const config_defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
|
|
1451
|
-
|
|
1452
|
-
const config_typingTimeout = 2000;
|
|
1453
|
-
const defaultConfig = {
|
|
1454
|
-
namespace: 'default',
|
|
1455
|
-
layoutMode: 'window',
|
|
1456
|
-
// "window", "inline" ("sidebar"), "modal"
|
|
1457
|
-
messages: {
|
|
1458
|
-
agent: {
|
|
1459
|
-
showAvatar: false,
|
|
1460
|
-
// true, "inline"
|
|
1461
|
-
showName: false
|
|
1462
|
-
},
|
|
1463
|
-
user: {
|
|
1464
|
-
showAvatar: false,
|
|
1465
|
-
// true, "inline"
|
|
1466
|
-
showName: false
|
|
1467
|
-
},
|
|
1468
|
-
timeIndicator: {
|
|
1469
|
-
enabled: false,
|
|
1470
|
-
threshold: 3600000 // Default threshold is an hour in milliseconds
|
|
1471
|
-
|
|
1472
|
-
}
|
|
1473
|
-
},
|
|
1474
|
-
appContainerClassNames: config => [`app--layout-${config.layoutMode}`, `namespace--${config.namespace}`]
|
|
1475
|
-
};
|
|
1476
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/config/reducer.js
|
|
1477
|
-
const _excluded = ["messages"];
|
|
1524
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-state-hooks.js
|
|
1525
|
+
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; }
|
|
1478
1526
|
|
|
1479
|
-
function
|
|
1527
|
+
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; }
|
|
1480
1528
|
|
|
1481
|
-
function
|
|
1529
|
+
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; }
|
|
1482
1530
|
|
|
1483
|
-
function reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1484
1531
|
|
|
1485
|
-
function reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reducer_ownKeys(Object(source), true).forEach(function (key) { reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1486
1532
|
|
|
1487
|
-
function reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1488
1533
|
|
|
1489
1534
|
|
|
1490
1535
|
|
|
1491
1536
|
|
|
1537
|
+
const seamly_state_hooks_selectState = state => state.state;
|
|
1538
|
+
const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
|
|
1539
|
+
const selectEventsWithSuggestion = createSelector(seamly_state_hooks_selectState, selectConfig, selectUserHasResponded, ({
|
|
1540
|
+
events,
|
|
1541
|
+
serviceData
|
|
1542
|
+
}, config, userHasResponded) => {
|
|
1543
|
+
var _serviceData$suggesti;
|
|
1492
1544
|
|
|
1545
|
+
if (userHasResponded || config.layoutMode === 'inline' || !serviceData.suggestion || !((_serviceData$suggesti = serviceData.suggestion) !== null && _serviceData$suggesti !== void 0 && _serviceData$suggesti.body.length)) {
|
|
1546
|
+
return events;
|
|
1547
|
+
}
|
|
1493
1548
|
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
defaults: {}
|
|
1549
|
+
const suggestionsEvent = {
|
|
1550
|
+
type: 'service_data',
|
|
1551
|
+
payload: serviceData.suggestion
|
|
1552
|
+
};
|
|
1553
|
+
return [...events, suggestionsEvent];
|
|
1500
1554
|
});
|
|
1555
|
+
const selectEvents = createSelector(selectEventsWithSuggestion, selectConfig, (events, config) => {
|
|
1556
|
+
var _config$messages$time, _config$messages;
|
|
1501
1557
|
|
|
1502
|
-
const
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
config
|
|
1506
|
-
}) => {
|
|
1507
|
-
const _pick = pick(config, configKeys),
|
|
1508
|
-
{
|
|
1509
|
-
messages
|
|
1510
|
-
} = _pick,
|
|
1511
|
-
partialConfig = _objectWithoutProperties(_pick, _excluded);
|
|
1512
|
-
|
|
1513
|
-
let newState = state;
|
|
1514
|
-
|
|
1515
|
-
if (Object.keys(partialConfig).length > 0) {
|
|
1516
|
-
newState = reducer_objectSpread(reducer_objectSpread({}, newState), partialConfig);
|
|
1517
|
-
}
|
|
1558
|
+
const {
|
|
1559
|
+
enabled,
|
|
1560
|
+
threshold
|
|
1561
|
+
} = (_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 : {};
|
|
1518
1562
|
|
|
1519
|
-
if (
|
|
1520
|
-
|
|
1521
|
-
messages: reducer_objectSpread(reducer_objectSpread({}, newState.messages), messages)
|
|
1522
|
-
});
|
|
1563
|
+
if (!enabled) {
|
|
1564
|
+
return events;
|
|
1523
1565
|
}
|
|
1524
1566
|
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
},
|
|
1536
|
-
|
|
1567
|
+
const mappedEvents = [];
|
|
1568
|
+
let previousEvent = null;
|
|
1569
|
+
events.forEach((event, idx) => {
|
|
1570
|
+
// always add timeIndicator to first message
|
|
1571
|
+
if (idx === 0) {
|
|
1572
|
+
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
1573
|
+
timeIndicator: event.payload.occurredAt
|
|
1574
|
+
})); // else check if diff is greater than threshold
|
|
1575
|
+
} else {
|
|
1576
|
+
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
1577
|
+
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
1578
|
+
timeIndicator
|
|
1579
|
+
}));
|
|
1580
|
+
}
|
|
1537
1581
|
|
|
1582
|
+
previousEvent = event;
|
|
1583
|
+
});
|
|
1584
|
+
return mappedEvents;
|
|
1585
|
+
});
|
|
1586
|
+
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
1587
|
+
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
1588
|
+
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
1589
|
+
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
1590
|
+
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
1591
|
+
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
1592
|
+
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
1593
|
+
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
1594
|
+
var _filteredEvents;
|
|
1538
1595
|
|
|
1596
|
+
const filteredEvents = events.filter(event => event.type === 'message');
|
|
1597
|
+
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
1598
|
+
});
|
|
1599
|
+
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
1600
|
+
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
1601
|
+
const useSeamlyCurrentAgent = () => {
|
|
1602
|
+
const {
|
|
1603
|
+
participants,
|
|
1604
|
+
currentAgent
|
|
1605
|
+
} = seamly_state_hooks_useSeamlyStateContext().participantInfo;
|
|
1606
|
+
return currentAgent ? participants[currentAgent] : null;
|
|
1607
|
+
};
|
|
1608
|
+
const useSeamlyServiceData = key => seamly_state_hooks_useSeamlyStateContext().serviceData[key];
|
|
1609
|
+
const useEntryTextLimit = () => {
|
|
1610
|
+
const {
|
|
1611
|
+
entryMeta: {
|
|
1612
|
+
options: {
|
|
1613
|
+
text
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
} = seamly_state_hooks_useSeamlyStateContext();
|
|
1617
|
+
const {
|
|
1618
|
+
limit
|
|
1619
|
+
} = text || {};
|
|
1620
|
+
return {
|
|
1621
|
+
hasLimit: limit != null,
|
|
1622
|
+
limit: limit != null ? limit : null
|
|
1623
|
+
};
|
|
1624
|
+
};
|
|
1625
|
+
const useSeamlyLayoutMode = () => {
|
|
1626
|
+
const {
|
|
1627
|
+
layoutMode
|
|
1628
|
+
} = useConfig();
|
|
1629
|
+
return {
|
|
1630
|
+
isInline: layoutMode === 'inline',
|
|
1631
|
+
isWindow: layoutMode === 'window',
|
|
1632
|
+
isResolving: !layoutMode
|
|
1633
|
+
};
|
|
1634
|
+
};
|
|
1635
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/actions.js
|
|
1636
|
+
function actions_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1539
1637
|
|
|
1638
|
+
function actions_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { actions_ownKeys(Object(source), true).forEach(function (key) { actions_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { actions_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1540
1639
|
|
|
1640
|
+
function actions_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1541
1641
|
|
|
1542
1642
|
|
|
1543
|
-
;// CONCATENATED MODULE: ./src/javascripts/lib/mutex.js
|
|
1544
|
-
function createMutex() {
|
|
1545
|
-
let isRunning = false;
|
|
1546
|
-
const tasks = [];
|
|
1547
1643
|
|
|
1548
|
-
const next = async () => {
|
|
1549
|
-
if (!isRunning) {
|
|
1550
|
-
while (tasks.length) {
|
|
1551
|
-
const task = tasks.shift();
|
|
1552
|
-
isRunning = true; // eslint-disable-next-line no-await-in-loop
|
|
1553
1644
|
|
|
1554
|
-
await task().catch(() => {});
|
|
1555
|
-
isRunning = false;
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
1645
|
|
|
1560
|
-
const runExclusively = async task => {
|
|
1561
|
-
const prms = new Promise((resolve, reject) => {
|
|
1562
|
-
tasks.push(async () => {
|
|
1563
|
-
try {
|
|
1564
|
-
resolve(await task());
|
|
1565
|
-
} catch (e) {
|
|
1566
|
-
reject(e);
|
|
1567
|
-
}
|
|
1568
|
-
});
|
|
1569
|
-
});
|
|
1570
|
-
next();
|
|
1571
|
-
return prms;
|
|
1572
|
-
};
|
|
1573
1646
|
|
|
1574
|
-
return {
|
|
1575
|
-
next,
|
|
1576
|
-
runExclusively
|
|
1577
|
-
};
|
|
1578
|
-
}
|
|
1579
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/utils.js
|
|
1580
1647
|
|
|
1581
|
-
const {
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1648
|
+
const setFromStorage = visibility_utils_createAction('setFromStorage', visibility => ({
|
|
1649
|
+
visibility
|
|
1650
|
+
}));
|
|
1651
|
+
const validVisibilityStates = [constants_visibilityStates.open, constants_visibilityStates.minimized, constants_visibilityStates.hidden];
|
|
1652
|
+
const setVisibility = visibility_utils_createThunk('set', (requestedVisibility, {
|
|
1653
|
+
getState,
|
|
1654
|
+
extra: {
|
|
1655
|
+
api,
|
|
1656
|
+
eventBus
|
|
1657
|
+
}
|
|
1658
|
+
}) => {
|
|
1659
|
+
const state = getState();
|
|
1660
|
+
const previousVisibility = selectVisibility(state);
|
|
1661
|
+
const hasResponded = selectUserHasResponded(state);
|
|
1662
|
+
const hasConversation = api.hasConversation();
|
|
1663
|
+
const config = selectConfig(state);
|
|
1664
|
+
const {
|
|
1665
|
+
visibilityCallback = calculateVisibility,
|
|
1666
|
+
layoutMode
|
|
1667
|
+
} = config;
|
|
1668
|
+
const {
|
|
1669
|
+
unreadEvents: unreadMessageCount
|
|
1670
|
+
} = seamly_state_hooks_selectState(state);
|
|
1671
|
+
const calculatedVisibility = visibilityCallback({
|
|
1672
|
+
hasConversation,
|
|
1673
|
+
hasResponded,
|
|
1674
|
+
previousVisibility,
|
|
1675
|
+
requestedVisibility,
|
|
1676
|
+
config
|
|
1677
|
+
});
|
|
1588
1678
|
|
|
1679
|
+
if (!validVisibilityStates.includes(calculatedVisibility)) {
|
|
1680
|
+
console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
|
|
1681
|
+
return undefined;
|
|
1682
|
+
}
|
|
1589
1683
|
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1684
|
+
if (previousVisibility === calculatedVisibility) {
|
|
1685
|
+
return undefined;
|
|
1686
|
+
} // Store the user-requested visibility in order to reinitialize after refresh
|
|
1593
1687
|
|
|
1594
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/actions.js
|
|
1595
1688
|
|
|
1689
|
+
api.store.set(StoreKey, actions_objectSpread(actions_objectSpread({}, api.store.get(StoreKey) || {}), {}, {
|
|
1690
|
+
[layoutMode]: requestedVisibility
|
|
1691
|
+
}));
|
|
1596
1692
|
|
|
1693
|
+
if (requestedVisibility) {
|
|
1694
|
+
eventBus.emit('ui.visible', requestedVisibility, {
|
|
1695
|
+
visibility: requestedVisibility,
|
|
1696
|
+
hasConversation,
|
|
1697
|
+
hasResponded,
|
|
1698
|
+
unreadMessageCount
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1597
1701
|
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
const setLocale = i18n_utils_createThunk('setLocale', async (locale, {
|
|
1702
|
+
return calculatedVisibility;
|
|
1703
|
+
});
|
|
1704
|
+
const actions_initialize = visibility_utils_createThunk('initialize', async (locale, {
|
|
1705
|
+
dispatch,
|
|
1603
1706
|
getState,
|
|
1604
1707
|
extra: {
|
|
1605
1708
|
api
|
|
1606
1709
|
}
|
|
1607
1710
|
}) => {
|
|
1608
|
-
|
|
1609
|
-
if (locale === selectLocale(getState())) {
|
|
1610
|
-
return undefined;
|
|
1611
|
-
}
|
|
1711
|
+
var _api$store$get;
|
|
1612
1712
|
|
|
1613
|
-
|
|
1614
|
-
|
|
1713
|
+
// initialize stored visibility
|
|
1714
|
+
const {
|
|
1715
|
+
layoutMode
|
|
1716
|
+
} = selectConfig(getState());
|
|
1717
|
+
const storedVisibility = (_api$store$get = api.store.get(StoreKey)) === null || _api$store$get === void 0 ? void 0 : _api$store$get[layoutMode];
|
|
1718
|
+
|
|
1719
|
+
if (storedVisibility) {
|
|
1720
|
+
dispatch(setFromStorage(storedVisibility));
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
dispatch(setVisibility(constants_visibilityStates.initialize));
|
|
1615
1724
|
});
|
|
1616
|
-
;// CONCATENATED MODULE: ./
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1725
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unavailable-error.js
|
|
1726
|
+
/**
|
|
1727
|
+
* This error is used to alert the user that there's a problem with the connection
|
|
1728
|
+
* when initialising the application because of a connection issue on either the server
|
|
1729
|
+
* or the client side.
|
|
1730
|
+
*/
|
|
1731
|
+
class SeamlyUnavailableError extends Error {
|
|
1732
|
+
constructor(params) {
|
|
1733
|
+
super(params);
|
|
1623
1734
|
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
var _d = false;
|
|
1735
|
+
if (Error.captureStackTrace) {
|
|
1736
|
+
Error.captureStackTrace(this, SeamlyUnavailableError);
|
|
1737
|
+
}
|
|
1628
1738
|
|
|
1629
|
-
|
|
1739
|
+
this.name = 'SeamlyUnavailableError';
|
|
1740
|
+
this.langKey = 'errors.seamlyUnavailable';
|
|
1741
|
+
}
|
|
1630
1742
|
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1743
|
+
}
|
|
1744
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-base-error.js
|
|
1745
|
+
class SeamlyBaseError extends Error {
|
|
1746
|
+
constructor(originalError, ...params) {
|
|
1747
|
+
super(...params);
|
|
1634
1748
|
|
|
1635
|
-
|
|
1749
|
+
if (Error.captureStackTrace) {
|
|
1750
|
+
Error.captureStackTrace(this, Object.getPrototypeOf(this));
|
|
1636
1751
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1752
|
+
|
|
1753
|
+
this.originalError = originalError;
|
|
1754
|
+
|
|
1755
|
+
if (originalError !== null && originalError !== void 0 && originalError.payload) {
|
|
1756
|
+
this.originalEvent = originalError;
|
|
1757
|
+
this.originalError = originalError.payload.error;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
if (originalError !== null && originalError !== void 0 && originalError.error) {
|
|
1761
|
+
this.originalError = originalError.error;
|
|
1645
1762
|
}
|
|
1646
1763
|
}
|
|
1647
1764
|
|
|
1648
|
-
return _arr;
|
|
1649
1765
|
}
|
|
1650
|
-
;// CONCATENATED MODULE: ./
|
|
1651
|
-
function _arrayLikeToArray(arr, len) {
|
|
1652
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1766
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-session-expired-error.js
|
|
1653
1767
|
|
|
1654
|
-
|
|
1655
|
-
|
|
1768
|
+
class SeamlySessionExpiredError extends SeamlyBaseError {
|
|
1769
|
+
constructor(originalError, ...params) {
|
|
1770
|
+
super(originalError, ...params);
|
|
1771
|
+
this.name = 'SeamlySessionExpiredError';
|
|
1772
|
+
this.action = 'reset';
|
|
1656
1773
|
}
|
|
1657
1774
|
|
|
1658
|
-
return arr2;
|
|
1659
1775
|
}
|
|
1660
|
-
;// CONCATENATED MODULE: ./
|
|
1776
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/utils.js
|
|
1661
1777
|
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1669
|
-
}
|
|
1670
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
1671
|
-
function _nonIterableRest() {
|
|
1672
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1673
|
-
}
|
|
1674
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
1778
|
+
const {
|
|
1779
|
+
createAction: interrupt_utils_createAction,
|
|
1780
|
+
createReducer: interrupt_utils_createReducer,
|
|
1781
|
+
selectState: interrupt_utils_selectState
|
|
1782
|
+
} = createDomain('interrupt');
|
|
1783
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/actions.js
|
|
1675
1784
|
|
|
1785
|
+
const set = interrupt_utils_createAction('set', error => ({
|
|
1786
|
+
error
|
|
1787
|
+
}));
|
|
1788
|
+
const clear = interrupt_utils_createAction('clear');
|
|
1789
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
|
|
1676
1790
|
|
|
1677
1791
|
|
|
1678
1792
|
|
|
1679
|
-
function _slicedToArray(arr, i) {
|
|
1680
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
1681
|
-
}
|
|
1682
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
1683
|
-
function _classCallCheck(instance, Constructor) {
|
|
1684
|
-
if (!(instance instanceof Constructor)) {
|
|
1685
|
-
throw new TypeError("Cannot call a class as a function");
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
1689
|
-
function _defineProperties(target, props) {
|
|
1690
|
-
for (var i = 0; i < props.length; i++) {
|
|
1691
|
-
var descriptor = props[i];
|
|
1692
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
1693
|
-
descriptor.configurable = true;
|
|
1694
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
1695
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
1793
|
|
|
1699
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
1700
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
1701
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1702
|
-
return Constructor;
|
|
1703
|
-
}
|
|
1704
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
1705
|
-
function defineProperty_defineProperty(obj, key, value) {
|
|
1706
|
-
if (key in obj) {
|
|
1707
|
-
Object.defineProperty(obj, key, {
|
|
1708
|
-
value: value,
|
|
1709
|
-
enumerable: true,
|
|
1710
|
-
configurable: true,
|
|
1711
|
-
writable: true
|
|
1712
|
-
});
|
|
1713
|
-
} else {
|
|
1714
|
-
obj[key] = value;
|
|
1715
|
-
}
|
|
1716
1794
|
|
|
1717
|
-
return obj;
|
|
1718
|
-
}
|
|
1719
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/array-utils/array-utils.es.js
|
|
1720
|
-
/*
|
|
1721
|
-
* Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
1722
|
-
*
|
|
1723
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1724
|
-
* you may not use this file except in compliance with the License.
|
|
1725
|
-
* You may obtain a copy of the License at
|
|
1726
|
-
*
|
|
1727
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1728
|
-
*
|
|
1729
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1730
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1731
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1732
|
-
* See the License for the specific language governing permissions and
|
|
1733
|
-
* limitations under the License.
|
|
1734
|
-
*/
|
|
1735
1795
|
|
|
1736
|
-
/**
|
|
1737
|
-
* Flattens an array of arrays of infinite depth into a single-dimension array.
|
|
1738
|
-
*
|
|
1739
|
-
* > This is now natively in JavaScript as the `flat` method on an Array
|
|
1740
|
-
* > instance. [Check MDN for which browsers have access to this feature](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat).
|
|
1741
|
-
* > If you can't use `flat`, then this method will do the job 🙂
|
|
1742
|
-
*
|
|
1743
|
-
* @param {Array} array
|
|
1744
|
-
* @return {Array} Flattened array.
|
|
1745
|
-
*/
|
|
1746
|
-
function flatten(array) {
|
|
1747
|
-
return array.reduce(function (accumulator, value) {
|
|
1748
|
-
return accumulator.concat(Array.isArray(value) ? flatten(value) : value);
|
|
1749
|
-
}, []);
|
|
1750
|
-
}
|
|
1751
|
-
/**
|
|
1752
|
-
* Creates an array of numbers from the starting value (inclusive) to the end
|
|
1753
|
-
* (exclusive), with an optional step (the gap between values).
|
|
1754
|
-
*
|
|
1755
|
-
* @param {Number} start
|
|
1756
|
-
* The value to start at, the first item in the returned array.
|
|
1757
|
-
* @param {Number} end
|
|
1758
|
-
* The value to end with, the last item in the returned array.
|
|
1759
|
-
* @param {Number} [step=1]
|
|
1760
|
-
* The increment/gap between values, defaults to 1.
|
|
1761
|
-
* @return {Array} An array encompassing the given range.
|
|
1762
|
-
*/
|
|
1763
1796
|
|
|
1764
|
-
function range(start, end) {
|
|
1765
|
-
var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1766
|
-
return Array.apply(0, Array(Math.ceil((end - start) / step))).map(function (empty, index) {
|
|
1767
|
-
return index * step + start;
|
|
1768
|
-
});
|
|
1769
|
-
}
|
|
1770
|
-
/**
|
|
1771
|
-
* Remove and return the first item from `array` that matches the predicate
|
|
1772
|
-
* function.
|
|
1773
|
-
*
|
|
1774
|
-
* @param {Array} array
|
|
1775
|
-
* @param {Function} predicate
|
|
1776
|
-
* Invoked with the array item.
|
|
1777
|
-
* @return {Object} The matching item, or `null` if no match was found.
|
|
1778
|
-
*/
|
|
1779
|
-
|
|
1780
|
-
function remove(array, predicate) {
|
|
1781
|
-
return array.find(function (item, index) {
|
|
1782
|
-
if (predicate(item)) {
|
|
1783
|
-
array.splice(index, 1);
|
|
1784
|
-
return item;
|
|
1785
|
-
}
|
|
1786
|
-
});
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
//# sourceMappingURL=array-utils.es.js.map
|
|
1790
|
-
;// CONCATENATED MODULE: ./node_modules/@ultraq/function-utils/function-utils.es.js
|
|
1791
|
-
/**
|
|
1792
|
-
* A higher-order function to apply [memoization](https://en.wikipedia.org/wiki/Memoization).
|
|
1793
|
-
*
|
|
1794
|
-
* If memoizing a recursive function, then memoize and define the function at
|
|
1795
|
-
* the same time so you can make a call to the memoized function, eg:
|
|
1796
|
-
*
|
|
1797
|
-
* ```javascript
|
|
1798
|
-
* const myFunction = memoize(() => myFunction());
|
|
1799
|
-
* ```
|
|
1800
|
-
*
|
|
1801
|
-
* @param {Function} func
|
|
1802
|
-
* @return {Function}
|
|
1803
|
-
*/
|
|
1804
|
-
function memoize(func) {
|
|
1805
|
-
var cache = {};
|
|
1806
|
-
return function () {
|
|
1807
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1808
|
-
args[_key] = arguments[_key];
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
var key = args.length ? args.map(function (arg) {
|
|
1812
|
-
return arg === null ? 'null' : arg === undefined ? 'undefined' : typeof arg === 'function' ? arg.toString() : arg instanceof Date ? arg.toISOString() : JSON.stringify(arg);
|
|
1813
|
-
}).join('|') : '_(no-args)_';
|
|
1814
1797
|
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
}
|
|
1798
|
+
const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
|
|
1799
|
+
hasResponded
|
|
1800
|
+
}));
|
|
1801
|
+
const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
1802
|
+
dispatch,
|
|
1803
|
+
extra: {
|
|
1804
|
+
api,
|
|
1805
|
+
config
|
|
1806
|
+
}
|
|
1807
|
+
}) => {
|
|
1808
|
+
var _config$context;
|
|
1824
1809
|
|
|
1825
|
-
|
|
1826
|
-
|
|
1810
|
+
dispatch(initialize(config));
|
|
1811
|
+
let locale = config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale;
|
|
1827
1812
|
|
|
1813
|
+
try {
|
|
1814
|
+
const {
|
|
1815
|
+
features,
|
|
1816
|
+
defaultLocale,
|
|
1817
|
+
preChat
|
|
1818
|
+
} = await api.getConfig();
|
|
1819
|
+
dispatch({
|
|
1820
|
+
type: seamly_utils_seamlyActions.SET_FEATURES,
|
|
1821
|
+
features
|
|
1822
|
+
});
|
|
1823
|
+
locale = locale || defaultLocale;
|
|
1824
|
+
dispatch(setInitialLocale(locale));
|
|
1825
|
+
dispatch(setPreChatEvents(preChat.map(payload => ({
|
|
1826
|
+
type: 'message',
|
|
1827
|
+
payload
|
|
1828
|
+
}))));
|
|
1829
|
+
} catch (e) {
|
|
1830
|
+
throw new SeamlyUnavailableError();
|
|
1831
|
+
}
|
|
1828
1832
|
|
|
1833
|
+
try {
|
|
1834
|
+
if (api.hasConversation()) {
|
|
1835
|
+
var _initialState$transla;
|
|
1829
1836
|
|
|
1837
|
+
const initialState = await api.getConversationIntitialState();
|
|
1838
|
+
dispatch({
|
|
1839
|
+
type: seamly_utils_seamlyActions.SET_INITIAL_STATE,
|
|
1840
|
+
initialState
|
|
1841
|
+
});
|
|
1842
|
+
locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
|
|
1830
1843
|
|
|
1844
|
+
if ('userResponded' in initialState) {
|
|
1845
|
+
dispatch(setHasResponded(initialState.userResponded));
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
} catch (e) {
|
|
1849
|
+
if (e instanceof SeamlySessionExpiredError) {
|
|
1850
|
+
throw e;
|
|
1851
|
+
}
|
|
1831
1852
|
|
|
1853
|
+
throw new SeamlyUnavailableError();
|
|
1854
|
+
} finally {
|
|
1855
|
+
await dispatch(setLocale(locale));
|
|
1856
|
+
dispatch(actions_initialize());
|
|
1857
|
+
}
|
|
1858
|
+
});
|
|
1859
|
+
const actions_reset = app_utils_createThunk('reset', async (config, {
|
|
1860
|
+
dispatch,
|
|
1861
|
+
extra: {
|
|
1862
|
+
api
|
|
1863
|
+
}
|
|
1864
|
+
}) => {
|
|
1865
|
+
try {
|
|
1866
|
+
await api.disconnect();
|
|
1867
|
+
await api.clearStore();
|
|
1868
|
+
dispatch(app_actions_initialize());
|
|
1869
|
+
} catch (error) {
|
|
1870
|
+
dispatch(set(error));
|
|
1871
|
+
}
|
|
1872
|
+
});
|
|
1873
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/store/state-reducer.js
|
|
1874
|
+
// Legacy state reducer. Do not add new features here but extract/create new reducers as needed
|
|
1832
1875
|
|
|
1833
1876
|
|
|
1834
|
-
/*
|
|
1835
|
-
* Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
1836
|
-
*
|
|
1837
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1838
|
-
* you may not use this file except in compliance with the License.
|
|
1839
|
-
* You may obtain a copy of the License at
|
|
1840
|
-
*
|
|
1841
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1842
|
-
*
|
|
1843
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1844
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1845
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1846
|
-
* See the License for the specific language governing permissions and
|
|
1847
|
-
* limitations under the License.
|
|
1848
|
-
*/
|
|
1849
1877
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1878
|
+
const initialState = {
|
|
1879
|
+
events: [],
|
|
1880
|
+
initialState: {},
|
|
1881
|
+
unreadEvents: 0,
|
|
1882
|
+
isLoading: false,
|
|
1883
|
+
idleDetachCountdown: {
|
|
1884
|
+
hasCountdown: false,
|
|
1885
|
+
isActive: false
|
|
1886
|
+
},
|
|
1887
|
+
resumeConversationPrompt: false,
|
|
1888
|
+
serviceInfo: {
|
|
1889
|
+
activeServiceSessionId: ''
|
|
1890
|
+
},
|
|
1891
|
+
participantInfo: {
|
|
1892
|
+
participants: {},
|
|
1893
|
+
currentAgent: ''
|
|
1894
|
+
},
|
|
1895
|
+
headerTitles: {
|
|
1896
|
+
title: null,
|
|
1897
|
+
subTitle: ''
|
|
1898
|
+
},
|
|
1899
|
+
historyLoaded: false,
|
|
1900
|
+
skiplinkTargetId: id_randomId(),
|
|
1901
|
+
optionsButtonId: id_randomId(),
|
|
1902
|
+
headerCollapseButtonId: id_randomId(),
|
|
1903
|
+
serviceData: {},
|
|
1904
|
+
options: {
|
|
1905
|
+
features: {},
|
|
1906
|
+
panelActive: false,
|
|
1907
|
+
optionActive: '',
|
|
1908
|
+
userSelectedOptions: {}
|
|
1909
|
+
},
|
|
1910
|
+
showFileUpload: false,
|
|
1911
|
+
currentUploads: [],
|
|
1912
|
+
entryMeta: {
|
|
1913
|
+
default: entryTypes.text,
|
|
1914
|
+
active: entryTypes.text,
|
|
1915
|
+
userSelected: null,
|
|
1916
|
+
blockAutoEntrySwitch: false,
|
|
1917
|
+
options: {},
|
|
1918
|
+
optionsOverride: {}
|
|
1919
|
+
},
|
|
1920
|
+
seamlyContainerElement: null
|
|
1921
|
+
};
|
|
1922
|
+
function stateReducer(state = initialState, action) {
|
|
1923
|
+
if (action.type === String(app_actions_initialize.pending)) {
|
|
1924
|
+
return initialState;
|
|
1925
|
+
}
|
|
1868
1926
|
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
var latestTerm = null;
|
|
1873
|
-
var inTerm = false;
|
|
1874
|
-
var i = 0;
|
|
1927
|
+
return seamlyStateReducer(state, action);
|
|
1928
|
+
}
|
|
1929
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/utils.js
|
|
1875
1930
|
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1931
|
+
const {
|
|
1932
|
+
createActions: forms_utils_createActions,
|
|
1933
|
+
createReducer: forms_utils_createReducer,
|
|
1934
|
+
selectState: forms_utils_selectState
|
|
1935
|
+
} = createDomain('forms');
|
|
1936
|
+
function utils_validate(values, schema = {}) {
|
|
1937
|
+
return Object.entries(schema).reduce((errors, [key, validations]) => {
|
|
1938
|
+
if (validations && !Array.isArray(validations)) {
|
|
1939
|
+
// eslint-disable-next-line no-param-reassign
|
|
1940
|
+
validations = [validations];
|
|
1941
|
+
}
|
|
1881
1942
|
|
|
1882
|
-
|
|
1883
|
-
|
|
1943
|
+
for (let i = 0; (_ref = i < ((_validations = validations) === null || _validations === void 0 ? void 0 : _validations.length)) !== null && _ref !== void 0 ? _ref : 0; i++) {
|
|
1944
|
+
var _ref, _validations;
|
|
1945
|
+
|
|
1946
|
+
if (!validations[i].fn(values[key], validations[i].compareValue)) {
|
|
1947
|
+
errors[key] = validations[i].errorText;
|
|
1948
|
+
break;
|
|
1884
1949
|
}
|
|
1885
|
-
}
|
|
1886
|
-
else if (!inTerm && !isWhitespace(string[i])) {
|
|
1887
|
-
var caseBody = string[i] === '{'; // If there's a previous term, we can either handle a whole
|
|
1888
|
-
// case, or add that as an argument.
|
|
1950
|
+
}
|
|
1889
1951
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1952
|
+
return errors;
|
|
1953
|
+
}, {});
|
|
1954
|
+
}
|
|
1955
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/actions.js
|
|
1892
1956
|
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1957
|
+
const [registerForm, deregisterForm] = forms_utils_createActions('form', {
|
|
1958
|
+
register: (formId, persistData) => ({
|
|
1959
|
+
formId,
|
|
1960
|
+
persistData
|
|
1961
|
+
}),
|
|
1962
|
+
deregister: formId => ({
|
|
1963
|
+
formId
|
|
1964
|
+
})
|
|
1965
|
+
});
|
|
1966
|
+
const [registerControl, deregisterControl, updateControlValue, updateControlTouched] = forms_utils_createActions('control', {
|
|
1967
|
+
register: (formId, name) => ({
|
|
1968
|
+
formId,
|
|
1969
|
+
name
|
|
1970
|
+
}),
|
|
1971
|
+
deregister: (formId, name) => ({
|
|
1972
|
+
formId,
|
|
1973
|
+
name
|
|
1974
|
+
}),
|
|
1975
|
+
updateValue: (formId, name, value) => ({
|
|
1976
|
+
formId,
|
|
1977
|
+
name,
|
|
1978
|
+
value
|
|
1979
|
+
}),
|
|
1980
|
+
updateTouched: (formId, name, touched) => ({
|
|
1981
|
+
formId,
|
|
1982
|
+
name,
|
|
1983
|
+
touched
|
|
1984
|
+
})
|
|
1985
|
+
});
|
|
1986
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/redux/utils.js
|
|
1987
|
+
const arrayContentEquals = (a, b) => {
|
|
1988
|
+
if (a === b) {
|
|
1989
|
+
return true;
|
|
1990
|
+
}
|
|
1896
1991
|
|
|
1897
|
-
|
|
1992
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {
|
|
1993
|
+
return false;
|
|
1994
|
+
}
|
|
1898
1995
|
|
|
1899
|
-
|
|
1996
|
+
return a.every((value, idx) => b[idx] === value);
|
|
1997
|
+
};
|
|
1998
|
+
const getPropSelector = (propName, orDefault) => (_, props) => props[propName] || orDefault;
|
|
1999
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/selectors.js
|
|
1900
2000
|
|
|
1901
|
-
latestTerm = null;
|
|
1902
|
-
} else {
|
|
1903
|
-
if (latestTerm) {
|
|
1904
|
-
args.push(latestTerm);
|
|
1905
|
-
latestTerm = null;
|
|
1906
|
-
}
|
|
1907
2001
|
|
|
1908
|
-
inTerm = true;
|
|
1909
|
-
currTermStart = i;
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
2002
|
|
|
1913
|
-
|
|
1914
|
-
|
|
2003
|
+
const getState = forms_utils_selectState;
|
|
2004
|
+
const selectors_getFormById = createSelector(getState, getPropSelector('formId'), (forms, formId) => forms[formId]);
|
|
2005
|
+
const getFormControlsByFormId = createSelector(selectors_getFormById, form => (form === null || form === void 0 ? void 0 : form.controls) || {});
|
|
2006
|
+
const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId, controls => {
|
|
2007
|
+
const valuesObj = {};
|
|
2008
|
+
Object.entries(controls).forEach(([key, {
|
|
2009
|
+
value
|
|
2010
|
+
}]) => {
|
|
2011
|
+
valuesObj[key] = value;
|
|
2012
|
+
});
|
|
2013
|
+
return valuesObj;
|
|
2014
|
+
});
|
|
2015
|
+
const selectors_getControlValueByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) => {
|
|
2016
|
+
var _controls$name;
|
|
1915
2017
|
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
2018
|
+
return (_controls$name = controls[name]) === null || _controls$name === void 0 ? void 0 : _controls$name.value;
|
|
2019
|
+
});
|
|
2020
|
+
const selectors_getControlTouchedByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) => {
|
|
2021
|
+
var _controls$name2;
|
|
1919
2022
|
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
2023
|
+
return (_controls$name2 = controls[name]) === null || _controls$name2 === void 0 ? void 0 : _controls$name2.touched;
|
|
2024
|
+
});
|
|
2025
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/context.js
|
|
1923
2026
|
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
* strings that could have nested brackets.
|
|
1932
|
-
*
|
|
1933
|
-
* @param {String} string
|
|
1934
|
-
* @param {Number} fromIndex
|
|
1935
|
-
* @return {Number} The index of the matching closing bracket, or -1 if no
|
|
1936
|
-
* closing bracket could be found.
|
|
1937
|
-
*/
|
|
2027
|
+
const context_FormContext = (0,external_preact_namespaceObject.createContext)({});
|
|
2028
|
+
/* harmony default export */ const forms_context = ((/* unused pure expression or super */ null && (context_FormContext)));
|
|
2029
|
+
const {
|
|
2030
|
+
Provider: forms_context_Provider,
|
|
2031
|
+
Consumer: context_Consumer
|
|
2032
|
+
} = context_FormContext;
|
|
2033
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/hooks.js
|
|
1938
2034
|
|
|
1939
|
-
function findClosingBracket(string, fromIndex) {
|
|
1940
|
-
var depth = 0;
|
|
1941
2035
|
|
|
1942
|
-
for (var i = fromIndex + 1; i < string.length; i++) {
|
|
1943
|
-
var char = string.charAt(i);
|
|
1944
2036
|
|
|
1945
|
-
if (char === '}') {
|
|
1946
|
-
if (depth === 0) {
|
|
1947
|
-
return i;
|
|
1948
|
-
}
|
|
1949
2037
|
|
|
1950
|
-
depth--;
|
|
1951
|
-
} else if (char === '{') {
|
|
1952
|
-
depth++;
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
2038
|
|
|
1956
|
-
return -1;
|
|
1957
|
-
}
|
|
1958
|
-
/**
|
|
1959
|
-
* Split a `{key, type, format}` block into those 3 parts, taking into account
|
|
1960
|
-
* nested message syntax that can exist in the `format` part.
|
|
1961
|
-
*
|
|
1962
|
-
* @param {String} block
|
|
1963
|
-
* @return {Array}
|
|
1964
|
-
* An array with `key`, `type`, and `format` items in that order, if present
|
|
1965
|
-
* in the formatted argument block.
|
|
1966
|
-
*/
|
|
1967
2039
|
|
|
1968
|
-
function
|
|
1969
|
-
return
|
|
2040
|
+
function hooks_useFormContext() {
|
|
2041
|
+
return useContext(FormContext);
|
|
1970
2042
|
}
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
2043
|
+
function hooks_useForm() {
|
|
2044
|
+
const {
|
|
2045
|
+
handleSubmit,
|
|
2046
|
+
isSubmitted,
|
|
2047
|
+
isValid
|
|
2048
|
+
} = hooks_useFormContext();
|
|
2049
|
+
return {
|
|
2050
|
+
handleSubmit,
|
|
2051
|
+
isSubmitted,
|
|
2052
|
+
isValid
|
|
2053
|
+
};
|
|
2054
|
+
}
|
|
2055
|
+
function hooks_useValidations(values, validationSchema) {
|
|
2056
|
+
const errors = useMemo(() => validate(values, validationSchema), [values, validationSchema]);
|
|
2057
|
+
return {
|
|
2058
|
+
isValid: Object.keys(errors).length === 0,
|
|
2059
|
+
errors
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
function hooks_useFormControl(name) {
|
|
2063
|
+
const dispatch = useStoreDispatch();
|
|
2064
|
+
const {
|
|
2065
|
+
formId,
|
|
2066
|
+
updateControlValue,
|
|
2067
|
+
updateControlTouched,
|
|
2068
|
+
errors
|
|
2069
|
+
} = hooks_useFormContext();
|
|
2070
|
+
const form = useSelectorWithProps(getFormById, {
|
|
2071
|
+
formId
|
|
2072
|
+
}, [formId]);
|
|
2073
|
+
const isRegistered = !!form;
|
|
2074
|
+
const isRegisteredRef = useRef();
|
|
2075
|
+
isRegisteredRef.current = isRegistered;
|
|
2076
|
+
const value = useSelectorWithProps(getControlValueByName, {
|
|
2077
|
+
formId,
|
|
2078
|
+
name
|
|
2079
|
+
}, [formId, name]);
|
|
2080
|
+
const touched = useSelectorWithProps(getControlTouchedByName, {
|
|
2081
|
+
formId,
|
|
2082
|
+
name
|
|
2083
|
+
}, [formId, name]);
|
|
2084
|
+
const error = errors === null || errors === void 0 ? void 0 : errors[name];
|
|
2085
|
+
const isValid = !error;
|
|
2086
|
+
useEffect(() => {
|
|
2087
|
+
// Make sure the form is registered
|
|
2088
|
+
// Since child useEffect runs before FormProvider useEffect
|
|
2089
|
+
if (isRegisteredRef.current) {
|
|
2090
|
+
dispatch(Actions.registerControl(formId, name));
|
|
2091
|
+
}
|
|
2092
|
+
}, [isRegistered, formId, name, dispatch]);
|
|
2093
|
+
useLayoutEffect(() => {
|
|
2094
|
+
return () => {
|
|
2095
|
+
dispatch(Actions.deregisterControl(formId, name));
|
|
2096
|
+
};
|
|
2097
|
+
}, [isRegistered, formId, name, dispatch]); // preact uses onInput instead of onChange
|
|
2098
|
+
|
|
2099
|
+
const onInput = useCallback(e => updateControlValue(name, e.target.value), [name, updateControlValue]);
|
|
2100
|
+
const onBlur = useCallback(() => {
|
|
2101
|
+
updateControlTouched(name, true);
|
|
2102
|
+
}, [updateControlTouched, name]);
|
|
2103
|
+
const field = useMemo(() => ({
|
|
2104
|
+
name,
|
|
2105
|
+
onInput,
|
|
2106
|
+
onBlur,
|
|
2107
|
+
value
|
|
2108
|
+
}), [name, onInput, onBlur, value]);
|
|
2109
|
+
const meta = useMemo(() => ({
|
|
2110
|
+
isValid,
|
|
2111
|
+
error,
|
|
2112
|
+
touched
|
|
2113
|
+
}), [isValid, error, touched]);
|
|
2114
|
+
return [field, meta];
|
|
2115
|
+
}
|
|
2116
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/provider.js
|
|
2117
|
+
const _excluded = (/* unused pure expression or super */ null && (["children", "formId", "persistData", "onError", "onSubmit", "validationSchema"]));
|
|
1982
2118
|
|
|
1983
|
-
function
|
|
1984
|
-
var accumulator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
2119
|
+
function provider_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1985
2120
|
|
|
1986
|
-
|
|
1987
|
-
return accumulator;
|
|
1988
|
-
}
|
|
2121
|
+
function provider_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { provider_ownKeys(Object(source), true).forEach(function (key) { provider_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { provider_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1989
2122
|
|
|
1990
|
-
|
|
1991
|
-
accumulator.push(string);
|
|
1992
|
-
return accumulator;
|
|
1993
|
-
}
|
|
2123
|
+
function provider_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1994
2124
|
|
|
1995
|
-
|
|
2125
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1996
2126
|
|
|
1997
|
-
|
|
1998
|
-
accumulator.push(string);
|
|
1999
|
-
return accumulator;
|
|
2000
|
-
}
|
|
2127
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
2001
2128
|
|
|
2002
|
-
var head = string.substring(0, indexOfDelimiter).trim();
|
|
2003
|
-
var tail = string.substring(indexOfDelimiter + separator.length + 1).trim();
|
|
2004
|
-
accumulator.push(head);
|
|
2005
|
-
return split(tail, separator, limit - 1, accumulator);
|
|
2006
|
-
}
|
|
2007
2129
|
|
|
2008
|
-
/**
|
|
2009
|
-
* The main class for formatting messages.
|
|
2010
|
-
*
|
|
2011
|
-
* @author Emanuel Rabina
|
|
2012
|
-
*/
|
|
2013
2130
|
|
|
2014
|
-
var MessageFormatter = /*#__PURE__*/function () {
|
|
2015
|
-
/**
|
|
2016
|
-
* Creates a new formatter that can work using any of the custom type handlers
|
|
2017
|
-
* you register.
|
|
2018
|
-
*
|
|
2019
|
-
* @param {String} locale
|
|
2020
|
-
* @param {Object} [typeHandlers={}]
|
|
2021
|
-
* Optional object where the keys are the names of the types to register,
|
|
2022
|
-
* their values being the functions that will return a nicely formatted
|
|
2023
|
-
* string for the data and locale they are given.
|
|
2024
|
-
*/
|
|
2025
|
-
function MessageFormatter(locale) {
|
|
2026
|
-
var _this = this;
|
|
2027
2131
|
|
|
2028
|
-
var typeHandlers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2029
2132
|
|
|
2030
|
-
_classCallCheck(this, MessageFormatter);
|
|
2031
2133
|
|
|
2032
|
-
defineProperty_defineProperty(this, "format", memoize(function (message) {
|
|
2033
|
-
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2034
|
-
return flatten(_this.process(message, values)).join('');
|
|
2035
|
-
}));
|
|
2036
2134
|
|
|
2037
|
-
this.locale = locale;
|
|
2038
|
-
this.typeHandlers = typeHandlers;
|
|
2039
|
-
}
|
|
2040
|
-
/**
|
|
2041
|
-
* Formats an ICU message syntax string using `values` for placeholder data
|
|
2042
|
-
* and any currently-registered type handlers.
|
|
2043
|
-
*
|
|
2044
|
-
* @param {String} message
|
|
2045
|
-
* @param {Object} [values={}]
|
|
2046
|
-
* @return {String}
|
|
2047
|
-
*/
|
|
2048
2135
|
|
|
2136
|
+
function provider_FormProvider(_ref) {
|
|
2137
|
+
let {
|
|
2138
|
+
children,
|
|
2139
|
+
formId,
|
|
2140
|
+
persistData,
|
|
2141
|
+
onError,
|
|
2142
|
+
onSubmit,
|
|
2143
|
+
validationSchema
|
|
2144
|
+
} = _ref,
|
|
2145
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
2049
2146
|
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
* This method is used by {@link MessageFormatter#format} where it acts as a
|
|
2062
|
-
* string renderer.
|
|
2063
|
-
*
|
|
2064
|
-
* @param {String} message
|
|
2065
|
-
* @param {Object} [values={}]
|
|
2066
|
-
* @return {Array}
|
|
2067
|
-
*/
|
|
2068
|
-
function process(message) {
|
|
2069
|
-
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2147
|
+
const dispatch = useStoreDispatch();
|
|
2148
|
+
const values = useSelectorWithProps(getFormValuesByFormId, {
|
|
2149
|
+
formId
|
|
2150
|
+
}, [formId]);
|
|
2151
|
+
const [isSubmitted, setIsSubmitted] = useState(false);
|
|
2152
|
+
const [externalErrors, setExternalErrors] = useState({});
|
|
2153
|
+
const {
|
|
2154
|
+
isValid: validationIsValid,
|
|
2155
|
+
errors: validationErrors
|
|
2156
|
+
} = useValidations(values, validationSchema);
|
|
2157
|
+
const errors = useMemo(() => provider_objectSpread(provider_objectSpread({}, validationErrors), externalErrors), [validationErrors, externalErrors]); // register
|
|
2070
2158
|
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2159
|
+
useLayoutEffect(() => {
|
|
2160
|
+
// register form in redux store
|
|
2161
|
+
dispatch(Actions.registerForm(formId, persistData));
|
|
2162
|
+
}, [formId, persistData, dispatch]); // deregister
|
|
2074
2163
|
|
|
2075
|
-
|
|
2164
|
+
useEffect(() => {
|
|
2165
|
+
return () => {
|
|
2166
|
+
// deregister form from redux store
|
|
2167
|
+
dispatch(Actions.deregisterForm(formId));
|
|
2168
|
+
};
|
|
2169
|
+
}, [formId, persistData, dispatch]);
|
|
2170
|
+
const updateControlValue = useCallback((name, value) => {
|
|
2171
|
+
dispatch(Actions.updateControlValue(formId, name, value));
|
|
2172
|
+
}, [formId, dispatch]);
|
|
2173
|
+
const updateControlTouched = useCallback((name, touched) => {
|
|
2174
|
+
dispatch(Actions.updateControlTouched(formId, name, touched));
|
|
2175
|
+
}, [dispatch, formId]); // Function to manually set an error
|
|
2076
2176
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2177
|
+
const setError = useCallback((name, error) => {
|
|
2178
|
+
setExternalErrors(val => {
|
|
2179
|
+
return provider_objectSpread(provider_objectSpread({}, val), {}, {
|
|
2180
|
+
[name]: error
|
|
2181
|
+
});
|
|
2182
|
+
});
|
|
2183
|
+
}, [setExternalErrors]);
|
|
2184
|
+
const handleSubmit = useCallback(e => {
|
|
2185
|
+
e.preventDefault();
|
|
2186
|
+
setIsSubmitted(true);
|
|
2079
2187
|
|
|
2080
|
-
|
|
2081
|
-
|
|
2188
|
+
if (validationIsValid) {
|
|
2189
|
+
onSubmit(values, {
|
|
2190
|
+
updateControlValue,
|
|
2191
|
+
setError
|
|
2192
|
+
});
|
|
2193
|
+
}
|
|
2194
|
+
}, [validationIsValid, onSubmit, values, updateControlValue, setError]); //
|
|
2082
2195
|
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2196
|
+
useEffect(() => {
|
|
2197
|
+
if (onError) {
|
|
2198
|
+
onError({
|
|
2199
|
+
errors,
|
|
2200
|
+
isSubmitted,
|
|
2201
|
+
isValid: Object.keys(errors).length === 0
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2204
|
+
}, [isSubmitted, errors, onError]);
|
|
2205
|
+
const contextValue = useMemo(() => ({
|
|
2206
|
+
formId,
|
|
2207
|
+
values,
|
|
2208
|
+
errors,
|
|
2209
|
+
isValid: Object.keys(errors).length === 0,
|
|
2210
|
+
isSubmitted,
|
|
2211
|
+
handleSubmit,
|
|
2212
|
+
validationSchema,
|
|
2213
|
+
updateControlValue,
|
|
2214
|
+
updateControlTouched
|
|
2215
|
+
}), [formId, values, errors, isSubmitted, handleSubmit, validationSchema, updateControlValue, updateControlTouched]);
|
|
2086
2216
|
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2217
|
+
if (!formId) {
|
|
2218
|
+
console.error('"formId" is required.');
|
|
2219
|
+
return null;
|
|
2220
|
+
}
|
|
2090
2221
|
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
format = _splitFormattedArgume2[2];
|
|
2222
|
+
if (!onSubmit) {
|
|
2223
|
+
console.error('"onSubmit" is required.');
|
|
2224
|
+
return null;
|
|
2225
|
+
}
|
|
2096
2226
|
|
|
2097
|
-
|
|
2227
|
+
return _jsx(Provider, provider_objectSpread(provider_objectSpread({}, props), {}, {
|
|
2228
|
+
value: contextValue,
|
|
2229
|
+
children: children
|
|
2230
|
+
}));
|
|
2231
|
+
}
|
|
2232
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/reducer.js
|
|
2233
|
+
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; }
|
|
2098
2234
|
|
|
2099
|
-
|
|
2100
|
-
body = '';
|
|
2101
|
-
}
|
|
2235
|
+
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; }
|
|
2102
2236
|
|
|
2103
|
-
|
|
2104
|
-
result.push(typeHandler ? typeHandler(body, format, this.locale, values, this.process.bind(this)) : body);
|
|
2105
|
-
var tail = message.substring(blockEndIndex + 1);
|
|
2237
|
+
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; }
|
|
2106
2238
|
|
|
2107
|
-
if (tail) {
|
|
2108
|
-
result.push(this.process(tail, values));
|
|
2109
|
-
}
|
|
2110
2239
|
|
|
2111
|
-
return result;
|
|
2112
|
-
}
|
|
2113
|
-
} else {
|
|
2114
|
-
throw new Error("Unbalanced curly braces in string: \"".concat(message, "\""));
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
2240
|
|
|
2118
|
-
return [message];
|
|
2119
|
-
}
|
|
2120
|
-
}]);
|
|
2121
2241
|
|
|
2122
|
-
|
|
2123
|
-
|
|
2242
|
+
const reducer_initialState = {};
|
|
2243
|
+
const initialFormState = {
|
|
2244
|
+
controls: {}
|
|
2245
|
+
};
|
|
2246
|
+
const initialControlState = {
|
|
2247
|
+
value: '',
|
|
2248
|
+
touched: false
|
|
2249
|
+
};
|
|
2124
2250
|
|
|
2125
|
-
function
|
|
2251
|
+
function updateFormControl(state, formId, name, controlState) {
|
|
2252
|
+
var _state$formId;
|
|
2126
2253
|
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2254
|
+
const currentControlState = ((_state$formId = state[formId]) === null || _state$formId === void 0 ? void 0 : _state$formId.controls[name]) || initialControlState;
|
|
2255
|
+
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
2256
|
+
[formId]: reducer_objectSpread(reducer_objectSpread({}, state[formId]), {}, {
|
|
2257
|
+
controls: reducer_objectSpread(reducer_objectSpread({}, state[formId].controls), {}, {
|
|
2258
|
+
[name]: reducer_objectSpread(reducer_objectSpread({}, currentControlState), controlState)
|
|
2259
|
+
})
|
|
2260
|
+
})
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2130
2263
|
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
*/
|
|
2264
|
+
/* harmony default export */ const reducer = (forms_utils_createReducer({
|
|
2265
|
+
// Form handlers
|
|
2266
|
+
[registerForm]: (state, {
|
|
2267
|
+
formId,
|
|
2268
|
+
persistData
|
|
2269
|
+
}) => {
|
|
2270
|
+
var _state$formId2;
|
|
2139
2271
|
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2272
|
+
const formState = persistData ? (_state$formId2 = state[formId]) !== null && _state$formId2 !== void 0 ? _state$formId2 : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
2273
|
+
persistData
|
|
2274
|
+
}) : reducer_objectSpread(reducer_objectSpread({}, initialFormState), {}, {
|
|
2275
|
+
persistData
|
|
2276
|
+
});
|
|
2277
|
+
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
2278
|
+
[formId]: formState
|
|
2279
|
+
});
|
|
2280
|
+
},
|
|
2281
|
+
[deregisterForm]: (state, {
|
|
2282
|
+
formId
|
|
2283
|
+
}) => {
|
|
2284
|
+
var _newState$formId;
|
|
2285
|
+
|
|
2286
|
+
const newState = reducer_objectSpread({}, state);
|
|
2145
2287
|
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
var keyParam = "__hashToken".concat(keyCounter++);
|
|
2149
|
-
output += "{".concat(keyParam, ", number}");
|
|
2150
|
-
numberValues[keyParam] = value;
|
|
2151
|
-
} else {
|
|
2152
|
-
output += caseBody[i];
|
|
2288
|
+
if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
|
|
2289
|
+
delete newState[formId];
|
|
2153
2290
|
}
|
|
2154
2291
|
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2292
|
+
return newState;
|
|
2293
|
+
},
|
|
2294
|
+
// Form control handlers
|
|
2295
|
+
[registerControl]: (state, {
|
|
2296
|
+
name,
|
|
2297
|
+
formId
|
|
2298
|
+
}) => {
|
|
2299
|
+
return updateFormControl(state, formId, name);
|
|
2300
|
+
},
|
|
2301
|
+
[deregisterControl]: (state, {
|
|
2302
|
+
formId,
|
|
2303
|
+
name
|
|
2304
|
+
}) => {
|
|
2305
|
+
const form = state[formId];
|
|
2160
2306
|
|
|
2161
|
-
|
|
2162
|
-
|
|
2307
|
+
if (!form) {
|
|
2308
|
+
return state;
|
|
2309
|
+
}
|
|
2163
2310
|
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
};
|
|
2168
|
-
}
|
|
2169
|
-
/**
|
|
2170
|
-
* Handler for `plural` statements within ICU message syntax strings. Returns
|
|
2171
|
-
* a formatted string for the branch that closely matches the current value.
|
|
2172
|
-
*
|
|
2173
|
-
* See https://formatjs.io/docs/core-concepts/icu-syntax#plural-format for more
|
|
2174
|
-
* details on how the `plural` statement works.
|
|
2175
|
-
*
|
|
2176
|
-
* @param {String} value
|
|
2177
|
-
* @param {String} matches
|
|
2178
|
-
* @param {String} locale
|
|
2179
|
-
* @param {String} values
|
|
2180
|
-
* @param {Function} format
|
|
2181
|
-
* @return {String}
|
|
2182
|
-
*/
|
|
2311
|
+
if (form.persistData) {
|
|
2312
|
+
return state;
|
|
2313
|
+
}
|
|
2183
2314
|
|
|
2315
|
+
const controls = reducer_objectSpread({}, form.controls);
|
|
2184
2316
|
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2317
|
+
delete controls[name];
|
|
2318
|
+
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
2319
|
+
[formId]: reducer_objectSpread(reducer_objectSpread({}, form), {}, {
|
|
2320
|
+
controls
|
|
2321
|
+
})
|
|
2322
|
+
});
|
|
2323
|
+
},
|
|
2324
|
+
[updateControlValue]: (state, {
|
|
2325
|
+
formId,
|
|
2326
|
+
name,
|
|
2327
|
+
value
|
|
2328
|
+
}) => {
|
|
2329
|
+
return updateFormControl(state, formId, name, {
|
|
2330
|
+
value
|
|
2331
|
+
});
|
|
2332
|
+
},
|
|
2333
|
+
[updateControlTouched]: (state, {
|
|
2334
|
+
formId,
|
|
2335
|
+
name,
|
|
2336
|
+
touched
|
|
2337
|
+
}) => {
|
|
2338
|
+
return updateFormControl(state, formId, name, {
|
|
2339
|
+
touched
|
|
2340
|
+
});
|
|
2341
|
+
},
|
|
2342
|
+
[app_actions_initialize.pending]: () => reducer_initialState
|
|
2343
|
+
}, reducer_initialState));
|
|
2344
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/index.js
|
|
2190
2345
|
|
|
2191
|
-
var _parseCases = parseCases(matches),
|
|
2192
|
-
args = _parseCases.args,
|
|
2193
|
-
cases = _parseCases.cases;
|
|
2194
2346
|
|
|
2195
|
-
var intValue = parseInt(value);
|
|
2196
|
-
args.forEach(function (arg) {
|
|
2197
|
-
if (arg.startsWith('offset:')) {
|
|
2198
|
-
intValue -= parseInt(arg.slice('offset:'.length));
|
|
2199
|
-
}
|
|
2200
|
-
});
|
|
2201
|
-
var keywordPossibilities = [];
|
|
2202
2347
|
|
|
2203
|
-
if ('PluralRules' in Intl) {
|
|
2204
|
-
// Effectively memoize because instantiation of `Int.*` objects is expensive.
|
|
2205
|
-
if (pluralFormatter === undefined || pluralFormatter.resolvedOptions().locale !== locale) {
|
|
2206
|
-
pluralFormatter = new Intl.PluralRules(locale);
|
|
2207
|
-
}
|
|
2208
2348
|
|
|
2209
|
-
var pluralKeyword = pluralFormatter.select(intValue); // Other is always added last with least priority, so we don't want to add it here.
|
|
2210
2349
|
|
|
2211
|
-
if (pluralKeyword !== OTHER$1) {
|
|
2212
|
-
keywordPossibilities.push(pluralKeyword);
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
2350
|
|
|
2216
|
-
|
|
2217
|
-
keywordPossibilities.push(ONE);
|
|
2218
|
-
}
|
|
2351
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
2219
2352
|
|
|
2220
|
-
|
|
2353
|
+
const {
|
|
2354
|
+
createActions: translations_utils_createActions,
|
|
2355
|
+
createReducer: translations_utils_createReducer,
|
|
2356
|
+
selectState: translations_utils_selectState
|
|
2357
|
+
} = createDomain('translations');
|
|
2358
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
2221
2359
|
|
|
2222
|
-
|
|
2223
|
-
|
|
2360
|
+
const [enable, disable] = translations_utils_createActions('translate', {
|
|
2361
|
+
enable: locale => ({
|
|
2362
|
+
locale
|
|
2363
|
+
}),
|
|
2364
|
+
disable: () => ({})
|
|
2365
|
+
});
|
|
2366
|
+
const [enableEvent, disableEvent] = translations_utils_createActions('event', {
|
|
2367
|
+
enable: payloadId => ({
|
|
2368
|
+
payloadId
|
|
2369
|
+
}),
|
|
2370
|
+
disable: payloadId => ({
|
|
2371
|
+
payloadId
|
|
2372
|
+
})
|
|
2373
|
+
});
|
|
2374
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/selectors.js
|
|
2224
2375
|
|
|
2225
|
-
if (keyword in cases) {
|
|
2226
|
-
var _replaceNumberSign = replaceNumberSign(cases[keyword], intValue),
|
|
2227
|
-
caseBody = _replaceNumberSign.caseBody,
|
|
2228
|
-
numberValues = _replaceNumberSign.numberValues;
|
|
2229
2376
|
|
|
2230
|
-
return format(caseBody, icu_message_formatter_es_objectSpread(icu_message_formatter_es_objectSpread({}, values), numberValues));
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
2377
|
|
|
2234
|
-
|
|
2235
|
-
|
|
2378
|
+
const selectors_getState = translations_utils_selectState;
|
|
2379
|
+
const getOriginalPayloadIds = createSelector(selectors_getState, state => state.originalPayloadIds);
|
|
2380
|
+
const getIsPayloadTranslated = createSelector(getOriginalPayloadIds, getPropSelector('payloadId'), (payloadIds, payloadId) => !payloadIds.includes(payloadId));
|
|
2381
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-api-context.js
|
|
2236
2382
|
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2241
|
-
* you may not use this file except in compliance with the License.
|
|
2242
|
-
* You may obtain a copy of the License at
|
|
2243
|
-
*
|
|
2244
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2245
|
-
*
|
|
2246
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2247
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2248
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2249
|
-
* See the License for the specific language governing permissions and
|
|
2250
|
-
* limitations under the License.
|
|
2251
|
-
*/
|
|
2252
|
-
var OTHER = 'other';
|
|
2253
|
-
/**
|
|
2254
|
-
* Handler for `select` statements within ICU message syntax strings. Returns
|
|
2255
|
-
* a formatted string for the branch that closely matches the current value.
|
|
2256
|
-
*
|
|
2257
|
-
* See https://formatjs.io/docs/core-concepts/icu-syntax#select-format for more
|
|
2258
|
-
* details on how the `select` statement works.
|
|
2259
|
-
*
|
|
2260
|
-
* @param {String} value
|
|
2261
|
-
* @param {String} matches
|
|
2262
|
-
* @param {String} locale
|
|
2263
|
-
* @param {String} values
|
|
2264
|
-
* @param {Function} format
|
|
2265
|
-
* @return {String}
|
|
2266
|
-
*/
|
|
2383
|
+
const seamly_api_context_SeamlyApiContext = (0,external_preact_namespaceObject.createContext)(null);
|
|
2384
|
+
const seamly_api_context_SeamlyEventBusContext = (0,external_preact_namespaceObject.createContext)('');
|
|
2385
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-api-hooks.js
|
|
2267
2386
|
|
|
2268
|
-
function selectTypeHandler(value) {
|
|
2269
|
-
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
2270
|
-
var values = arguments.length > 3 ? arguments[3] : undefined;
|
|
2271
|
-
var format = arguments.length > 4 ? arguments[4] : undefined;
|
|
2272
2387
|
|
|
2273
|
-
|
|
2274
|
-
|
|
2388
|
+
const seamly_api_hooks_useSeamlyApiContext = () => useContext(SeamlyApiContext);
|
|
2389
|
+
const seamly_api_hooks_useSeamlyObjectStore = () => {
|
|
2390
|
+
const api = seamly_api_hooks_useSeamlyApiContext();
|
|
2391
|
+
return api.store || {};
|
|
2392
|
+
};
|
|
2393
|
+
const useSeamlyConversationUrl = () => {
|
|
2394
|
+
const {
|
|
2395
|
+
get
|
|
2396
|
+
} = seamly_api_hooks_useSeamlyObjectStore();
|
|
2275
2397
|
|
|
2276
|
-
if (
|
|
2277
|
-
return
|
|
2278
|
-
} else if (OTHER in cases) {
|
|
2279
|
-
return format(cases[OTHER], values);
|
|
2398
|
+
if (get) {
|
|
2399
|
+
return get('conversationUrl');
|
|
2280
2400
|
}
|
|
2281
2401
|
|
|
2282
|
-
return
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2402
|
+
return null;
|
|
2403
|
+
};
|
|
2404
|
+
const seamly_api_hooks_useSeamlyHasConversation = () => {
|
|
2405
|
+
const url = useSeamlyConversationUrl();
|
|
2406
|
+
return !!url;
|
|
2407
|
+
};
|
|
2408
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-dispatch.js
|
|
2285
2409
|
|
|
2286
|
-
|
|
2410
|
+
/* harmony default export */ const use_seamly_dispatch = ((/* unused pure expression or super */ null && (useStoreDispatch)));
|
|
2411
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
|
|
2287
2412
|
|
|
2288
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/hooks.js
|
|
2289
2413
|
|
|
2414
|
+
function createMiddleware() {
|
|
2415
|
+
return ({
|
|
2416
|
+
dispatch
|
|
2417
|
+
}) => next => action => {
|
|
2418
|
+
var _action$config, _action$config$defaul;
|
|
2290
2419
|
|
|
2420
|
+
const result = next(action);
|
|
2291
2421
|
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2422
|
+
switch (action.type) {
|
|
2423
|
+
case String(Actions.initialize):
|
|
2424
|
+
case String(Actions.update):
|
|
2425
|
+
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) {
|
|
2426
|
+
var _action$config2, _action$config2$defau;
|
|
2295
2427
|
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
});
|
|
2300
|
-
|
|
2301
|
-
const translations = useSelector(Selectors.selectTranslations);
|
|
2302
|
-
const locale = useSelector(Selectors.selectLocale);
|
|
2303
|
-
const initialLocale = useSelector(Selectors.selectInitialLocale);
|
|
2304
|
-
const t = useCallback((key, values = {}) => {
|
|
2305
|
-
const translation = translations[key];
|
|
2428
|
+
dispatch({
|
|
2429
|
+
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
2430
|
+
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
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2306
2433
|
|
|
2307
|
-
if (!translation) {
|
|
2308
|
-
return null;
|
|
2309
2434
|
}
|
|
2310
2435
|
|
|
2311
|
-
return
|
|
2312
|
-
}, [translations]);
|
|
2313
|
-
return {
|
|
2314
|
-
t,
|
|
2315
|
-
locale,
|
|
2316
|
-
initialLocale
|
|
2436
|
+
return result;
|
|
2317
2437
|
};
|
|
2318
2438
|
}
|
|
2319
|
-
;// CONCATENATED MODULE: ./src/javascripts/
|
|
2320
|
-
|
|
2439
|
+
;// CONCATENATED MODULE: ./src/javascripts/config.js
|
|
2440
|
+
const CSS_NAME = 'cvco';
|
|
2441
|
+
const apiVersion = '2';
|
|
2442
|
+
const config_userParticipantId = 'seamly-client-participant'; // How long to debounce distinct changes in unread messages for before
|
|
2443
|
+
// broadcasting to the screen reader. This is done to avoid verbosity.
|
|
2321
2444
|
|
|
2322
|
-
|
|
2445
|
+
const unreadScreenReaderWait = 2000;
|
|
2446
|
+
const newMessageScreenReaderWait = 1000;
|
|
2447
|
+
const config_screenReaderDebounceDelaySeconds = 10;
|
|
2448
|
+
const activitySendDelay = 15000;
|
|
2449
|
+
const maxCharacterWarningLimit = 50;
|
|
2450
|
+
const maxCharacterSrDebounceDelay = 300;
|
|
2451
|
+
const config_defaultTransitionTimeMs = 300; // How long to wait before we decide the user isn't typing
|
|
2323
2452
|
|
|
2324
|
-
|
|
2453
|
+
const config_typingTimeout = 2000;
|
|
2454
|
+
const defaultConfig = {
|
|
2455
|
+
namespace: 'default',
|
|
2456
|
+
layoutMode: 'window',
|
|
2457
|
+
// "window", "inline" ("sidebar")
|
|
2458
|
+
messages: {
|
|
2459
|
+
agent: {
|
|
2460
|
+
showAvatar: false,
|
|
2461
|
+
// true, "inline"
|
|
2462
|
+
showName: false
|
|
2463
|
+
},
|
|
2464
|
+
user: {
|
|
2465
|
+
showAvatar: false,
|
|
2466
|
+
// true, "inline"
|
|
2467
|
+
showName: false
|
|
2468
|
+
},
|
|
2469
|
+
timeIndicator: {
|
|
2470
|
+
enabled: false,
|
|
2471
|
+
threshold: 3600000 // Default threshold is an hour in milliseconds
|
|
2325
2472
|
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
};
|
|
2476
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/reducer.js
|
|
2477
|
+
const reducer_excluded = ["messages"];
|
|
2326
2478
|
|
|
2479
|
+
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; }
|
|
2327
2480
|
|
|
2328
|
-
|
|
2329
|
-
translations: {
|
|
2330
|
-
'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
|
|
2331
|
-
'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
|
|
2332
|
-
'errors.configError.title': 'Chat configuration error.',
|
|
2333
|
-
'errors.general.buttonText': 'Restart chat',
|
|
2334
|
-
'errors.general.message': 'Do you want to start a new chat session?',
|
|
2335
|
-
'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
|
|
2336
|
-
'errors.general.title': 'Something went wrong',
|
|
2337
|
-
'errors.seamlyOffline.message': 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
|
|
2338
|
-
'errors.seamlyOffline.srText': 'The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.',
|
|
2339
|
-
'errors.seamlyOffline.title': 'Connection issues',
|
|
2340
|
-
'errors.seamlyUnavailable.buttonText': 'Try again',
|
|
2341
|
-
'errors.seamlyUnavailable.message': 'The server could not be reached. Try again in a little while.',
|
|
2342
|
-
'errors.seamlyUnavailable.srText': 'The chat server could not be reached. Try again in a little while.',
|
|
2343
|
-
'errors.seamlyUnavailable.title': 'Server unavailable'
|
|
2344
|
-
},
|
|
2345
|
-
isLoading: false,
|
|
2346
|
-
initialLocale: undefined
|
|
2347
|
-
};
|
|
2348
|
-
/* harmony default export */ const i18n_reducer = (i18n_utils_createReducer({
|
|
2349
|
-
[setInitialLocale]: (state, {
|
|
2350
|
-
locale
|
|
2351
|
-
}) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
2352
|
-
initialLocale: locale
|
|
2353
|
-
}),
|
|
2354
|
-
[setLocale.pending]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
2355
|
-
isLoading: true
|
|
2356
|
-
}),
|
|
2357
|
-
[setLocale.fulfilled]: (state, {
|
|
2358
|
-
payload: translations,
|
|
2359
|
-
meta: {
|
|
2360
|
-
arg: locale
|
|
2361
|
-
}
|
|
2362
|
-
}) => {
|
|
2363
|
-
if (!translations) {
|
|
2364
|
-
return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
2365
|
-
isLoading: false
|
|
2366
|
-
});
|
|
2367
|
-
}
|
|
2481
|
+
function reducer_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
2368
2482
|
|
|
2369
|
-
|
|
2370
|
-
isLoading: false,
|
|
2371
|
-
locale,
|
|
2372
|
-
translations: Object.keys(translations).sort().reduce((accum, key) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, accum), {}, {
|
|
2373
|
-
[key]: translations[key]
|
|
2374
|
-
}), {})
|
|
2375
|
-
});
|
|
2376
|
-
},
|
|
2377
|
-
[setLocale.rejected]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
2378
|
-
isLoading: false
|
|
2379
|
-
})
|
|
2380
|
-
}, defaultState));
|
|
2381
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/index.js
|
|
2483
|
+
function config_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2382
2484
|
|
|
2485
|
+
function config_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { config_reducer_ownKeys(Object(source), true).forEach(function (key) { config_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { config_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2383
2486
|
|
|
2487
|
+
function config_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2384
2488
|
|
|
2385
2489
|
|
|
2386
2490
|
|
|
2387
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
|
|
2388
2491
|
|
|
2389
|
-
const {
|
|
2390
|
-
createAction: app_utils_createAction,
|
|
2391
|
-
createThunk: app_utils_createThunk,
|
|
2392
|
-
createReducer: app_utils_createReducer,
|
|
2393
|
-
selectState: app_utils_selectState
|
|
2394
|
-
} = createDomain('app');
|
|
2395
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
|
|
2396
2492
|
|
|
2397
2493
|
|
|
2398
|
-
const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
|
|
2399
2494
|
|
|
2400
|
-
|
|
2495
|
+
const config_reducer_initialState = config_reducer_objectSpread(config_reducer_objectSpread({}, defaultConfig), {}, {
|
|
2496
|
+
hideOnNoUserResponse: false,
|
|
2497
|
+
showDisclaimer: false,
|
|
2498
|
+
showFaq: false,
|
|
2499
|
+
customComponents: {},
|
|
2500
|
+
defaults: {},
|
|
2501
|
+
preChatEvents: []
|
|
2502
|
+
});
|
|
2401
2503
|
|
|
2504
|
+
const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback'];
|
|
2402
2505
|
|
|
2403
|
-
const {
|
|
2404
|
-
createAction: visibility_utils_createAction,
|
|
2405
|
-
createActions: utils_createActions,
|
|
2406
|
-
createThunk: visibility_utils_createThunk,
|
|
2407
|
-
createReducer: visibility_utils_createReducer,
|
|
2408
|
-
selectState: visibility_utils_selectState
|
|
2409
|
-
} = createDomain('visibility');
|
|
2410
|
-
const calculateVisibility = ({
|
|
2411
|
-
hasResponded,
|
|
2412
|
-
previousVisibility,
|
|
2413
|
-
requestedVisibility,
|
|
2506
|
+
const updateState = (state, {
|
|
2414
2507
|
config
|
|
2415
2508
|
}) => {
|
|
2416
|
-
const
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
const {
|
|
2422
|
-
visible: defaultVisibility
|
|
2423
|
-
} = defaults || {}; // Requesting open should override the responded check.
|
|
2424
|
-
|
|
2425
|
-
if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== constants_visibilityStates.open) {
|
|
2426
|
-
return hasResponded ? requestedVisibility || previousVisibility || constants_visibilityStates.open : constants_visibilityStates.hidden;
|
|
2427
|
-
}
|
|
2509
|
+
const _pick = pick(config, configKeys),
|
|
2510
|
+
{
|
|
2511
|
+
messages
|
|
2512
|
+
} = _pick,
|
|
2513
|
+
partialConfig = reducer_objectWithoutProperties(_pick, reducer_excluded);
|
|
2428
2514
|
|
|
2429
|
-
|
|
2430
|
-
return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
|
|
2431
|
-
};
|
|
2432
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/selectors.js
|
|
2515
|
+
let newState = state;
|
|
2433
2516
|
|
|
2517
|
+
if (Object.keys(partialConfig).length > 0) {
|
|
2518
|
+
newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), partialConfig);
|
|
2519
|
+
}
|
|
2434
2520
|
|
|
2435
|
-
|
|
2521
|
+
if (messages) {
|
|
2522
|
+
newState = config_reducer_objectSpread(config_reducer_objectSpread({}, newState), {}, {
|
|
2523
|
+
messages: config_reducer_objectSpread(config_reducer_objectSpread({}, newState.messages), messages)
|
|
2524
|
+
});
|
|
2525
|
+
}
|
|
2436
2526
|
|
|
2437
|
-
|
|
2438
|
-
|
|
2527
|
+
return newState;
|
|
2528
|
+
};
|
|
2439
2529
|
|
|
2440
|
-
|
|
2530
|
+
/* harmony default export */ const config_reducer = (utils_createReducer({
|
|
2531
|
+
[initialize]: (state, action) => {
|
|
2532
|
+
return updateState(state, action);
|
|
2533
|
+
},
|
|
2534
|
+
[update]: (state, action) => {
|
|
2535
|
+
return updateState(state, action);
|
|
2536
|
+
},
|
|
2537
|
+
[app_actions_initialize.pending]: () => config_reducer_initialState,
|
|
2538
|
+
[setPreChatEvents]: (state, {
|
|
2539
|
+
events
|
|
2540
|
+
}) => {
|
|
2541
|
+
return config_reducer_objectSpread(config_reducer_objectSpread({}, state), {}, {
|
|
2542
|
+
preChatEvents: events
|
|
2543
|
+
});
|
|
2544
|
+
}
|
|
2545
|
+
}, config_reducer_initialState));
|
|
2546
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/config/index.js
|
|
2441
2547
|
|
|
2442
|
-
function seamly_state_hooks_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2443
2548
|
|
|
2444
2549
|
|
|
2445
2550
|
|
|
2446
2551
|
|
|
2447
2552
|
|
|
2448
|
-
|
|
2449
|
-
const seamly_state_hooks_useSeamlyStateContext = () => useSelector(seamly_state_hooks_selectState);
|
|
2450
|
-
const selectEvents = createSelector(seamly_state_hooks_selectState, selectConfig, ({
|
|
2451
|
-
events
|
|
2452
|
-
}, config) => {
|
|
2453
|
-
var _config$messages;
|
|
2553
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
|
|
2454
2554
|
|
|
2555
|
+
const useSeamlyAppContainerClassNames = () => {
|
|
2556
|
+
return useConfig().appContainerClassNames;
|
|
2557
|
+
};
|
|
2558
|
+
const useSeamlyMessageContainerClassNames = event => {
|
|
2455
2559
|
const {
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2560
|
+
fromClient
|
|
2561
|
+
} = event.payload;
|
|
2562
|
+
const classNames = ['message'];
|
|
2459
2563
|
|
|
2460
|
-
if (
|
|
2461
|
-
|
|
2564
|
+
if (event.type === 'info') {
|
|
2565
|
+
classNames.push('message--source-info');
|
|
2566
|
+
} else if (!fromClient) {
|
|
2567
|
+
classNames.push('message--source-agent');
|
|
2568
|
+
} else {
|
|
2569
|
+
classNames.push('message--source-user');
|
|
2462
2570
|
}
|
|
2463
2571
|
|
|
2464
|
-
|
|
2465
|
-
let previousEvent = null;
|
|
2466
|
-
events.forEach((event, idx) => {
|
|
2467
|
-
// always add timeIndicator to first message
|
|
2468
|
-
if (idx === 0) {
|
|
2469
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2470
|
-
timeIndicator: event.payload.occurredAt
|
|
2471
|
-
})); // else check if diff is greater than threshold
|
|
2472
|
-
} else {
|
|
2473
|
-
const timeIndicator = previousEvent && microsecondsToMilliseconds(event.payload.occurredAt - previousEvent.payload.occurredAt) >= threshold ? event.payload.occurredAt : undefined;
|
|
2474
|
-
mappedEvents.push(seamly_state_hooks_objectSpread(seamly_state_hooks_objectSpread({}, event), {}, {
|
|
2475
|
-
timeIndicator
|
|
2476
|
-
}));
|
|
2477
|
-
}
|
|
2478
|
-
|
|
2479
|
-
previousEvent = event;
|
|
2480
|
-
});
|
|
2481
|
-
return mappedEvents;
|
|
2482
|
-
});
|
|
2483
|
-
const seamly_state_hooks_useEvents = () => useSelector(selectEvents, []);
|
|
2484
|
-
const useSeamlyIsLoading = () => seamly_state_hooks_useSeamlyStateContext().isLoading;
|
|
2485
|
-
const useSeamlyHeaderData = () => seamly_state_hooks_useSeamlyStateContext().headerTitles;
|
|
2486
|
-
const seamly_state_hooks_useSeamlyUnreadCount = () => seamly_state_hooks_useSeamlyStateContext().unreadEvents;
|
|
2487
|
-
const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateContext().skiplinkTargetId;
|
|
2488
|
-
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
2489
|
-
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
2490
|
-
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
2491
|
-
var _filteredEvents;
|
|
2492
|
-
|
|
2493
|
-
const filteredEvents = events.filter(event => event.type === 'message');
|
|
2494
|
-
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
2495
|
-
});
|
|
2496
|
-
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
2497
|
-
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
2498
|
-
const useSeamlyCurrentAgent = () => {
|
|
2499
|
-
const {
|
|
2500
|
-
participants,
|
|
2501
|
-
currentAgent
|
|
2502
|
-
} = seamly_state_hooks_useSeamlyStateContext().participantInfo;
|
|
2503
|
-
return currentAgent ? participants[currentAgent] : null;
|
|
2504
|
-
};
|
|
2505
|
-
const useSeamlyServiceData = key => seamly_state_hooks_useSeamlyStateContext().serviceData[key];
|
|
2506
|
-
const useEntryTextLimit = () => {
|
|
2507
|
-
const {
|
|
2508
|
-
entryMeta: {
|
|
2509
|
-
options: {
|
|
2510
|
-
text
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
} = seamly_state_hooks_useSeamlyStateContext();
|
|
2514
|
-
const {
|
|
2515
|
-
limit
|
|
2516
|
-
} = text || {};
|
|
2517
|
-
return {
|
|
2518
|
-
hasLimit: limit != null,
|
|
2519
|
-
limit: limit != null ? limit : null
|
|
2520
|
-
};
|
|
2521
|
-
};
|
|
2522
|
-
const useSeamlyLayoutMode = () => {
|
|
2523
|
-
const {
|
|
2524
|
-
layoutMode
|
|
2525
|
-
} = useConfig();
|
|
2526
|
-
return {
|
|
2527
|
-
isInline: layoutMode === 'inline',
|
|
2528
|
-
isModal: layoutMode === 'modal',
|
|
2529
|
-
isWindow: layoutMode === 'window',
|
|
2530
|
-
isResolving: !layoutMode
|
|
2531
|
-
};
|
|
2572
|
+
return classNames;
|
|
2532
2573
|
};
|
|
2533
|
-
;// CONCATENATED MODULE: ./
|
|
2534
|
-
function
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
function
|
|
2539
|
-
|
|
2574
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
2575
|
+
function _arrayWithHoles(arr) {
|
|
2576
|
+
if (Array.isArray(arr)) return arr;
|
|
2577
|
+
}
|
|
2578
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
2579
|
+
function _iterableToArrayLimit(arr, i) {
|
|
2580
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
2540
2581
|
|
|
2582
|
+
if (_i == null) return;
|
|
2583
|
+
var _arr = [];
|
|
2584
|
+
var _n = true;
|
|
2585
|
+
var _d = false;
|
|
2541
2586
|
|
|
2587
|
+
var _s, _e;
|
|
2542
2588
|
|
|
2589
|
+
try {
|
|
2590
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
2591
|
+
_arr.push(_s.value);
|
|
2543
2592
|
|
|
2593
|
+
if (i && _arr.length === i) break;
|
|
2594
|
+
}
|
|
2595
|
+
} catch (err) {
|
|
2596
|
+
_d = true;
|
|
2597
|
+
_e = err;
|
|
2598
|
+
} finally {
|
|
2599
|
+
try {
|
|
2600
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
2601
|
+
} finally {
|
|
2602
|
+
if (_d) throw _e;
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2544
2605
|
|
|
2606
|
+
return _arr;
|
|
2607
|
+
}
|
|
2608
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
2609
|
+
function _arrayLikeToArray(arr, len) {
|
|
2610
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2545
2611
|
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
}));
|
|
2549
|
-
const validVisibilityStates = [constants_visibilityStates.open, constants_visibilityStates.minimized, constants_visibilityStates.hidden];
|
|
2550
|
-
const setVisibility = visibility_utils_createThunk('set', (requestedVisibility, {
|
|
2551
|
-
getState,
|
|
2552
|
-
extra: {
|
|
2553
|
-
api,
|
|
2554
|
-
eventBus
|
|
2612
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
2613
|
+
arr2[i] = arr[i];
|
|
2555
2614
|
}
|
|
2556
|
-
}) => {
|
|
2557
|
-
const state = getState();
|
|
2558
|
-
const previousVisibility = selectVisibility(state);
|
|
2559
|
-
const hasResponded = selectUserHasResponded(state);
|
|
2560
|
-
const hasConversation = api.hasConversation();
|
|
2561
|
-
const config = selectConfig(state);
|
|
2562
|
-
const {
|
|
2563
|
-
visibilityCallback = calculateVisibility,
|
|
2564
|
-
layoutMode
|
|
2565
|
-
} = config;
|
|
2566
|
-
const {
|
|
2567
|
-
unreadEvents: unreadMessageCount
|
|
2568
|
-
} = seamly_state_hooks_selectState(state);
|
|
2569
|
-
const calculatedVisibility = visibilityCallback({
|
|
2570
|
-
hasConversation,
|
|
2571
|
-
hasResponded,
|
|
2572
|
-
previousVisibility,
|
|
2573
|
-
requestedVisibility,
|
|
2574
|
-
config
|
|
2575
|
-
});
|
|
2576
2615
|
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
}
|
|
2616
|
+
return arr2;
|
|
2617
|
+
}
|
|
2618
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
2581
2619
|
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2620
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
2621
|
+
if (!o) return;
|
|
2622
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
2623
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2624
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2625
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
2626
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
2627
|
+
}
|
|
2628
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
2629
|
+
function _nonIterableRest() {
|
|
2630
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2631
|
+
}
|
|
2632
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
2585
2633
|
|
|
2586
2634
|
|
|
2587
|
-
api.store.set(StoreKey, actions_objectSpread(actions_objectSpread({}, api.store.get(StoreKey) || {}), {}, {
|
|
2588
|
-
[layoutMode]: requestedVisibility
|
|
2589
|
-
}));
|
|
2590
2635
|
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2636
|
+
|
|
2637
|
+
function _slicedToArray(arr, i) {
|
|
2638
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
2639
|
+
}
|
|
2640
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
2641
|
+
function _classCallCheck(instance, Constructor) {
|
|
2642
|
+
if (!(instance instanceof Constructor)) {
|
|
2643
|
+
throw new TypeError("Cannot call a class as a function");
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
2647
|
+
function _defineProperties(target, props) {
|
|
2648
|
+
for (var i = 0; i < props.length; i++) {
|
|
2649
|
+
var descriptor = props[i];
|
|
2650
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
2651
|
+
descriptor.configurable = true;
|
|
2652
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2653
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2598
2654
|
}
|
|
2655
|
+
}
|
|
2599
2656
|
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2657
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
2658
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
2659
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
2660
|
+
return Constructor;
|
|
2661
|
+
}
|
|
2662
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
2663
|
+
function defineProperty_defineProperty(obj, key, value) {
|
|
2664
|
+
if (key in obj) {
|
|
2665
|
+
Object.defineProperty(obj, key, {
|
|
2666
|
+
value: value,
|
|
2667
|
+
enumerable: true,
|
|
2668
|
+
configurable: true,
|
|
2669
|
+
writable: true
|
|
2670
|
+
});
|
|
2671
|
+
} else {
|
|
2672
|
+
obj[key] = value;
|
|
2607
2673
|
}
|
|
2608
|
-
}) => {
|
|
2609
|
-
var _api$store$get;
|
|
2610
2674
|
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2675
|
+
return obj;
|
|
2676
|
+
}
|
|
2677
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/array-utils/array-utils.es.js
|
|
2678
|
+
/*
|
|
2679
|
+
* Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
2680
|
+
*
|
|
2681
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2682
|
+
* you may not use this file except in compliance with the License.
|
|
2683
|
+
* You may obtain a copy of the License at
|
|
2684
|
+
*
|
|
2685
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2686
|
+
*
|
|
2687
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2688
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2689
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2690
|
+
* See the License for the specific language governing permissions and
|
|
2691
|
+
* limitations under the License.
|
|
2692
|
+
*/
|
|
2616
2693
|
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2694
|
+
/**
|
|
2695
|
+
* Flattens an array of arrays of infinite depth into a single-dimension array.
|
|
2696
|
+
*
|
|
2697
|
+
* > This is now natively in JavaScript as the `flat` method on an Array
|
|
2698
|
+
* > 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).
|
|
2699
|
+
* > If you can't use `flat`, then this method will do the job 🙂
|
|
2700
|
+
*
|
|
2701
|
+
* @param {Array} array
|
|
2702
|
+
* @return {Array} Flattened array.
|
|
2703
|
+
*/
|
|
2704
|
+
function flatten(array) {
|
|
2705
|
+
return array.reduce(function (accumulator, value) {
|
|
2706
|
+
return accumulator.concat(Array.isArray(value) ? flatten(value) : value);
|
|
2707
|
+
}, []);
|
|
2708
|
+
}
|
|
2709
|
+
/**
|
|
2710
|
+
* Creates an array of numbers from the starting value (inclusive) to the end
|
|
2711
|
+
* (exclusive), with an optional step (the gap between values).
|
|
2712
|
+
*
|
|
2713
|
+
* @param {Number} start
|
|
2714
|
+
* The value to start at, the first item in the returned array.
|
|
2715
|
+
* @param {Number} end
|
|
2716
|
+
* The value to end with, the last item in the returned array.
|
|
2717
|
+
* @param {Number} [step=1]
|
|
2718
|
+
* The increment/gap between values, defaults to 1.
|
|
2719
|
+
* @return {Array} An array encompassing the given range.
|
|
2720
|
+
*/
|
|
2620
2721
|
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2722
|
+
function range(start, end) {
|
|
2723
|
+
var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
2724
|
+
return Array.apply(0, Array(Math.ceil((end - start) / step))).map(function (empty, index) {
|
|
2725
|
+
return index * step + start;
|
|
2726
|
+
});
|
|
2727
|
+
}
|
|
2624
2728
|
/**
|
|
2625
|
-
*
|
|
2626
|
-
*
|
|
2627
|
-
*
|
|
2729
|
+
* Remove and return the first item from `array` that matches the predicate
|
|
2730
|
+
* function.
|
|
2731
|
+
*
|
|
2732
|
+
* @param {Array} array
|
|
2733
|
+
* @param {Function} predicate
|
|
2734
|
+
* Invoked with the array item.
|
|
2735
|
+
* @return {Object} The matching item, or `null` if no match was found.
|
|
2628
2736
|
*/
|
|
2629
|
-
class SeamlyUnavailableError extends Error {
|
|
2630
|
-
constructor(params) {
|
|
2631
|
-
super(params);
|
|
2632
2737
|
|
|
2633
|
-
|
|
2634
|
-
|
|
2738
|
+
function remove(array, predicate) {
|
|
2739
|
+
return array.find(function (item, index) {
|
|
2740
|
+
if (predicate(item)) {
|
|
2741
|
+
array.splice(index, 1);
|
|
2742
|
+
return item;
|
|
2635
2743
|
}
|
|
2636
|
-
|
|
2637
|
-
this.name = 'SeamlyUnavailableError';
|
|
2638
|
-
this.langKey = 'errors.seamlyUnavailable';
|
|
2639
|
-
}
|
|
2640
|
-
|
|
2744
|
+
});
|
|
2641
2745
|
}
|
|
2642
|
-
;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-base-error.js
|
|
2643
|
-
class SeamlyBaseError extends Error {
|
|
2644
|
-
constructor(originalError, ...params) {
|
|
2645
|
-
super(...params);
|
|
2646
2746
|
|
|
2647
|
-
|
|
2648
|
-
|
|
2747
|
+
//# sourceMappingURL=array-utils.es.js.map
|
|
2748
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/function-utils/function-utils.es.js
|
|
2749
|
+
/**
|
|
2750
|
+
* A higher-order function to apply [memoization](https://en.wikipedia.org/wiki/Memoization).
|
|
2751
|
+
*
|
|
2752
|
+
* If memoizing a recursive function, then memoize and define the function at
|
|
2753
|
+
* the same time so you can make a call to the memoized function, eg:
|
|
2754
|
+
*
|
|
2755
|
+
* ```javascript
|
|
2756
|
+
* const myFunction = memoize(() => myFunction());
|
|
2757
|
+
* ```
|
|
2758
|
+
*
|
|
2759
|
+
* @param {Function} func
|
|
2760
|
+
* @return {Function}
|
|
2761
|
+
*/
|
|
2762
|
+
function memoize(func) {
|
|
2763
|
+
var cache = {};
|
|
2764
|
+
return function () {
|
|
2765
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2766
|
+
args[_key] = arguments[_key];
|
|
2649
2767
|
}
|
|
2650
2768
|
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
constructor(originalError, ...params) {
|
|
2659
|
-
super(originalError, ...params);
|
|
2660
|
-
this.name = 'SeamlySessionExpiredError';
|
|
2661
|
-
this.action = 'reset';
|
|
2662
|
-
}
|
|
2769
|
+
var key = args.length ? args.map(function (arg) {
|
|
2770
|
+
return arg === null ? 'null' : arg === undefined ? 'undefined' : typeof arg === 'function' ? arg.toString() : arg instanceof Date ? arg.toISOString() : JSON.stringify(arg);
|
|
2771
|
+
}).join('|') : '_(no-args)_';
|
|
2772
|
+
|
|
2773
|
+
if (Object.prototype.hasOwnProperty.call(cache, key)) {
|
|
2774
|
+
return cache[key];
|
|
2775
|
+
}
|
|
2663
2776
|
|
|
2777
|
+
var result = func.apply(void 0, args);
|
|
2778
|
+
cache[key] = result;
|
|
2779
|
+
return result;
|
|
2780
|
+
};
|
|
2664
2781
|
}
|
|
2665
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
|
|
2666
2782
|
|
|
2783
|
+
//# sourceMappingURL=function-utils.es.js.map
|
|
2784
|
+
;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/lib/icu-message-formatter.es.js
|
|
2667
2785
|
|
|
2668
2786
|
|
|
2669
2787
|
|
|
2670
2788
|
|
|
2671
2789
|
|
|
2672
2790
|
|
|
2673
|
-
const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
|
|
2674
|
-
hasResponded
|
|
2675
|
-
}));
|
|
2676
|
-
const app_actions_initialize = app_utils_createThunk('initialize', async (config, {
|
|
2677
|
-
dispatch,
|
|
2678
|
-
extra: {
|
|
2679
|
-
api
|
|
2680
|
-
}
|
|
2681
|
-
}) => {
|
|
2682
|
-
var _config$context;
|
|
2683
2791
|
|
|
2684
|
-
|
|
2685
|
-
|
|
2792
|
+
/*
|
|
2793
|
+
* Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
2794
|
+
*
|
|
2795
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2796
|
+
* you may not use this file except in compliance with the License.
|
|
2797
|
+
* You may obtain a copy of the License at
|
|
2798
|
+
*
|
|
2799
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2800
|
+
*
|
|
2801
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2802
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2803
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2804
|
+
* See the License for the specific language governing permissions and
|
|
2805
|
+
* limitations under the License.
|
|
2806
|
+
*/
|
|
2686
2807
|
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2808
|
+
/**
|
|
2809
|
+
* Most branch-based type handlers are based around "cases".
|
|
2810
|
+
* For example, `select` and `plural` compare compare a value
|
|
2811
|
+
* to "case keys" to choose a subtranslation.
|
|
2812
|
+
*
|
|
2813
|
+
* This util splits "matches" portions provided to the aforementioned
|
|
2814
|
+
* handlers into case strings, and extracts any prepended arguments
|
|
2815
|
+
* (for example, `plural` supports an `offset:n` argument used for
|
|
2816
|
+
* populating the magic `#` variable).
|
|
2817
|
+
*
|
|
2818
|
+
* @param {String} string
|
|
2819
|
+
* @return {Object} The `cases` key points to a map of all cases.
|
|
2820
|
+
* The `arguments` key points to a list of prepended arguments.
|
|
2821
|
+
*/
|
|
2822
|
+
function parseCases(string) {
|
|
2823
|
+
var isWhitespace = function isWhitespace(ch) {
|
|
2824
|
+
return /\s/.test(ch);
|
|
2825
|
+
};
|
|
2701
2826
|
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2827
|
+
var args = [];
|
|
2828
|
+
var cases = {};
|
|
2829
|
+
var currTermStart = 0;
|
|
2830
|
+
var latestTerm = null;
|
|
2831
|
+
var inTerm = false;
|
|
2832
|
+
var i = 0;
|
|
2705
2833
|
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
|
|
2834
|
+
while (i < string.length) {
|
|
2835
|
+
// Term ended
|
|
2836
|
+
if (inTerm && (isWhitespace(string[i]) || string[i] === '{')) {
|
|
2837
|
+
inTerm = false;
|
|
2838
|
+
latestTerm = string.slice(currTermStart, i); // We want to process the opening char again so the case will be properly registered.
|
|
2712
2839
|
|
|
2713
|
-
if ('
|
|
2714
|
-
|
|
2840
|
+
if (string[i] === '{') {
|
|
2841
|
+
i--;
|
|
2715
2842
|
}
|
|
2716
|
-
}
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
throw new SeamlyUnavailableError();
|
|
2723
|
-
} finally {
|
|
2724
|
-
await dispatch(setLocale(locale));
|
|
2725
|
-
dispatch(actions_initialize());
|
|
2726
|
-
}
|
|
2727
|
-
});
|
|
2728
|
-
const actions_reset = app_utils_createAction('reset', () => {});
|
|
2729
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
function hooks_useUserHasResponded() {
|
|
2733
|
-
return useSelector(Selectors.selectUserHasResponded);
|
|
2734
|
-
}
|
|
2735
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/reducer.js
|
|
2736
|
-
function app_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2737
|
-
|
|
2738
|
-
function app_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { app_reducer_ownKeys(Object(source), true).forEach(function (key) { app_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { app_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2739
|
-
|
|
2740
|
-
function app_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2843
|
+
} // New term
|
|
2844
|
+
else if (!inTerm && !isWhitespace(string[i])) {
|
|
2845
|
+
var caseBody = string[i] === '{'; // If there's a previous term, we can either handle a whole
|
|
2846
|
+
// case, or add that as an argument.
|
|
2741
2847
|
|
|
2848
|
+
if (latestTerm && caseBody) {
|
|
2849
|
+
var branchEndIndex = findClosingBracket(string, i);
|
|
2742
2850
|
|
|
2851
|
+
if (branchEndIndex === -1) {
|
|
2852
|
+
throw new Error("Unbalanced curly braces in string: \"".concat(string, "\""));
|
|
2853
|
+
}
|
|
2743
2854
|
|
|
2744
|
-
|
|
2745
|
-
userHasResponded: false
|
|
2746
|
-
};
|
|
2747
|
-
/* harmony default export */ const app_reducer = (app_utils_createReducer({
|
|
2748
|
-
[setHasResponded]: (state, {
|
|
2749
|
-
hasResponded
|
|
2750
|
-
}) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
|
|
2751
|
-
userHasResponded: hasResponded
|
|
2752
|
-
})
|
|
2753
|
-
}, reducer_initialState));
|
|
2754
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
|
|
2855
|
+
cases[latestTerm] = string.slice(i + 1, branchEndIndex); // Don't include the braces
|
|
2755
2856
|
|
|
2857
|
+
i = branchEndIndex; // Will be moved up where needed at end of loop.
|
|
2756
2858
|
|
|
2859
|
+
latestTerm = null;
|
|
2860
|
+
} else {
|
|
2861
|
+
if (latestTerm) {
|
|
2862
|
+
args.push(latestTerm);
|
|
2863
|
+
latestTerm = null;
|
|
2864
|
+
}
|
|
2757
2865
|
|
|
2866
|
+
inTerm = true;
|
|
2867
|
+
currTermStart = i;
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2758
2870
|
|
|
2871
|
+
i++;
|
|
2872
|
+
}
|
|
2759
2873
|
|
|
2760
|
-
|
|
2761
|
-
|
|
2874
|
+
if (inTerm) {
|
|
2875
|
+
latestTerm = string.slice(currTermStart);
|
|
2876
|
+
}
|
|
2762
2877
|
|
|
2763
|
-
|
|
2878
|
+
if (latestTerm) {
|
|
2879
|
+
args.push(latestTerm);
|
|
2880
|
+
}
|
|
2764
2881
|
|
|
2765
|
-
|
|
2882
|
+
return {
|
|
2883
|
+
args: args,
|
|
2884
|
+
cases: cases
|
|
2885
|
+
};
|
|
2886
|
+
}
|
|
2887
|
+
/**
|
|
2888
|
+
* Finds the index of the matching closing curly bracket, including through
|
|
2889
|
+
* strings that could have nested brackets.
|
|
2890
|
+
*
|
|
2891
|
+
* @param {String} string
|
|
2892
|
+
* @param {Number} fromIndex
|
|
2893
|
+
* @return {Number} The index of the matching closing bracket, or -1 if no
|
|
2894
|
+
* closing bracket could be found.
|
|
2895
|
+
*/
|
|
2766
2896
|
|
|
2767
|
-
|
|
2897
|
+
function findClosingBracket(string, fromIndex) {
|
|
2898
|
+
var depth = 0;
|
|
2768
2899
|
|
|
2900
|
+
for (var i = fromIndex + 1; i < string.length; i++) {
|
|
2901
|
+
var char = string.charAt(i);
|
|
2769
2902
|
|
|
2903
|
+
if (char === '}') {
|
|
2904
|
+
if (depth === 0) {
|
|
2905
|
+
return i;
|
|
2906
|
+
}
|
|
2770
2907
|
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
isLoading: false,
|
|
2776
|
-
idleDetachCountdown: {
|
|
2777
|
-
hasCountdown: false,
|
|
2778
|
-
isActive: false
|
|
2779
|
-
},
|
|
2780
|
-
resumeConversationPrompt: false,
|
|
2781
|
-
serviceInfo: {
|
|
2782
|
-
activeServiceSessionId: ''
|
|
2783
|
-
},
|
|
2784
|
-
participantInfo: {
|
|
2785
|
-
participants: {},
|
|
2786
|
-
currentAgent: ''
|
|
2787
|
-
},
|
|
2788
|
-
headerTitles: {
|
|
2789
|
-
title: null,
|
|
2790
|
-
subTitle: ''
|
|
2791
|
-
},
|
|
2792
|
-
historyLoaded: false,
|
|
2793
|
-
skiplinkTargetId: id_randomId(),
|
|
2794
|
-
optionsButtonId: id_randomId(),
|
|
2795
|
-
cobrowsingContainerId: id_randomId(),
|
|
2796
|
-
headerCollapseButtonId: id_randomId(),
|
|
2797
|
-
serviceData: {},
|
|
2798
|
-
options: {
|
|
2799
|
-
features: {},
|
|
2800
|
-
panelActive: false,
|
|
2801
|
-
optionActive: '',
|
|
2802
|
-
userSelectedOptions: {}
|
|
2803
|
-
},
|
|
2804
|
-
showFileUpload: false,
|
|
2805
|
-
currentUploads: [],
|
|
2806
|
-
entryMeta: {
|
|
2807
|
-
default: entryTypes.text,
|
|
2808
|
-
active: entryTypes.text,
|
|
2809
|
-
userSelected: null,
|
|
2810
|
-
blockAutoEntrySwitch: false,
|
|
2811
|
-
options: {},
|
|
2812
|
-
optionsOverride: {}
|
|
2813
|
-
},
|
|
2814
|
-
seamlyContainerElement: null
|
|
2815
|
-
};
|
|
2816
|
-
function stateReducer(state = state_reducer_initialState, action) {
|
|
2817
|
-
if (action.type === String(actions_reset)) {
|
|
2818
|
-
const {
|
|
2819
|
-
visible
|
|
2820
|
-
} = state;
|
|
2821
|
-
return state_reducer_objectSpread(state_reducer_objectSpread({}, state_reducer_initialState), {}, {
|
|
2822
|
-
visible
|
|
2823
|
-
});
|
|
2908
|
+
depth--;
|
|
2909
|
+
} else if (char === '{') {
|
|
2910
|
+
depth++;
|
|
2911
|
+
}
|
|
2824
2912
|
}
|
|
2825
2913
|
|
|
2826
|
-
return
|
|
2914
|
+
return -1;
|
|
2827
2915
|
}
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
if (validations && !Array.isArray(validations)) {
|
|
2838
|
-
// eslint-disable-next-line no-param-reassign
|
|
2839
|
-
validations = [validations];
|
|
2840
|
-
}
|
|
2916
|
+
/**
|
|
2917
|
+
* Split a `{key, type, format}` block into those 3 parts, taking into account
|
|
2918
|
+
* nested message syntax that can exist in the `format` part.
|
|
2919
|
+
*
|
|
2920
|
+
* @param {String} block
|
|
2921
|
+
* @return {Array}
|
|
2922
|
+
* An array with `key`, `type`, and `format` items in that order, if present
|
|
2923
|
+
* in the formatted argument block.
|
|
2924
|
+
*/
|
|
2841
2925
|
|
|
2842
|
-
|
|
2843
|
-
|
|
2926
|
+
function splitFormattedArgument(block) {
|
|
2927
|
+
return split(block.slice(1, -1), ',', 3);
|
|
2928
|
+
}
|
|
2929
|
+
/**
|
|
2930
|
+
* Like `String.prototype.split()` but where the limit parameter causes the
|
|
2931
|
+
* remainder of the string to be grouped together in a final entry.
|
|
2932
|
+
*
|
|
2933
|
+
* @private
|
|
2934
|
+
* @param {String} string
|
|
2935
|
+
* @param {String} separator
|
|
2936
|
+
* @param {Number} limit
|
|
2937
|
+
* @param {Array} [accumulator=[]]
|
|
2938
|
+
* @return {Array}
|
|
2939
|
+
*/
|
|
2844
2940
|
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
break;
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2941
|
+
function split(string, separator, limit) {
|
|
2942
|
+
var accumulator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
2850
2943
|
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
}
|
|
2854
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/actions.js
|
|
2944
|
+
if (!string) {
|
|
2945
|
+
return accumulator;
|
|
2946
|
+
}
|
|
2855
2947
|
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
persistData
|
|
2860
|
-
}),
|
|
2861
|
-
deregister: formId => ({
|
|
2862
|
-
formId
|
|
2863
|
-
})
|
|
2864
|
-
});
|
|
2865
|
-
const [registerControl, deregisterControl, updateControlValue, updateControlTouched] = forms_utils_createActions('control', {
|
|
2866
|
-
register: (formId, name) => ({
|
|
2867
|
-
formId,
|
|
2868
|
-
name
|
|
2869
|
-
}),
|
|
2870
|
-
deregister: (formId, name) => ({
|
|
2871
|
-
formId,
|
|
2872
|
-
name
|
|
2873
|
-
}),
|
|
2874
|
-
updateValue: (formId, name, value) => ({
|
|
2875
|
-
formId,
|
|
2876
|
-
name,
|
|
2877
|
-
value
|
|
2878
|
-
}),
|
|
2879
|
-
updateTouched: (formId, name, touched) => ({
|
|
2880
|
-
formId,
|
|
2881
|
-
name,
|
|
2882
|
-
touched
|
|
2883
|
-
})
|
|
2884
|
-
});
|
|
2885
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/redux/utils.js
|
|
2886
|
-
const arrayContentEquals = (a, b) => {
|
|
2887
|
-
if (a === b) {
|
|
2888
|
-
return true;
|
|
2948
|
+
if (limit === 1) {
|
|
2949
|
+
accumulator.push(string);
|
|
2950
|
+
return accumulator;
|
|
2889
2951
|
}
|
|
2890
2952
|
|
|
2891
|
-
|
|
2892
|
-
|
|
2953
|
+
var indexOfDelimiter = string.indexOf(separator);
|
|
2954
|
+
|
|
2955
|
+
if (indexOfDelimiter === -1) {
|
|
2956
|
+
accumulator.push(string);
|
|
2957
|
+
return accumulator;
|
|
2893
2958
|
}
|
|
2894
2959
|
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2960
|
+
var head = string.substring(0, indexOfDelimiter).trim();
|
|
2961
|
+
var tail = string.substring(indexOfDelimiter + separator.length + 1).trim();
|
|
2962
|
+
accumulator.push(head);
|
|
2963
|
+
return split(tail, separator, limit - 1, accumulator);
|
|
2964
|
+
}
|
|
2899
2965
|
|
|
2966
|
+
/**
|
|
2967
|
+
* The main class for formatting messages.
|
|
2968
|
+
*
|
|
2969
|
+
* @author Emanuel Rabina
|
|
2970
|
+
*/
|
|
2900
2971
|
|
|
2972
|
+
var MessageFormatter = /*#__PURE__*/function () {
|
|
2973
|
+
/**
|
|
2974
|
+
* Creates a new formatter that can work using any of the custom type handlers
|
|
2975
|
+
* you register.
|
|
2976
|
+
*
|
|
2977
|
+
* @param {String} locale
|
|
2978
|
+
* @param {Object} [typeHandlers={}]
|
|
2979
|
+
* Optional object where the keys are the names of the types to register,
|
|
2980
|
+
* their values being the functions that will return a nicely formatted
|
|
2981
|
+
* string for the data and locale they are given.
|
|
2982
|
+
*/
|
|
2983
|
+
function MessageFormatter(locale) {
|
|
2984
|
+
var _this = this;
|
|
2901
2985
|
|
|
2902
|
-
|
|
2903
|
-
const selectors_getFormById = createSelector(getState, getPropSelector('formId'), (forms, formId) => forms[formId]);
|
|
2904
|
-
const getFormControlsByFormId = createSelector(selectors_getFormById, form => (form === null || form === void 0 ? void 0 : form.controls) || {});
|
|
2905
|
-
const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId, controls => {
|
|
2906
|
-
const valuesObj = {};
|
|
2907
|
-
Object.entries(controls).forEach(([key, {
|
|
2908
|
-
value
|
|
2909
|
-
}]) => {
|
|
2910
|
-
valuesObj[key] = value;
|
|
2911
|
-
});
|
|
2912
|
-
return valuesObj;
|
|
2913
|
-
});
|
|
2914
|
-
const selectors_getControlValueByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) => {
|
|
2915
|
-
var _controls$name;
|
|
2986
|
+
var typeHandlers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2916
2987
|
|
|
2917
|
-
|
|
2918
|
-
});
|
|
2919
|
-
const selectors_getControlTouchedByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) => {
|
|
2920
|
-
var _controls$name2;
|
|
2988
|
+
_classCallCheck(this, MessageFormatter);
|
|
2921
2989
|
|
|
2922
|
-
|
|
2923
|
-
}
|
|
2924
|
-
|
|
2990
|
+
defineProperty_defineProperty(this, "format", memoize(function (message) {
|
|
2991
|
+
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2992
|
+
return flatten(_this.process(message, values)).join('');
|
|
2993
|
+
}));
|
|
2925
2994
|
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2995
|
+
this.locale = locale;
|
|
2996
|
+
this.typeHandlers = typeHandlers;
|
|
2997
|
+
}
|
|
2998
|
+
/**
|
|
2999
|
+
* Formats an ICU message syntax string using `values` for placeholder data
|
|
3000
|
+
* and any currently-registered type handlers.
|
|
3001
|
+
*
|
|
3002
|
+
* @param {String} message
|
|
3003
|
+
* @param {Object} [values={}]
|
|
3004
|
+
* @return {String}
|
|
3005
|
+
*/
|
|
2933
3006
|
|
|
2934
3007
|
|
|
3008
|
+
_createClass(MessageFormatter, [{
|
|
3009
|
+
key: "process",
|
|
3010
|
+
value:
|
|
3011
|
+
/**
|
|
3012
|
+
* Process an ICU message syntax string using `values` for placeholder data
|
|
3013
|
+
* and any currently-registered type handlers. The result of this method is
|
|
3014
|
+
* an array of the component parts after they have been processed in turn by
|
|
3015
|
+
* their own type handlers. This raw output is useful for other renderers,
|
|
3016
|
+
* eg: React where components can be used instead of being forced to return
|
|
3017
|
+
* raw strings.
|
|
3018
|
+
*
|
|
3019
|
+
* This method is used by {@link MessageFormatter#format} where it acts as a
|
|
3020
|
+
* string renderer.
|
|
3021
|
+
*
|
|
3022
|
+
* @param {String} message
|
|
3023
|
+
* @param {Object} [values={}]
|
|
3024
|
+
* @return {Array}
|
|
3025
|
+
*/
|
|
3026
|
+
function process(message) {
|
|
3027
|
+
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2935
3028
|
|
|
3029
|
+
if (!message) {
|
|
3030
|
+
return [];
|
|
3031
|
+
}
|
|
2936
3032
|
|
|
3033
|
+
var blockStartIndex = message.indexOf('{');
|
|
2937
3034
|
|
|
3035
|
+
if (blockStartIndex !== -1) {
|
|
3036
|
+
var blockEndIndex = findClosingBracket(message, blockStartIndex);
|
|
2938
3037
|
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
}
|
|
2942
|
-
function hooks_useForm() {
|
|
2943
|
-
const {
|
|
2944
|
-
handleSubmit
|
|
2945
|
-
} = hooks_useFormContext();
|
|
2946
|
-
return {
|
|
2947
|
-
handleSubmit
|
|
2948
|
-
};
|
|
2949
|
-
}
|
|
2950
|
-
function hooks_useValidations(values, validationSchema) {
|
|
2951
|
-
const errors = useMemo(() => validate(values, validationSchema), [values, validationSchema]);
|
|
2952
|
-
return {
|
|
2953
|
-
isValid: Object.keys(errors).length === 0,
|
|
2954
|
-
errors
|
|
2955
|
-
};
|
|
2956
|
-
}
|
|
2957
|
-
function hooks_useFormControl(name) {
|
|
2958
|
-
const dispatch = useStoreDispatch();
|
|
2959
|
-
const {
|
|
2960
|
-
formId,
|
|
2961
|
-
updateControlValue,
|
|
2962
|
-
updateControlTouched,
|
|
2963
|
-
errors
|
|
2964
|
-
} = hooks_useFormContext();
|
|
2965
|
-
const form = useSelectorWithProps(getFormById, {
|
|
2966
|
-
formId
|
|
2967
|
-
}, [formId]);
|
|
2968
|
-
const isRegistered = !!form;
|
|
2969
|
-
const isRegisteredRef = useRef();
|
|
2970
|
-
isRegisteredRef.current = isRegistered;
|
|
2971
|
-
const value = useSelectorWithProps(getControlValueByName, {
|
|
2972
|
-
formId,
|
|
2973
|
-
name
|
|
2974
|
-
}, [formId, name]);
|
|
2975
|
-
const touched = useSelectorWithProps(getControlTouchedByName, {
|
|
2976
|
-
formId,
|
|
2977
|
-
name
|
|
2978
|
-
}, [formId, name]);
|
|
2979
|
-
const error = errors === null || errors === void 0 ? void 0 : errors[name];
|
|
2980
|
-
const isValid = !error;
|
|
2981
|
-
useEffect(() => {
|
|
2982
|
-
// Make sure the form is registered
|
|
2983
|
-
// Since child useEffect runs before FormProvider useEffect
|
|
2984
|
-
if (isRegisteredRef.current) {
|
|
2985
|
-
dispatch(Actions.registerControl(formId, name));
|
|
2986
|
-
}
|
|
2987
|
-
}, [isRegistered, formId, name, dispatch]);
|
|
2988
|
-
useLayoutEffect(() => {
|
|
2989
|
-
return () => {
|
|
2990
|
-
dispatch(Actions.deregisterControl(formId, name));
|
|
2991
|
-
};
|
|
2992
|
-
}, [isRegistered, formId, name, dispatch]); // preact uses onInput instead of onChange
|
|
3038
|
+
if (blockEndIndex !== -1) {
|
|
3039
|
+
var block = message.substring(blockStartIndex, blockEndIndex + 1);
|
|
2993
3040
|
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
touched
|
|
3008
|
-
}), [isValid, error, touched]);
|
|
3009
|
-
return [field, meta];
|
|
3010
|
-
}
|
|
3011
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/provider.js
|
|
3012
|
-
const provider_excluded = (/* unused pure expression or super */ null && (["children", "formId", "persistData", "onSubmit", "validationSchema"]));
|
|
3041
|
+
if (block) {
|
|
3042
|
+
var result = [];
|
|
3043
|
+
var head = message.substring(0, blockStartIndex);
|
|
3044
|
+
|
|
3045
|
+
if (head) {
|
|
3046
|
+
result.push(head);
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
var _splitFormattedArgume = splitFormattedArgument(block),
|
|
3050
|
+
_splitFormattedArgume2 = _slicedToArray(_splitFormattedArgume, 3),
|
|
3051
|
+
key = _splitFormattedArgume2[0],
|
|
3052
|
+
type = _splitFormattedArgume2[1],
|
|
3053
|
+
format = _splitFormattedArgume2[2];
|
|
3013
3054
|
|
|
3014
|
-
|
|
3055
|
+
var body = values[key];
|
|
3015
3056
|
|
|
3016
|
-
|
|
3057
|
+
if (body === null || body === undefined) {
|
|
3058
|
+
body = '';
|
|
3059
|
+
}
|
|
3017
3060
|
|
|
3018
|
-
|
|
3061
|
+
var typeHandler = type && this.typeHandlers[type];
|
|
3062
|
+
result.push(typeHandler ? typeHandler(body, format, this.locale, values, this.process.bind(this)) : body);
|
|
3063
|
+
var tail = message.substring(blockEndIndex + 1);
|
|
3019
3064
|
|
|
3020
|
-
|
|
3065
|
+
if (tail) {
|
|
3066
|
+
result.push(this.process(tail, values));
|
|
3067
|
+
}
|
|
3021
3068
|
|
|
3022
|
-
|
|
3069
|
+
return result;
|
|
3070
|
+
}
|
|
3071
|
+
} else {
|
|
3072
|
+
throw new Error("Unbalanced curly braces in string: \"".concat(message, "\""));
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3023
3075
|
|
|
3076
|
+
return [message];
|
|
3077
|
+
}
|
|
3078
|
+
}]);
|
|
3024
3079
|
|
|
3080
|
+
return MessageFormatter;
|
|
3081
|
+
}();
|
|
3025
3082
|
|
|
3083
|
+
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; }
|
|
3026
3084
|
|
|
3085
|
+
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; }
|
|
3086
|
+
var pluralFormatter;
|
|
3087
|
+
var keyCounter = 0; // All the special keywords that can be used in `plural` blocks for the various branches
|
|
3027
3088
|
|
|
3089
|
+
var ONE = 'one';
|
|
3090
|
+
var OTHER$1 = 'other';
|
|
3091
|
+
/**
|
|
3092
|
+
* @private
|
|
3093
|
+
* @param {String} caseBody
|
|
3094
|
+
* @param {Number} value
|
|
3095
|
+
* @return {Object} {caseBody: string, numberValues: object}
|
|
3096
|
+
*/
|
|
3028
3097
|
|
|
3098
|
+
function replaceNumberSign(caseBody, value) {
|
|
3099
|
+
var i = 0;
|
|
3100
|
+
var output = '';
|
|
3101
|
+
var numBraces = 0;
|
|
3102
|
+
var numberValues = {};
|
|
3029
3103
|
|
|
3104
|
+
while (i < caseBody.length) {
|
|
3105
|
+
if (caseBody[i] === '#' && !numBraces) {
|
|
3106
|
+
var keyParam = "__hashToken".concat(keyCounter++);
|
|
3107
|
+
output += "{".concat(keyParam, ", number}");
|
|
3108
|
+
numberValues[keyParam] = value;
|
|
3109
|
+
} else {
|
|
3110
|
+
output += caseBody[i];
|
|
3111
|
+
}
|
|
3030
3112
|
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
onSubmit,
|
|
3037
|
-
validationSchema
|
|
3038
|
-
} = _ref,
|
|
3039
|
-
props = provider_objectWithoutProperties(_ref, provider_excluded);
|
|
3113
|
+
if (caseBody[i] === '{') {
|
|
3114
|
+
numBraces++;
|
|
3115
|
+
} else if (caseBody[i] === '}') {
|
|
3116
|
+
numBraces--;
|
|
3117
|
+
}
|
|
3040
3118
|
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
formId
|
|
3044
|
-
}, [formId]);
|
|
3045
|
-
const [isSubmitted, setIsSubmitted] = useState(false);
|
|
3046
|
-
const [externalErrors, setExternalErrors] = useState({});
|
|
3047
|
-
const {
|
|
3048
|
-
isValid: validationIsValid,
|
|
3049
|
-
errors: validationErrors
|
|
3050
|
-
} = useValidations(values, validationSchema);
|
|
3051
|
-
const errors = useMemo(() => provider_objectSpread(provider_objectSpread({}, validationErrors), externalErrors), [validationErrors, externalErrors]); // register
|
|
3119
|
+
i++;
|
|
3120
|
+
}
|
|
3052
3121
|
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
}
|
|
3122
|
+
return {
|
|
3123
|
+
caseBody: output,
|
|
3124
|
+
numberValues: numberValues
|
|
3125
|
+
};
|
|
3126
|
+
}
|
|
3127
|
+
/**
|
|
3128
|
+
* Handler for `plural` statements within ICU message syntax strings. Returns
|
|
3129
|
+
* a formatted string for the branch that closely matches the current value.
|
|
3130
|
+
*
|
|
3131
|
+
* See https://formatjs.io/docs/core-concepts/icu-syntax#plural-format for more
|
|
3132
|
+
* details on how the `plural` statement works.
|
|
3133
|
+
*
|
|
3134
|
+
* @param {String} value
|
|
3135
|
+
* @param {String} matches
|
|
3136
|
+
* @param {String} locale
|
|
3137
|
+
* @param {String} values
|
|
3138
|
+
* @param {Function} format
|
|
3139
|
+
* @return {String}
|
|
3140
|
+
*/
|
|
3057
3141
|
|
|
3058
|
-
useEffect(() => {
|
|
3059
|
-
return () => {
|
|
3060
|
-
// deregister form from redux store
|
|
3061
|
-
dispatch(Actions.deregisterForm(formId));
|
|
3062
|
-
};
|
|
3063
|
-
}, [formId, persistData, dispatch]);
|
|
3064
|
-
const updateControlValue = useCallback((name, value) => {
|
|
3065
|
-
dispatch(Actions.updateControlValue(formId, name, value));
|
|
3066
|
-
}, [formId, dispatch]);
|
|
3067
|
-
const updateControlTouched = useCallback((name, touched) => {
|
|
3068
|
-
dispatch(Actions.updateControlTouched(formId, name, touched));
|
|
3069
|
-
}, [dispatch, formId]); // Function to manually set an error
|
|
3070
3142
|
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
});
|
|
3077
|
-
}, [setExternalErrors]);
|
|
3078
|
-
const handleSubmit = useCallback(e => {
|
|
3079
|
-
e.preventDefault();
|
|
3080
|
-
setIsSubmitted(true);
|
|
3143
|
+
function pluralTypeHandler(value) {
|
|
3144
|
+
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
3145
|
+
var locale = arguments.length > 2 ? arguments[2] : undefined;
|
|
3146
|
+
var values = arguments.length > 3 ? arguments[3] : undefined;
|
|
3147
|
+
var format = arguments.length > 4 ? arguments[4] : undefined;
|
|
3081
3148
|
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3149
|
+
var _parseCases = parseCases(matches),
|
|
3150
|
+
args = _parseCases.args,
|
|
3151
|
+
cases = _parseCases.cases;
|
|
3152
|
+
|
|
3153
|
+
var intValue = parseInt(value);
|
|
3154
|
+
args.forEach(function (arg) {
|
|
3155
|
+
if (arg.startsWith('offset:')) {
|
|
3156
|
+
intValue -= parseInt(arg.slice('offset:'.length));
|
|
3087
3157
|
}
|
|
3088
|
-
}
|
|
3089
|
-
|
|
3090
|
-
formId,
|
|
3091
|
-
values,
|
|
3092
|
-
errors,
|
|
3093
|
-
isValid: Object.keys(errors).length === 0,
|
|
3094
|
-
isSubmitted,
|
|
3095
|
-
handleSubmit,
|
|
3096
|
-
validationSchema,
|
|
3097
|
-
updateControlValue,
|
|
3098
|
-
updateControlTouched
|
|
3099
|
-
}), [formId, values, errors, isSubmitted, handleSubmit, validationSchema, updateControlValue, updateControlTouched]);
|
|
3158
|
+
});
|
|
3159
|
+
var keywordPossibilities = [];
|
|
3100
3160
|
|
|
3101
|
-
if (
|
|
3102
|
-
|
|
3103
|
-
|
|
3161
|
+
if ('PluralRules' in Intl) {
|
|
3162
|
+
// Effectively memoize because instantiation of `Int.*` objects is expensive.
|
|
3163
|
+
if (pluralFormatter === undefined || pluralFormatter.resolvedOptions().locale !== locale) {
|
|
3164
|
+
pluralFormatter = new Intl.PluralRules(locale);
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
var pluralKeyword = pluralFormatter.select(intValue); // Other is always added last with least priority, so we don't want to add it here.
|
|
3168
|
+
|
|
3169
|
+
if (pluralKeyword !== OTHER$1) {
|
|
3170
|
+
keywordPossibilities.push(pluralKeyword);
|
|
3171
|
+
}
|
|
3104
3172
|
}
|
|
3105
3173
|
|
|
3106
|
-
if (
|
|
3107
|
-
|
|
3108
|
-
return null;
|
|
3174
|
+
if (intValue === 1) {
|
|
3175
|
+
keywordPossibilities.push(ONE);
|
|
3109
3176
|
}
|
|
3110
3177
|
|
|
3111
|
-
|
|
3112
|
-
value: contextValue,
|
|
3113
|
-
children: children
|
|
3114
|
-
}));
|
|
3115
|
-
}
|
|
3116
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/reducer.js
|
|
3117
|
-
function forms_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3178
|
+
keywordPossibilities.push("=".concat(intValue), OTHER$1);
|
|
3118
3179
|
|
|
3119
|
-
|
|
3180
|
+
for (var i = 0; i < keywordPossibilities.length; i++) {
|
|
3181
|
+
var keyword = keywordPossibilities[i];
|
|
3120
3182
|
|
|
3121
|
-
|
|
3183
|
+
if (keyword in cases) {
|
|
3184
|
+
var _replaceNumberSign = replaceNumberSign(cases[keyword], intValue),
|
|
3185
|
+
caseBody = _replaceNumberSign.caseBody,
|
|
3186
|
+
numberValues = _replaceNumberSign.numberValues;
|
|
3122
3187
|
|
|
3188
|
+
return format(caseBody, icu_message_formatter_es_objectSpread(icu_message_formatter_es_objectSpread({}, values), numberValues));
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3123
3191
|
|
|
3192
|
+
return value;
|
|
3193
|
+
}
|
|
3124
3194
|
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3195
|
+
/*
|
|
3196
|
+
* Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/)
|
|
3197
|
+
*
|
|
3198
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3199
|
+
* you may not use this file except in compliance with the License.
|
|
3200
|
+
* You may obtain a copy of the License at
|
|
3201
|
+
*
|
|
3202
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3203
|
+
*
|
|
3204
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3205
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3206
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3207
|
+
* See the License for the specific language governing permissions and
|
|
3208
|
+
* limitations under the License.
|
|
3209
|
+
*/
|
|
3210
|
+
var OTHER = 'other';
|
|
3211
|
+
/**
|
|
3212
|
+
* Handler for `select` statements within ICU message syntax strings. Returns
|
|
3213
|
+
* a formatted string for the branch that closely matches the current value.
|
|
3214
|
+
*
|
|
3215
|
+
* See https://formatjs.io/docs/core-concepts/icu-syntax#select-format for more
|
|
3216
|
+
* details on how the `select` statement works.
|
|
3217
|
+
*
|
|
3218
|
+
* @param {String} value
|
|
3219
|
+
* @param {String} matches
|
|
3220
|
+
* @param {String} locale
|
|
3221
|
+
* @param {String} values
|
|
3222
|
+
* @param {Function} format
|
|
3223
|
+
* @return {String}
|
|
3224
|
+
*/
|
|
3133
3225
|
|
|
3134
|
-
function
|
|
3135
|
-
var
|
|
3226
|
+
function selectTypeHandler(value) {
|
|
3227
|
+
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
3228
|
+
var values = arguments.length > 3 ? arguments[3] : undefined;
|
|
3229
|
+
var format = arguments.length > 4 ? arguments[4] : undefined;
|
|
3136
3230
|
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
[formId]: forms_reducer_objectSpread(forms_reducer_objectSpread({}, state[formId]), {}, {
|
|
3140
|
-
controls: forms_reducer_objectSpread(forms_reducer_objectSpread({}, state[formId].controls), {}, {
|
|
3141
|
-
[name]: forms_reducer_objectSpread(forms_reducer_objectSpread({}, currentControlState), controlState)
|
|
3142
|
-
})
|
|
3143
|
-
})
|
|
3144
|
-
});
|
|
3145
|
-
}
|
|
3231
|
+
var _parseCases = parseCases(matches),
|
|
3232
|
+
cases = _parseCases.cases;
|
|
3146
3233
|
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
}) => {
|
|
3153
|
-
const formState = persistData ? state[formId] ?? forms_reducer_objectSpread(forms_reducer_objectSpread({}, initialFormState), {}, {
|
|
3154
|
-
persistData
|
|
3155
|
-
}) : forms_reducer_objectSpread(forms_reducer_objectSpread({}, initialFormState), {}, {
|
|
3156
|
-
persistData
|
|
3157
|
-
});
|
|
3158
|
-
return forms_reducer_objectSpread(forms_reducer_objectSpread({}, state), {}, {
|
|
3159
|
-
[formId]: formState
|
|
3160
|
-
});
|
|
3161
|
-
},
|
|
3162
|
-
[deregisterForm]: (state, {
|
|
3163
|
-
formId
|
|
3164
|
-
}) => {
|
|
3165
|
-
var _newState$formId;
|
|
3234
|
+
if (value in cases) {
|
|
3235
|
+
return format(cases[value], values);
|
|
3236
|
+
} else if (OTHER in cases) {
|
|
3237
|
+
return format(cases[OTHER], values);
|
|
3238
|
+
}
|
|
3166
3239
|
|
|
3167
|
-
|
|
3240
|
+
return value;
|
|
3241
|
+
}
|
|
3168
3242
|
|
|
3169
|
-
if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
|
|
3170
|
-
delete newState[formId];
|
|
3171
|
-
}
|
|
3172
3243
|
|
|
3173
|
-
|
|
3174
|
-
},
|
|
3175
|
-
// Form control handlers
|
|
3176
|
-
[registerControl]: (state, {
|
|
3177
|
-
name,
|
|
3178
|
-
formId
|
|
3179
|
-
}) => {
|
|
3180
|
-
return updateFormControl(state, formId, name);
|
|
3181
|
-
},
|
|
3182
|
-
[deregisterControl]: (state, {
|
|
3183
|
-
formId,
|
|
3184
|
-
name
|
|
3185
|
-
}) => {
|
|
3186
|
-
const form = state[formId];
|
|
3244
|
+
//# sourceMappingURL=icu-message-formatter.es.js.map
|
|
3187
3245
|
|
|
3188
|
-
|
|
3189
|
-
return state;
|
|
3190
|
-
}
|
|
3246
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/hooks.js
|
|
3191
3247
|
|
|
3192
|
-
if (form.persistData) {
|
|
3193
|
-
return state;
|
|
3194
|
-
}
|
|
3195
3248
|
|
|
3196
|
-
const controls = forms_reducer_objectSpread({}, form.controls);
|
|
3197
3249
|
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
});
|
|
3213
|
-
},
|
|
3214
|
-
[updateControlTouched]: (state, {
|
|
3215
|
-
formId,
|
|
3216
|
-
name,
|
|
3217
|
-
touched
|
|
3218
|
-
}) => {
|
|
3219
|
-
return updateFormControl(state, formId, name, {
|
|
3220
|
-
touched
|
|
3221
|
-
});
|
|
3222
|
-
}
|
|
3223
|
-
}, forms_reducer_initialState));
|
|
3224
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/index.js
|
|
3250
|
+
// The passed in locale (en-GB) is only used to call Intl.PluralRules.select() in
|
|
3251
|
+
// pluralTypeHandler. Since we only use exact plural matches (=0, =1 etc) we can
|
|
3252
|
+
// safely use en-GB all the time.
|
|
3253
|
+
|
|
3254
|
+
const formatter = new MessageFormatter('en-GB', {
|
|
3255
|
+
plural: pluralTypeHandler,
|
|
3256
|
+
select: selectTypeHandler
|
|
3257
|
+
});
|
|
3258
|
+
function hooks_useI18n() {
|
|
3259
|
+
const translations = useSelector(Selectors.selectTranslations);
|
|
3260
|
+
const locale = useSelector(Selectors.selectLocale);
|
|
3261
|
+
const initialLocale = useSelector(Selectors.selectInitialLocale);
|
|
3262
|
+
const t = useCallback((key, values = {}) => {
|
|
3263
|
+
const translation = translations[key];
|
|
3225
3264
|
|
|
3265
|
+
if (!translation) {
|
|
3266
|
+
console.warn(`Translation key: ${key} is missing in locale: ${locale}`);
|
|
3267
|
+
return null;
|
|
3268
|
+
}
|
|
3226
3269
|
|
|
3270
|
+
return formatter.format(translation, values);
|
|
3271
|
+
}, [translations, locale]);
|
|
3272
|
+
return {
|
|
3273
|
+
t,
|
|
3274
|
+
locale,
|
|
3275
|
+
initialLocale
|
|
3276
|
+
};
|
|
3277
|
+
}
|
|
3278
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/reducer.js
|
|
3279
|
+
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; }
|
|
3227
3280
|
|
|
3281
|
+
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; }
|
|
3228
3282
|
|
|
3283
|
+
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; }
|
|
3229
3284
|
|
|
3230
3285
|
|
|
3231
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
3232
3286
|
|
|
3233
|
-
const {
|
|
3234
|
-
createActions: translations_utils_createActions,
|
|
3235
|
-
createReducer: translations_utils_createReducer,
|
|
3236
|
-
selectState: translations_utils_selectState
|
|
3237
|
-
} = createDomain('translations');
|
|
3238
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
3239
3287
|
|
|
3240
|
-
const
|
|
3241
|
-
|
|
3288
|
+
const defaultState = {
|
|
3289
|
+
translations: {
|
|
3290
|
+
'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
|
|
3291
|
+
'errors.configError.srText': 'A chat configuration error occurred. Our apologies, please retry at a later time.',
|
|
3292
|
+
'errors.configError.title': 'Chat configuration error.',
|
|
3293
|
+
'errors.general.buttonText': 'Restart chat',
|
|
3294
|
+
'errors.general.message': 'Do you want to start a new chat session?',
|
|
3295
|
+
'errors.general.srText': 'Something went wrong with the chat session. You can restart the chat.',
|
|
3296
|
+
'errors.general.title': 'Something went wrong',
|
|
3297
|
+
'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.',
|
|
3298
|
+
'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.',
|
|
3299
|
+
'errors.seamlyOffline.title': 'Connection issues',
|
|
3300
|
+
'errors.seamlyUnavailable.buttonText': 'Try again',
|
|
3301
|
+
'errors.seamlyUnavailable.message': 'The server could not be reached. Try again in a little while.',
|
|
3302
|
+
'errors.seamlyUnavailable.srText': 'The chat server could not be reached. Try again in a little while.',
|
|
3303
|
+
'errors.seamlyUnavailable.title': 'Server unavailable'
|
|
3304
|
+
},
|
|
3305
|
+
isLoading: false,
|
|
3306
|
+
initialLocale: undefined
|
|
3307
|
+
};
|
|
3308
|
+
/* harmony default export */ const i18n_reducer = (i18n_utils_createReducer({
|
|
3309
|
+
[setInitialLocale]: (state, {
|
|
3242
3310
|
locale
|
|
3311
|
+
}) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3312
|
+
initialLocale: locale
|
|
3243
3313
|
}),
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
const [enableEvent, disableEvent] = translations_utils_createActions('event', {
|
|
3247
|
-
enable: payloadId => ({
|
|
3248
|
-
payloadId
|
|
3314
|
+
[setLocale.pending]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3315
|
+
isLoading: true
|
|
3249
3316
|
}),
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-api-context.js
|
|
3317
|
+
[setLocale.fulfilled]: (state, {
|
|
3318
|
+
payload: translations,
|
|
3319
|
+
meta: {
|
|
3320
|
+
arg: locale
|
|
3321
|
+
}
|
|
3322
|
+
}) => {
|
|
3323
|
+
if (!translations) {
|
|
3324
|
+
return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3325
|
+
isLoading: false
|
|
3326
|
+
});
|
|
3327
|
+
}
|
|
3262
3328
|
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3329
|
+
return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3330
|
+
isLoading: false,
|
|
3331
|
+
locale,
|
|
3332
|
+
translations: Object.keys(translations).sort().reduce((accum, key) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, accum), {}, {
|
|
3333
|
+
[key]: translations[key]
|
|
3334
|
+
}), {})
|
|
3335
|
+
});
|
|
3336
|
+
},
|
|
3337
|
+
[setLocale.rejected]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
|
|
3338
|
+
isLoading: false
|
|
3339
|
+
}),
|
|
3340
|
+
[app_actions_initialize.pending]: () => defaultState
|
|
3341
|
+
}, defaultState));
|
|
3342
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/index.js
|
|
3266
3343
|
|
|
3267
3344
|
|
|
3268
|
-
const seamly_api_hooks_useSeamlyApiContext = () => useContext(SeamlyApiContext);
|
|
3269
|
-
const seamly_api_hooks_useSeamlyObjectStore = () => {
|
|
3270
|
-
const api = seamly_api_hooks_useSeamlyApiContext();
|
|
3271
|
-
return api.store || {};
|
|
3272
|
-
};
|
|
3273
|
-
const useSeamlyConversationUrl = () => {
|
|
3274
|
-
const {
|
|
3275
|
-
get
|
|
3276
|
-
} = seamly_api_hooks_useSeamlyObjectStore();
|
|
3277
3345
|
|
|
3278
|
-
if (get) {
|
|
3279
|
-
return get('conversationUrl');
|
|
3280
|
-
}
|
|
3281
3346
|
|
|
3282
|
-
return null;
|
|
3283
|
-
};
|
|
3284
|
-
const seamly_api_hooks_useSeamlyHasConversation = () => {
|
|
3285
|
-
const url = useSeamlyConversationUrl();
|
|
3286
|
-
return !!url;
|
|
3287
|
-
};
|
|
3288
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-dispatch.js
|
|
3289
3347
|
|
|
3290
|
-
/* harmony default export */ const use_seamly_dispatch = ((/* unused pure expression or super */ null && (useStoreDispatch)));
|
|
3291
3348
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/focus-helper-hooks.js
|
|
3292
3349
|
|
|
3293
3350
|
|
|
@@ -3339,39 +3396,6 @@ const useFocusIfSeamlyContainedFocus = () => {
|
|
|
3339
3396
|
runIfElementContainsOrHasFocus(containerElementRef.current, focusFn);
|
|
3340
3397
|
}, []);
|
|
3341
3398
|
};
|
|
3342
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
const useSeamlyAppContainerClassNames = () => {
|
|
3347
|
-
return useConfig().appContainerClassNames;
|
|
3348
|
-
};
|
|
3349
|
-
const useSeamlyMessageContainerClassNames = event => {
|
|
3350
|
-
const {
|
|
3351
|
-
fromClient
|
|
3352
|
-
} = event.payload;
|
|
3353
|
-
const classNames = ['message'];
|
|
3354
|
-
|
|
3355
|
-
if (event.type === 'info') {
|
|
3356
|
-
classNames.push('message--source-info');
|
|
3357
|
-
} else if (!fromClient) {
|
|
3358
|
-
classNames.push('message--source-agent');
|
|
3359
|
-
} else {
|
|
3360
|
-
classNames.push('message--source-user');
|
|
3361
|
-
}
|
|
3362
|
-
|
|
3363
|
-
return classNames;
|
|
3364
|
-
};
|
|
3365
|
-
const useCobrowsingContainer = () => {
|
|
3366
|
-
const {
|
|
3367
|
-
cobrowsingContainerId: id
|
|
3368
|
-
} = useSeamlyStateContext();
|
|
3369
|
-
const focusContainer = useElementFocusingById(id);
|
|
3370
|
-
return {
|
|
3371
|
-
id,
|
|
3372
|
-
focusContainer
|
|
3373
|
-
};
|
|
3374
|
-
};
|
|
3375
3399
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-option-hooks.js
|
|
3376
3400
|
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; }
|
|
3377
3401
|
|
|
@@ -3602,19 +3626,6 @@ const utility_hooks_useStableCallback = callback => {
|
|
|
3602
3626
|
return isFunction ? (...args) => callbackRef.current(...args) : undefined;
|
|
3603
3627
|
}, [isFunction]);
|
|
3604
3628
|
};
|
|
3605
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/utils.js
|
|
3606
|
-
|
|
3607
|
-
const {
|
|
3608
|
-
createAction: interrupt_utils_createAction,
|
|
3609
|
-
createReducer: interrupt_utils_createReducer,
|
|
3610
|
-
selectState: interrupt_utils_selectState
|
|
3611
|
-
} = createDomain('interrupt');
|
|
3612
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/actions.js
|
|
3613
|
-
|
|
3614
|
-
const set = interrupt_utils_createAction('set', error => ({
|
|
3615
|
-
error
|
|
3616
|
-
}));
|
|
3617
|
-
const clear = interrupt_utils_createAction('clear');
|
|
3618
3629
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.js
|
|
3619
3630
|
|
|
3620
3631
|
|
|
@@ -3763,7 +3774,7 @@ const handleError = (state, {
|
|
|
3763
3774
|
[set]: handleError,
|
|
3764
3775
|
[app_actions_initialize.rejected]: handleError,
|
|
3765
3776
|
[clear]: () => interrupt_reducer_initialState,
|
|
3766
|
-
[
|
|
3777
|
+
[app_actions_initialize.pending]: () => interrupt_reducer_initialState
|
|
3767
3778
|
}, interrupt_reducer_initialState));
|
|
3768
3779
|
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
|
|
3769
3780
|
|
|
@@ -3772,8 +3783,13 @@ const handleError = (state, {
|
|
|
3772
3783
|
|
|
3773
3784
|
|
|
3774
3785
|
|
|
3775
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/
|
|
3786
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
|
|
3787
|
+
|
|
3776
3788
|
|
|
3789
|
+
function hooks_useUserHasResponded() {
|
|
3790
|
+
return useSelector(Selectors.selectUserHasResponded);
|
|
3791
|
+
}
|
|
3792
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/hooks.js
|
|
3777
3793
|
|
|
3778
3794
|
|
|
3779
3795
|
|
|
@@ -3783,14 +3799,13 @@ const hooks_useVisibility = () => {
|
|
|
3783
3799
|
const dispatch = useStoreDispatch();
|
|
3784
3800
|
const visible = useSelector(Selectors.selectVisibility);
|
|
3785
3801
|
const isVisible = visible ? visible !== visibilityStates.hidden : false;
|
|
3786
|
-
const
|
|
3787
|
-
|
|
3788
|
-
} = useConfig();
|
|
3789
|
-
const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
|
|
3802
|
+
const isOpen = visible === visibilityStates.open;
|
|
3803
|
+
const isMinimized = visible === visibilityStates.minimized;
|
|
3790
3804
|
const setVisibility = useCallback(visibility => dispatch(Actions.setVisibility(visibility)), [dispatch]);
|
|
3791
3805
|
return {
|
|
3792
3806
|
isVisible,
|
|
3793
3807
|
isOpen,
|
|
3808
|
+
isMinimized,
|
|
3794
3809
|
visible,
|
|
3795
3810
|
setVisibility
|
|
3796
3811
|
};
|
|
@@ -3848,12 +3863,10 @@ function use_seamly_commands_defineProperty(obj, key, value) { if (key in obj) {
|
|
|
3848
3863
|
|
|
3849
3864
|
|
|
3850
3865
|
|
|
3866
|
+
|
|
3851
3867
|
const {
|
|
3852
3868
|
ADD_EVENT: use_seamly_commands_ADD_EVENT,
|
|
3853
|
-
|
|
3854
|
-
SET_HEADER_SUB_TITLE: use_seamly_commands_SET_HEADER_SUB_TITLE,
|
|
3855
|
-
SET_INITIAL_STATE: use_seamly_commands_SET_INITIAL_STATE,
|
|
3856
|
-
SET_FEATURES: use_seamly_commands_SET_FEATURES
|
|
3869
|
+
SET_INITIAL_STATE: use_seamly_commands_SET_INITIAL_STATE
|
|
3857
3870
|
} = seamly_utils_seamlyActions;
|
|
3858
3871
|
|
|
3859
3872
|
const use_seamly_commands_useSeamlyCommands = () => {
|
|
@@ -3885,38 +3898,10 @@ const use_seamly_commands_useSeamlyCommands = () => {
|
|
|
3885
3898
|
hasResponded,
|
|
3886
3899
|
unreadMessageCount
|
|
3887
3900
|
});
|
|
3888
|
-
}, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
|
|
3889
|
-
const reset = useCallback(async () => {
|
|
3890
|
-
dispatch(AppActions.reset());
|
|
3891
|
-
|
|
3892
|
-
dispatch({
|
|
3893
|
-
type: use_seamly_commands_SET_IS_LOADING,
|
|
3894
|
-
isLoading: true
|
|
3895
|
-
});
|
|
3896
|
-
const {
|
|
3897
|
-
agentName
|
|
3898
|
-
} = appConfig.defaults || {};
|
|
3899
|
-
dispatch({
|
|
3900
|
-
type: use_seamly_commands_SET_HEADER_SUB_TITLE,
|
|
3901
|
-
title: agentName || ''
|
|
3902
|
-
});
|
|
3903
|
-
|
|
3904
|
-
try {
|
|
3905
|
-
const {
|
|
3906
|
-
features
|
|
3907
|
-
} = await api.reset();
|
|
3908
|
-
dispatch({
|
|
3909
|
-
type: use_seamly_commands_SET_FEATURES,
|
|
3910
|
-
features
|
|
3911
|
-
});
|
|
3912
|
-
dispatch({
|
|
3913
|
-
type: use_seamly_commands_SET_INITIAL_STATE,
|
|
3914
|
-
initialState: {}
|
|
3915
|
-
});
|
|
3916
|
-
} catch (error) {
|
|
3917
|
-
dispatch(InterruptActions.set(error));
|
|
3918
|
-
}
|
|
3919
|
-
}, [api, dispatch, appConfig]);
|
|
3901
|
+
}, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
|
|
3902
|
+
const reset = useCallback(async () => {
|
|
3903
|
+
dispatch(AppActions.reset());
|
|
3904
|
+
}, [dispatch]);
|
|
3920
3905
|
const getMessageBase = useCallback(type => ({
|
|
3921
3906
|
type,
|
|
3922
3907
|
id: randomId(),
|
|
@@ -4243,6 +4228,7 @@ const useSeamlyEntry = () => {
|
|
|
4243
4228
|
|
|
4244
4229
|
|
|
4245
4230
|
|
|
4231
|
+
|
|
4246
4232
|
const {
|
|
4247
4233
|
SET_IS_LOADING: use_seamly_chat_SET_IS_LOADING
|
|
4248
4234
|
} = seamly_utils_seamlyActions;
|
|
@@ -4251,6 +4237,9 @@ const useSeamlyChat = () => {
|
|
|
4251
4237
|
const {
|
|
4252
4238
|
t
|
|
4253
4239
|
} = useI18n();
|
|
4240
|
+
const {
|
|
4241
|
+
layoutMode
|
|
4242
|
+
} = useConfig();
|
|
4254
4243
|
const {
|
|
4255
4244
|
isOpen,
|
|
4256
4245
|
isVisible,
|
|
@@ -4330,7 +4319,7 @@ const useSeamlyChat = () => {
|
|
|
4330
4319
|
// they had been connected before.
|
|
4331
4320
|
// We also keep track of whether connect was called before to avoid
|
|
4332
4321
|
// multiple in-flight connection processes.
|
|
4333
|
-
if (!isOpen && !hasConversation || connectCalled.current || !apiConfigReady) {
|
|
4322
|
+
if (layoutMode === 'window' && !isOpen && !hasConversation || connectCalled.current || !apiConfigReady) {
|
|
4334
4323
|
return;
|
|
4335
4324
|
}
|
|
4336
4325
|
|
|
@@ -4348,7 +4337,7 @@ const useSeamlyChat = () => {
|
|
|
4348
4337
|
start();
|
|
4349
4338
|
});
|
|
4350
4339
|
connectCalled.current = true;
|
|
4351
|
-
}, [isOpen, hasConversation, apiConfigReady, start, connect, dispatch]);
|
|
4340
|
+
}, [isOpen, hasConversation, apiConfigReady, start, connect, dispatch, layoutMode]);
|
|
4352
4341
|
|
|
4353
4342
|
const openChat = () => {
|
|
4354
4343
|
setVisibility(visibilityStates.open);
|
|
@@ -4765,6 +4754,7 @@ function translations_reducer_defineProperty(obj, key, value) { if (key in obj)
|
|
|
4765
4754
|
|
|
4766
4755
|
|
|
4767
4756
|
|
|
4757
|
+
|
|
4768
4758
|
const translations_reducer_initialState = {
|
|
4769
4759
|
isActive: false,
|
|
4770
4760
|
currentLocale: undefined,
|
|
@@ -4824,7 +4814,8 @@ const translations_reducer_initialState = {
|
|
|
4824
4814
|
return translations_reducer_objectSpread(translations_reducer_objectSpread({}, state), {}, {
|
|
4825
4815
|
originalPayloadIds: [...state.originalPayloadIds, payloadId]
|
|
4826
4816
|
});
|
|
4827
|
-
}
|
|
4817
|
+
},
|
|
4818
|
+
[app_actions_initialize.pending]: () => translations_reducer_initialState
|
|
4828
4819
|
}, translations_reducer_initialState));
|
|
4829
4820
|
;// CONCATENATED MODULE: ./src/javascripts/lib/css.js
|
|
4830
4821
|
|
|
@@ -4841,7 +4832,14 @@ const css_className = (...classes) => classes.flat().map(c => {
|
|
|
4841
4832
|
}
|
|
4842
4833
|
|
|
4843
4834
|
return c;
|
|
4844
|
-
}).filter(c => typeof c === 'string').map(c => c.split(' ')).flat().filter(c => c.length).map(c =>
|
|
4835
|
+
}).filter(c => typeof c === 'string').map(c => c.split(' ')).flat().filter(c => c.length).map(c => {
|
|
4836
|
+
// This rule makes sure the CSS_NAME is not added yet
|
|
4837
|
+
if (c.indexOf(CSS_NAME) > -1) {
|
|
4838
|
+
return c;
|
|
4839
|
+
}
|
|
4840
|
+
|
|
4841
|
+
return [CSS_NAME, c].join('-');
|
|
4842
|
+
}).join(' ');
|
|
4845
4843
|
;// CONCATENATED MODULE: ./node_modules/raw-loader/dist/cjs.js!./src/icons/avatar_bot-32.svg
|
|
4846
4844
|
/* harmony default export */ const avatar_bot_32 = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32px\" height=\"32px\" x=\"0px\" y=\"0px\" viewBox=\"0 0 32 32\"><defs/><path fill=\"#003A5D\" d=\"M0,4.717C0,2.112,2.112,0,4.717,0h22.566C29.888,0,32,2.112,32,4.717v22.566C32,29.887,29.888,32,27.283,32 H4.717C2.113,32,0,29.887,0,27.283V4.717z\"/><path fill=\"#FFF\" d=\"M10.103,14.901c-1.107,0-2.004-0.897-2.004-2.004s0.897-2.005,2.004-2.005c1.107,0,2.005,0.897,2.005,2.005 C12.108,14.004,11.211,14.901,10.103,14.901z M16,14.901c1.107,0,2.005-0.897,2.005-2.004S17.108,10.892,16,10.892 c-1.108,0-2.005,0.897-2.005,2.005C13.995,14.004,14.892,14.901,16,14.901z M21.896,10.892c-1.106,0-2.004,0.897-2.004,2.005 c0,1.107,0.896,2.004,2.004,2.004c1.109,0,2.005-0.897,2.005-2.004C23.901,11.789,23.005,10.892,21.896,10.892z M21.408,18.207 H10.783C11.83,23.973,20.361,23.973,21.408,18.207z\"/></svg>");
|
|
4847
4845
|
;// CONCATENATED MODULE: ./node_modules/raw-loader/dist/cjs.js!./src/icons/icon_balloon-32.svg
|
|
@@ -4869,7 +4867,7 @@ const css_className = (...classes) => classes.flat().map(c => {
|
|
|
4869
4867
|
;// CONCATENATED MODULE: ./node_modules/raw-loader/dist/cjs.js!./src/icons/icon_arrow_right-16.svg
|
|
4870
4868
|
/* harmony default export */ const icon_arrow_right_16 = ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->\n<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 16 16\" enable-background=\"new 0 0 16 16\" xml:space=\"preserve\">\n<path fill=\"#5053A4\" d=\"M2.4,8.1c0-0.6,0.4-1,1-1h7L8.1,4.5c-0.4-0.4-0.3-1,0.1-1.4c0.2-0.2,0.4-0.2,0.7-0.2c0.3,0,0.6,0.1,0.8,0.3\n\tl3.7,4.2c0,0,0.1,0.1,0.1,0.2c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.2,0.1,0.3c0,0,0,0,0,0c0,0,0,0,0,0c0,0.1,0,0.3-0.1,0.4\n\tc0,0-0.1,0.1-0.1,0.1c0,0.1-0.1,0.1-0.1,0.2l-3.7,4.1c-0.4,0.4-1,0.4-1.4,0.1c-0.4-0.4-0.4-1-0.1-1.4l2.2-2.4h-7\n\tC2.8,9.1,2.4,8.6,2.4,8.1z\"/>\n</svg>\n");
|
|
4871
4869
|
;// CONCATENATED MODULE: ./node_modules/raw-loader/dist/cjs.js!./src/icons/icon_file-32.svg
|
|
4872
|
-
/* harmony default export */ const icon_file_32 = ("<svg xmlns=\"http://www.w3.org/2000/svg\"
|
|
4870
|
+
/* harmony default export */ const icon_file_32 = ("<svg xmlns=\"http://www.w3.org/2000/svg\" xml:space=\"preserve\" x=\"0px\" y=\"0px\" version=\"1.1\" viewBox=\"0 0 32 32\"><path fill=\"#4A48C1\" d=\"M16,28.5c-3.6,0-6.5-3-6.5-6.6V9.6c0-0.6,0.4-1,1-1s1,0.4,1,1v12.3c0,2.5,2,4.6,4.5,4.6\tc2.5,0,4.5-2.1,4.5-4.6V8.3c0-1.5-1.2-2.8-2.7-2.8c-1.5,0-2.7,1.3-2.7,2.8v13.5c0,0.6,0.5,1.1,1,1.1c0.6,0,1-0.5,1-1.1v-10\tc0-0.6,0.4-1,1-1s1,0.4,1,1v10c0,1.7-1.4,3.1-3,3.1s-3-1.4-3-3.1V8.3c0-2.6,2.1-4.8,4.7-4.8c2.6,0,4.7,2.2,4.7,4.8v13.6\tC22.5,25.5,19.6,28.5,16,28.5z\"/></svg>");
|
|
4873
4871
|
;// CONCATENATED MODULE: ./node_modules/raw-loader/dist/cjs.js!./src/icons/icon_newtopic-32.svg
|
|
4874
4872
|
/* harmony default export */ const icon_newtopic_32 = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32px\" height=\"32px\" x=\"0px\" y=\"0px\" viewBox=\"0 0 32 32\"><path fill=\"#4A48C1\" d=\"M16,8.593l2.407,4.573l5.093,0.876l-3.604,3.702l0.74,5.115L16,20.574l-4.634,2.285l0.739-5.115L8.5,14.042\tl5.094-0.876L16,8.593z\"/></svg>");
|
|
4875
4873
|
;// CONCATENATED MODULE: ./node_modules/raw-loader/dist/cjs.js!./src/icons/icon_newtranslation-16.svg
|
|
@@ -5053,6 +5051,7 @@ const in_out_transition_InOutTransition = ({
|
|
|
5053
5051
|
|
|
5054
5052
|
|
|
5055
5053
|
const options_frame_OptionsFrame = ({
|
|
5054
|
+
className: givenClassName,
|
|
5056
5055
|
children,
|
|
5057
5056
|
onCancel,
|
|
5058
5057
|
headingText,
|
|
@@ -5095,7 +5094,7 @@ const options_frame_OptionsFrame = ({
|
|
|
5095
5094
|
className: className('options', {
|
|
5096
5095
|
'options--right': position !== 'left',
|
|
5097
5096
|
'options--left': position === 'left'
|
|
5098
|
-
}),
|
|
5097
|
+
}, givenClassName),
|
|
5099
5098
|
"aria-labelledby": mainHeadingId,
|
|
5100
5099
|
tabIndex: "-1",
|
|
5101
5100
|
ref: container,
|
|
@@ -5131,25 +5130,49 @@ const options_frame_OptionsFrame = ({
|
|
|
5131
5130
|
|
|
5132
5131
|
/* harmony default export */ const options_frame = ((/* unused pure expression or super */ null && (options_frame_OptionsFrame)));
|
|
5133
5132
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/form-controls/form.js
|
|
5133
|
+
const form_excluded = (/* unused pure expression or super */ null && (["className", "disableValidationClasses"]));
|
|
5134
|
+
|
|
5134
5135
|
function form_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; }
|
|
5135
5136
|
|
|
5136
5137
|
function form_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { form_ownKeys(Object(source), true).forEach(function (key) { form_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { form_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5137
5138
|
|
|
5138
5139
|
function form_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; }
|
|
5139
5140
|
|
|
5140
|
-
function
|
|
5141
|
+
function form_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = form_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; }
|
|
5142
|
+
|
|
5143
|
+
function form_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5144
|
+
|
|
5141
5145
|
|
|
5142
5146
|
|
|
5143
5147
|
|
|
5144
5148
|
|
|
5145
5149
|
function form_Form(_ref) {
|
|
5146
|
-
let
|
|
5150
|
+
let {
|
|
5151
|
+
className: givenClassName,
|
|
5152
|
+
disableValidationClasses
|
|
5153
|
+
} = _ref,
|
|
5154
|
+
props = form_objectWithoutProperties(_ref, form_excluded);
|
|
5147
5155
|
|
|
5148
5156
|
const {
|
|
5149
|
-
handleSubmit
|
|
5157
|
+
handleSubmit,
|
|
5158
|
+
isValid,
|
|
5159
|
+
isSubmitted
|
|
5150
5160
|
} = useForm();
|
|
5161
|
+
const formClasses = ['form'];
|
|
5162
|
+
|
|
5163
|
+
if (!disableValidationClasses && isSubmitted) {
|
|
5164
|
+
formClasses.push('form--submitted');
|
|
5165
|
+
|
|
5166
|
+
if (isValid) {
|
|
5167
|
+
formClasses.push('form--valid');
|
|
5168
|
+
} else {
|
|
5169
|
+
formClasses.push('form--invalid');
|
|
5170
|
+
}
|
|
5171
|
+
}
|
|
5172
|
+
|
|
5151
5173
|
return _jsx("form", form_objectSpread({
|
|
5152
|
-
onSubmit: handleSubmit
|
|
5174
|
+
onSubmit: handleSubmit,
|
|
5175
|
+
className: className([...formClasses, givenClassName])
|
|
5153
5176
|
}, props));
|
|
5154
5177
|
}
|
|
5155
5178
|
|
|
@@ -5171,11 +5194,12 @@ function error_Error({
|
|
|
5171
5194
|
return () => clearTimeout(timerId); // clear timer if error is mounted+unmounted within 300
|
|
5172
5195
|
}, []);
|
|
5173
5196
|
return _jsx("div", {
|
|
5197
|
+
className: className('error'),
|
|
5174
5198
|
"aria-live": "assertive",
|
|
5175
5199
|
"aria-atomic": "true",
|
|
5176
5200
|
children: isAvailable && error && _jsxs("span", {
|
|
5177
5201
|
id: id,
|
|
5178
|
-
className: className('
|
|
5202
|
+
className: className('error__message'),
|
|
5179
5203
|
children: [_jsx(Icon, {
|
|
5180
5204
|
name: "error",
|
|
5181
5205
|
size: "16"
|
|
@@ -5330,6 +5354,7 @@ function form_TranslationsOptionsDialogForm({
|
|
|
5330
5354
|
}, [t, languages, uiLocale]);
|
|
5331
5355
|
return _jsxs(Form, {
|
|
5332
5356
|
noValidate: "true",
|
|
5357
|
+
className: className('options__form'),
|
|
5333
5358
|
children: [_jsx("p", {
|
|
5334
5359
|
className: className('options__description'),
|
|
5335
5360
|
id: descriptionId,
|
|
@@ -5535,6 +5560,7 @@ const inputName = 'locale';
|
|
|
5535
5560
|
function options_dialog_TranslationsOptionsDialog({
|
|
5536
5561
|
onClose
|
|
5537
5562
|
}) {
|
|
5563
|
+
const [errorClass, setErrorClass] = useState(undefined);
|
|
5538
5564
|
const {
|
|
5539
5565
|
t
|
|
5540
5566
|
} = useI18n();
|
|
@@ -5558,8 +5584,18 @@ function options_dialog_TranslationsOptionsDialog({
|
|
|
5558
5584
|
onClose();
|
|
5559
5585
|
focusContainer();
|
|
5560
5586
|
}
|
|
5561
|
-
};
|
|
5587
|
+
};
|
|
5562
5588
|
|
|
5589
|
+
const handleError = useCallback(({
|
|
5590
|
+
isValid,
|
|
5591
|
+
isSubmitted
|
|
5592
|
+
}) => {
|
|
5593
|
+
if (isSubmitted && !isValid) {
|
|
5594
|
+
setErrorClass('options--error');
|
|
5595
|
+
} else {
|
|
5596
|
+
setErrorClass(undefined);
|
|
5597
|
+
}
|
|
5598
|
+
}, [setErrorClass]); // we need a key to fully reset the form when we enable/disable translations
|
|
5563
5599
|
|
|
5564
5600
|
const formKeyRef = useRef(0);
|
|
5565
5601
|
const validationSchema = useMemo(() => {
|
|
@@ -5570,6 +5606,7 @@ function options_dialog_TranslationsOptionsDialog({
|
|
|
5570
5606
|
};
|
|
5571
5607
|
}, [isActive, t]);
|
|
5572
5608
|
return _jsx(OptionsFrame, {
|
|
5609
|
+
className: errorClass,
|
|
5573
5610
|
onCancel: onClose,
|
|
5574
5611
|
formName: formName,
|
|
5575
5612
|
headingText: t('translations.settings.title'),
|
|
@@ -5580,6 +5617,7 @@ function options_dialog_TranslationsOptionsDialog({
|
|
|
5580
5617
|
onSubmit: handleSubmit,
|
|
5581
5618
|
formId: formName,
|
|
5582
5619
|
validationSchema: validationSchema,
|
|
5620
|
+
onError: handleError,
|
|
5583
5621
|
children: _jsx(TranslationsOptionsDialogForm, {
|
|
5584
5622
|
controlName: inputName,
|
|
5585
5623
|
descriptionId: descriptionId
|
|
@@ -5762,6 +5800,31 @@ function TranslationsChatStatus() {
|
|
|
5762
5800
|
|
|
5763
5801
|
|
|
5764
5802
|
|
|
5803
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/reducer.js
|
|
5804
|
+
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; }
|
|
5805
|
+
|
|
5806
|
+
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; }
|
|
5807
|
+
|
|
5808
|
+
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; }
|
|
5809
|
+
|
|
5810
|
+
|
|
5811
|
+
|
|
5812
|
+
const app_reducer_initialState = {
|
|
5813
|
+
userHasResponded: false
|
|
5814
|
+
};
|
|
5815
|
+
/* harmony default export */ const app_reducer = (app_utils_createReducer({
|
|
5816
|
+
[setHasResponded]: (state, {
|
|
5817
|
+
hasResponded
|
|
5818
|
+
}) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
|
|
5819
|
+
userHasResponded: hasResponded
|
|
5820
|
+
})
|
|
5821
|
+
}, app_reducer_initialState));
|
|
5822
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
|
|
5823
|
+
|
|
5824
|
+
|
|
5825
|
+
|
|
5826
|
+
|
|
5827
|
+
|
|
5765
5828
|
;// CONCATENATED MODULE: ./src/javascripts/style-guide/components/static-core.js
|
|
5766
5829
|
const static_core_excluded = ["translations", "interrupt", "config", "visibility"];
|
|
5767
5830
|
|
|
@@ -5807,7 +5870,7 @@ const SeamlyTestCore = ({
|
|
|
5807
5870
|
{
|
|
5808
5871
|
translations: translationsSlice,
|
|
5809
5872
|
interrupt: interruptSlice,
|
|
5810
|
-
config: configSlice,
|
|
5873
|
+
config: configSlice = {},
|
|
5811
5874
|
visibility: visibilitySlice
|
|
5812
5875
|
} = _ref,
|
|
5813
5876
|
restState = static_core_objectWithoutProperties(_ref, static_core_excluded);
|
|
@@ -5816,8 +5879,8 @@ const SeamlyTestCore = ({
|
|
|
5816
5879
|
reducers: {
|
|
5817
5880
|
state: stateReducer,
|
|
5818
5881
|
[String(app_reducer)]: app_reducer,
|
|
5882
|
+
[String(config_reducer)]: config_reducer,
|
|
5819
5883
|
[String(reducer)]: reducer,
|
|
5820
|
-
[String(forms_reducer)]: forms_reducer,
|
|
5821
5884
|
[String(translations_reducer)]: translations_reducer,
|
|
5822
5885
|
[String(i18n_reducer)]: i18n_reducer,
|
|
5823
5886
|
[String(interrupt_reducer)]: interrupt_reducer,
|
|
@@ -5834,7 +5897,12 @@ const SeamlyTestCore = ({
|
|
|
5834
5897
|
eventBus: eventBusRef.current
|
|
5835
5898
|
})]
|
|
5836
5899
|
});
|
|
5837
|
-
newStore.dispatch(initialize(configSlice
|
|
5900
|
+
newStore.dispatch(initialize(configSlice));
|
|
5901
|
+
|
|
5902
|
+
if (configSlice.preChatEvents) {
|
|
5903
|
+
newStore.dispatch(setPreChatEvents(configSlice.preChatEvents));
|
|
5904
|
+
}
|
|
5905
|
+
|
|
5838
5906
|
newStore.dispatch(setLocale.fulfilled('en-GB', translations));
|
|
5839
5907
|
return newStore;
|
|
5840
5908
|
}, [state, translations]);
|
|
@@ -5846,7 +5914,9 @@ const SeamlyTestCore = ({
|
|
|
5846
5914
|
value: liveMsgRef.current,
|
|
5847
5915
|
children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.SeamlyApiContext.Provider, {
|
|
5848
5916
|
value: bareApi,
|
|
5849
|
-
children:
|
|
5917
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(web_ui_namespaceObject.ComponentFilter, {
|
|
5918
|
+
children: children
|
|
5919
|
+
})
|
|
5850
5920
|
})
|
|
5851
5921
|
})
|
|
5852
5922
|
})
|
|
@@ -6007,7 +6077,6 @@ const baseState = {
|
|
|
6007
6077
|
historyLoaded: false,
|
|
6008
6078
|
skiplinkTargetId: (0,web_ui_namespaceObject.randomId)(),
|
|
6009
6079
|
optionsButtonId: (0,web_ui_namespaceObject.randomId)(),
|
|
6010
|
-
cobrowseContainerId: (0,web_ui_namespaceObject.randomId)(),
|
|
6011
6080
|
serviceData: {},
|
|
6012
6081
|
options: {
|
|
6013
6082
|
features: {},
|
|
@@ -6030,7 +6099,7 @@ const participantInfo = {
|
|
|
6030
6099
|
'e65fa8dc-97ab-4711-8fec-82bae6461aa2': {
|
|
6031
6100
|
avatar,
|
|
6032
6101
|
id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
|
|
6033
|
-
introduction: "You're now talking to
|
|
6102
|
+
introduction: "You're now talking to Mrs. Bot gimme a minit",
|
|
6034
6103
|
name: 'Mrs. Bot',
|
|
6035
6104
|
service: {
|
|
6036
6105
|
expose: {
|
|
@@ -6045,7 +6114,7 @@ const participantInfo = {
|
|
|
6045
6114
|
},
|
|
6046
6115
|
'e65fa8dc-97ab-4711-8fec-82bae6461aa3': {
|
|
6047
6116
|
id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa3',
|
|
6048
|
-
introduction: "You're now talking to
|
|
6117
|
+
introduction: "You're now talking to Mrs. Bot gimme a minit",
|
|
6049
6118
|
name: 'Mrs. Bot',
|
|
6050
6119
|
service: {
|
|
6051
6120
|
expose: {
|
|
@@ -6146,8 +6215,7 @@ const infoMessage = {
|
|
|
6146
6215
|
payload: {
|
|
6147
6216
|
body: {
|
|
6148
6217
|
text: 'This is a system generated info message',
|
|
6149
|
-
type: 'text'
|
|
6150
|
-
variables: {}
|
|
6218
|
+
type: 'text'
|
|
6151
6219
|
},
|
|
6152
6220
|
fromClient: false,
|
|
6153
6221
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
@@ -6200,7 +6268,7 @@ const participantMessage = {
|
|
|
6200
6268
|
participant: {
|
|
6201
6269
|
avatar,
|
|
6202
6270
|
id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
|
|
6203
|
-
introduction: "You're now talking to
|
|
6271
|
+
introduction: "You're now talking to Mrs. Bot gimme a minit",
|
|
6204
6272
|
name: 'Mrs. Bot',
|
|
6205
6273
|
service: {
|
|
6206
6274
|
expose: {
|
|
@@ -6226,7 +6294,7 @@ const participantMessageDefaultIcon = {
|
|
|
6226
6294
|
messageStatus: 'received',
|
|
6227
6295
|
participant: {
|
|
6228
6296
|
id: 'e65fa8dc-97ab-4711-8fec-82bae6461aa3',
|
|
6229
|
-
introduction: "You're now talking to
|
|
6297
|
+
introduction: "You're now talking to Mrs. Bot gimme a minit",
|
|
6230
6298
|
name: 'Mrs. Bot',
|
|
6231
6299
|
service: {
|
|
6232
6300
|
expose: {
|
|
@@ -6254,8 +6322,7 @@ const getCustomMessage = ({
|
|
|
6254
6322
|
body: {
|
|
6255
6323
|
type,
|
|
6256
6324
|
text,
|
|
6257
|
-
data
|
|
6258
|
-
variables: {}
|
|
6325
|
+
data
|
|
6259
6326
|
},
|
|
6260
6327
|
participant: 'e65fa8dc-97ab-4711-8fec-82bae6461aa2',
|
|
6261
6328
|
service: {
|
|
@@ -6280,8 +6347,7 @@ const shortTextMessage = {
|
|
|
6280
6347
|
payload: {
|
|
6281
6348
|
body: {
|
|
6282
6349
|
text: 'What do you want to do?',
|
|
6283
|
-
type: 'text'
|
|
6284
|
-
variables: {}
|
|
6350
|
+
type: 'text'
|
|
6285
6351
|
},
|
|
6286
6352
|
fromClient: false,
|
|
6287
6353
|
fromHistory: true,
|
|
@@ -6300,6 +6366,18 @@ const shortTextMessage = {
|
|
|
6300
6366
|
type: 'text'
|
|
6301
6367
|
}
|
|
6302
6368
|
};
|
|
6369
|
+
const splashMessage = {
|
|
6370
|
+
type: 'message',
|
|
6371
|
+
payload: {
|
|
6372
|
+
type: 'splash',
|
|
6373
|
+
id: (0,web_ui_namespaceObject.randomId)(),
|
|
6374
|
+
body: {
|
|
6375
|
+
text: 'Example splash message ✨',
|
|
6376
|
+
type: 'text',
|
|
6377
|
+
variables: {}
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
6380
|
+
};
|
|
6303
6381
|
const ctaMessage = {
|
|
6304
6382
|
type: 'message',
|
|
6305
6383
|
payload: {
|
|
@@ -6333,8 +6411,7 @@ const longTextMessage = {
|
|
|
6333
6411
|
payload: {
|
|
6334
6412
|
body: {
|
|
6335
6413
|
text: 'What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am. What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am. What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am.',
|
|
6336
|
-
type: 'text'
|
|
6337
|
-
variables: {}
|
|
6414
|
+
type: 'text'
|
|
6338
6415
|
},
|
|
6339
6416
|
fromClient: false,
|
|
6340
6417
|
fromHistory: true,
|
|
@@ -6358,8 +6435,7 @@ const textMessageBoldItalicUnderline = {
|
|
|
6358
6435
|
payload: {
|
|
6359
6436
|
body: {
|
|
6360
6437
|
text: 'Bubble with **bold** *italic* <u>underline</u>',
|
|
6361
|
-
type: 'text'
|
|
6362
|
-
variables: {}
|
|
6438
|
+
type: 'text'
|
|
6363
6439
|
},
|
|
6364
6440
|
fromClient: false,
|
|
6365
6441
|
fromHistory: true,
|
|
@@ -6384,24 +6460,8 @@ const textMessageWithLinks = {
|
|
|
6384
6460
|
type: 'message',
|
|
6385
6461
|
payload: {
|
|
6386
6462
|
body: {
|
|
6387
|
-
text: '
|
|
6388
|
-
type: 'text'
|
|
6389
|
-
variables: {
|
|
6390
|
-
link_1: {
|
|
6391
|
-
id: '1',
|
|
6392
|
-
name: 'Link in same window',
|
|
6393
|
-
newTab: false,
|
|
6394
|
-
type: 'link',
|
|
6395
|
-
url: 'https://google.com'
|
|
6396
|
-
},
|
|
6397
|
-
link_2: {
|
|
6398
|
-
id: '2',
|
|
6399
|
-
name: 'link in new window',
|
|
6400
|
-
newTab: true,
|
|
6401
|
-
type: 'link',
|
|
6402
|
-
url: 'https://google.com'
|
|
6403
|
-
}
|
|
6404
|
-
}
|
|
6463
|
+
text: '<a href="https://google.com" data-link-id="1">Link in same window</a> and <a href="https://google.com" data-link-id="2" target="_blank">link in new window</a> embedded in text',
|
|
6464
|
+
type: 'text'
|
|
6405
6465
|
},
|
|
6406
6466
|
fromClient: false,
|
|
6407
6467
|
fromHistory: true,
|
|
@@ -6426,17 +6486,8 @@ const textMessageWithLongLink = {
|
|
|
6426
6486
|
type: 'message',
|
|
6427
6487
|
payload: {
|
|
6428
6488
|
body: {
|
|
6429
|
-
text: 'Here is a long link
|
|
6430
|
-
type: 'text'
|
|
6431
|
-
variables: {
|
|
6432
|
-
link_1: {
|
|
6433
|
-
id: '1',
|
|
6434
|
-
name: 'click me click me please click me yoohoooo please please click me here I am click me now what are you waiting for click me now now now now now click meeeeeeeeeeeeee',
|
|
6435
|
-
newTab: false,
|
|
6436
|
-
type: 'link',
|
|
6437
|
-
url: 'https://google.com'
|
|
6438
|
-
}
|
|
6439
|
-
}
|
|
6489
|
+
text: 'Here is a long link <a href="https://google.com" data-link-id="1">click me click me please click me yoohoooo please please click me here I am click me now what are you waiting for click me now now now now now click meeeeeeeeeeeeee</a> embedded in text',
|
|
6490
|
+
type: 'text'
|
|
6440
6491
|
},
|
|
6441
6492
|
fromClient: false,
|
|
6442
6493
|
fromHistory: true,
|
|
@@ -6462,8 +6513,7 @@ const textMesageWithBullets = {
|
|
|
6462
6513
|
payload: {
|
|
6463
6514
|
body: {
|
|
6464
6515
|
text: '<ul>\n<li>Bullets</li>\n<li>bullets</li>\n<li>bullets</li>\n</ul>\n',
|
|
6465
|
-
type: 'text'
|
|
6466
|
-
variables: {}
|
|
6516
|
+
type: 'text'
|
|
6467
6517
|
},
|
|
6468
6518
|
fromClient: false,
|
|
6469
6519
|
fromHistory: true,
|
|
@@ -6580,10 +6630,6 @@ const choicePromptMessage = {
|
|
|
6580
6630
|
id: '1eff6098-f14f-4683-a2b8-30d1c573d45e',
|
|
6581
6631
|
text: 'T-Dialog',
|
|
6582
6632
|
type: 'choice'
|
|
6583
|
-
}, {
|
|
6584
|
-
id: '3555079c-6f60-45e1-82c7-5d5832634a3f',
|
|
6585
|
-
text: 'Escalation - Cobrowser',
|
|
6586
|
-
type: 'choice'
|
|
6587
6633
|
}, {
|
|
6588
6634
|
id: 'a8ba3ce8-3324-4e7a-accc-944ff78ac890',
|
|
6589
6635
|
text: 'Customers',
|
|
@@ -6628,8 +6674,7 @@ const userMessage = {
|
|
|
6628
6674
|
payload: {
|
|
6629
6675
|
body: {
|
|
6630
6676
|
text: 'This is what the user typed',
|
|
6631
|
-
type: 'text'
|
|
6632
|
-
variables: {}
|
|
6677
|
+
type: 'text'
|
|
6633
6678
|
},
|
|
6634
6679
|
fromClient: true,
|
|
6635
6680
|
fromHistory: true,
|
|
@@ -6646,8 +6691,7 @@ const userMessageLong = {
|
|
|
6646
6691
|
payload: {
|
|
6647
6692
|
body: {
|
|
6648
6693
|
text: 'This is what the user typed. And sometimes the user has quite a lot to say and then we get longer lines that need to wrap well and not break the styling so here goes with just such a line right here!!',
|
|
6649
|
-
type: 'text'
|
|
6650
|
-
variables: {}
|
|
6694
|
+
type: 'text'
|
|
6651
6695
|
},
|
|
6652
6696
|
fromClient: true,
|
|
6653
6697
|
fromHistory: true,
|
|
@@ -6734,6 +6778,35 @@ const translationsSlice = {
|
|
|
6734
6778
|
originalPayloadIds: [],
|
|
6735
6779
|
containerId: (0,web_ui_namespaceObject.randomId)()
|
|
6736
6780
|
};
|
|
6781
|
+
const suggestions = [{
|
|
6782
|
+
id: '1',
|
|
6783
|
+
question: 'Invoices',
|
|
6784
|
+
categories: ['mixed', 'short']
|
|
6785
|
+
}, {
|
|
6786
|
+
id: '2',
|
|
6787
|
+
question: 'Temporary subscription pause',
|
|
6788
|
+
categories: ['mixed', 'medium']
|
|
6789
|
+
}, {
|
|
6790
|
+
id: '3',
|
|
6791
|
+
question: 'Cancellation',
|
|
6792
|
+
categories: ['mixed', 'short']
|
|
6793
|
+
}, {
|
|
6794
|
+
id: '4',
|
|
6795
|
+
question: 'Apps',
|
|
6796
|
+
categories: ['mixed', 'medium']
|
|
6797
|
+
}, {
|
|
6798
|
+
id: '5',
|
|
6799
|
+
question: 'At what date will my subscription end?',
|
|
6800
|
+
categories: ['mixed', 'long']
|
|
6801
|
+
}, {
|
|
6802
|
+
id: 'A',
|
|
6803
|
+
question: 'Quotes',
|
|
6804
|
+
categories: ['short']
|
|
6805
|
+
}, {
|
|
6806
|
+
id: 'B',
|
|
6807
|
+
question: 'How to get in touch with us',
|
|
6808
|
+
categories: ['long']
|
|
6809
|
+
}];
|
|
6737
6810
|
const categoryKeys = {
|
|
6738
6811
|
unstarted: 'unstarted',
|
|
6739
6812
|
messages: 'messages',
|
|
@@ -6741,8 +6814,9 @@ const categoryKeys = {
|
|
|
6741
6814
|
uploads: 'uploads',
|
|
6742
6815
|
features: 'features',
|
|
6743
6816
|
options: 'options',
|
|
6744
|
-
|
|
6745
|
-
|
|
6817
|
+
suggestions: 'suggestions',
|
|
6818
|
+
minimizedWindow: 'minimizedWindow',
|
|
6819
|
+
minimizedInline: 'minimizedInline',
|
|
6746
6820
|
translations: 'translations'
|
|
6747
6821
|
};
|
|
6748
6822
|
const categories = {
|
|
@@ -6770,14 +6844,18 @@ const categories = {
|
|
|
6770
6844
|
heading: 'Options',
|
|
6771
6845
|
description: ''
|
|
6772
6846
|
},
|
|
6773
|
-
[categoryKeys.
|
|
6774
|
-
heading: '
|
|
6847
|
+
[categoryKeys.suggestions]: {
|
|
6848
|
+
heading: 'Suggestions',
|
|
6775
6849
|
description: ''
|
|
6776
6850
|
},
|
|
6777
|
-
[categoryKeys.
|
|
6851
|
+
[categoryKeys.minimizedWindow]: {
|
|
6778
6852
|
heading: 'Minimized window',
|
|
6779
6853
|
desciption: ''
|
|
6780
6854
|
},
|
|
6855
|
+
[categoryKeys.minimizedInline]: {
|
|
6856
|
+
heading: 'Minimized Inline',
|
|
6857
|
+
description: ''
|
|
6858
|
+
},
|
|
6781
6859
|
[categoryKeys.translations]: {
|
|
6782
6860
|
heading: 'Translations',
|
|
6783
6861
|
description: ''
|
|
@@ -6850,7 +6928,7 @@ const standardState = {
|
|
|
6850
6928
|
serviceInfo: {
|
|
6851
6929
|
activeServiceSessionId: '3942159e-9878-469e-9120-f44fd6be0f35'
|
|
6852
6930
|
},
|
|
6853
|
-
events: [participantMessage, infoMessage, shortTextMessage, states_objectSpread(states_objectSpread({}, choicePromptMessage), {}, {
|
|
6931
|
+
events: [splashMessage, participantMessage, infoMessage, shortTextMessage, states_objectSpread(states_objectSpread({}, choicePromptMessage), {}, {
|
|
6854
6932
|
payload: states_objectSpread(states_objectSpread({}, choicePromptMessage.payload), {}, {
|
|
6855
6933
|
id: `${choicePromptMessage.payload.id}XXX`
|
|
6856
6934
|
})
|
|
@@ -6929,8 +7007,7 @@ const standardState = {
|
|
|
6929
7007
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
6930
7008
|
body: {
|
|
6931
7009
|
text: 'Long ago when a dialog started',
|
|
6932
|
-
type: 'text'
|
|
6933
|
-
variables: {}
|
|
7010
|
+
type: 'text'
|
|
6934
7011
|
}
|
|
6935
7012
|
})
|
|
6936
7013
|
}, participantMessage, participantMessageDefaultIcon, newTopicDivider, transcriptInfoMessage, ...[newTranslationDividerStart, newTranslationDividerStop].map(addTranslationData), infoMessage]
|
|
@@ -6974,8 +7051,7 @@ const standardState = {
|
|
|
6974
7051
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
6975
7052
|
body: {
|
|
6976
7053
|
text: 'Long ago when a dialog started',
|
|
6977
|
-
type: 'text'
|
|
6978
|
-
variables: {}
|
|
7054
|
+
type: 'text'
|
|
6979
7055
|
}
|
|
6980
7056
|
})
|
|
6981
7057
|
}, {
|
|
@@ -6985,8 +7061,7 @@ const standardState = {
|
|
|
6985
7061
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
6986
7062
|
body: {
|
|
6987
7063
|
text: 'Above me should be a time indicator showing the full date',
|
|
6988
|
-
type: 'text'
|
|
6989
|
-
variables: {}
|
|
7064
|
+
type: 'text'
|
|
6990
7065
|
}
|
|
6991
7066
|
})
|
|
6992
7067
|
}, {
|
|
@@ -6996,8 +7071,7 @@ const standardState = {
|
|
|
6996
7071
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
6997
7072
|
body: {
|
|
6998
7073
|
text: 'Another message',
|
|
6999
|
-
type: 'text'
|
|
7000
|
-
variables: {}
|
|
7074
|
+
type: 'text'
|
|
7001
7075
|
}
|
|
7002
7076
|
})
|
|
7003
7077
|
}, {
|
|
@@ -7007,8 +7081,7 @@ const standardState = {
|
|
|
7007
7081
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
7008
7082
|
body: {
|
|
7009
7083
|
text: 'And another message',
|
|
7010
|
-
type: 'text'
|
|
7011
|
-
variables: {}
|
|
7084
|
+
type: 'text'
|
|
7012
7085
|
}
|
|
7013
7086
|
})
|
|
7014
7087
|
}, {
|
|
@@ -7018,8 +7091,7 @@ const standardState = {
|
|
|
7018
7091
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
7019
7092
|
body: {
|
|
7020
7093
|
text: 'Above me should be a time indicator showing "yesterday"',
|
|
7021
|
-
type: 'text'
|
|
7022
|
-
variables: {}
|
|
7094
|
+
type: 'text'
|
|
7023
7095
|
}
|
|
7024
7096
|
})
|
|
7025
7097
|
}, {
|
|
@@ -7029,8 +7101,7 @@ const standardState = {
|
|
|
7029
7101
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
7030
7102
|
body: {
|
|
7031
7103
|
text: 'Another message',
|
|
7032
|
-
type: 'text'
|
|
7033
|
-
variables: {}
|
|
7104
|
+
type: 'text'
|
|
7034
7105
|
}
|
|
7035
7106
|
})
|
|
7036
7107
|
}, {
|
|
@@ -7040,8 +7111,7 @@ const standardState = {
|
|
|
7040
7111
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
7041
7112
|
body: {
|
|
7042
7113
|
text: 'And another message',
|
|
7043
|
-
type: 'text'
|
|
7044
|
-
variables: {}
|
|
7114
|
+
type: 'text'
|
|
7045
7115
|
}
|
|
7046
7116
|
})
|
|
7047
7117
|
}, {
|
|
@@ -7051,8 +7121,7 @@ const standardState = {
|
|
|
7051
7121
|
id: (0,web_ui_namespaceObject.randomId)(),
|
|
7052
7122
|
body: {
|
|
7053
7123
|
text: 'Above me should be a time indicator showing me the dialog continues today',
|
|
7054
|
-
type: 'text'
|
|
7055
|
-
variables: {}
|
|
7124
|
+
type: 'text'
|
|
7056
7125
|
}
|
|
7057
7126
|
})
|
|
7058
7127
|
}]
|
|
@@ -7086,6 +7155,19 @@ const standardState = {
|
|
|
7086
7155
|
}
|
|
7087
7156
|
}]
|
|
7088
7157
|
}),
|
|
7158
|
+
suggestionsMessage: states_objectSpread(states_objectSpread({
|
|
7159
|
+
category: categoryKeys.messages,
|
|
7160
|
+
headingText: 'Suggestions message',
|
|
7161
|
+
description: ''
|
|
7162
|
+
}, baseState), {}, {
|
|
7163
|
+
events: [{
|
|
7164
|
+
type: 'service_data',
|
|
7165
|
+
payload: {
|
|
7166
|
+
type: 'suggestion',
|
|
7167
|
+
body: suggestions
|
|
7168
|
+
}
|
|
7169
|
+
}]
|
|
7170
|
+
}),
|
|
7089
7171
|
errorWithAction: states_objectSpread(states_objectSpread({
|
|
7090
7172
|
// Important: This cannot pick up the language files so the text is hard set here.
|
|
7091
7173
|
category: categoryKeys.errors,
|
|
@@ -7120,16 +7202,18 @@ const standardState = {
|
|
|
7120
7202
|
headingText: `Chat status bar`,
|
|
7121
7203
|
description: ''
|
|
7122
7204
|
}, baseState), {}, {
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7205
|
+
translations: states_objectSpread(states_objectSpread({}, translationsSlice), {}, {
|
|
7206
|
+
currentLocale: 'nl',
|
|
7207
|
+
isActive: true,
|
|
7208
|
+
isAvailable: true,
|
|
7209
|
+
languages: [{
|
|
7210
|
+
locale: 'nl',
|
|
7211
|
+
nativeName: 'Dutch'
|
|
7212
|
+
}, {
|
|
7213
|
+
locale: 'en',
|
|
7214
|
+
nativeName: 'English'
|
|
7215
|
+
}]
|
|
7216
|
+
})
|
|
7133
7217
|
}),
|
|
7134
7218
|
characterLimit: states_objectSpread(states_objectSpread({
|
|
7135
7219
|
category: categoryKeys.features,
|
|
@@ -7322,7 +7406,7 @@ const standardState = {
|
|
|
7322
7406
|
}, baseState), {}, {
|
|
7323
7407
|
options: states_objectSpread(states_objectSpread({}, baseState.options), {}, {
|
|
7324
7408
|
features: {
|
|
7325
|
-
|
|
7409
|
+
sendTranscript: {
|
|
7326
7410
|
enabled: true
|
|
7327
7411
|
}
|
|
7328
7412
|
}
|
|
@@ -7335,7 +7419,7 @@ const standardState = {
|
|
|
7335
7419
|
}, baseState), {}, {
|
|
7336
7420
|
options: states_objectSpread(states_objectSpread({}, baseState.options), {}, {
|
|
7337
7421
|
features: {
|
|
7338
|
-
|
|
7422
|
+
sendTranscript: {
|
|
7339
7423
|
enabled: false
|
|
7340
7424
|
}
|
|
7341
7425
|
}
|
|
@@ -7373,63 +7457,6 @@ const standardState = {
|
|
|
7373
7457
|
}
|
|
7374
7458
|
})
|
|
7375
7459
|
}),
|
|
7376
|
-
optionCobrowseOff: states_objectSpread(states_objectSpread({
|
|
7377
|
-
category: categoryKeys.options,
|
|
7378
|
-
headingText: 'Cobrowse option off',
|
|
7379
|
-
description: ''
|
|
7380
|
-
}, baseState), {}, {
|
|
7381
|
-
options: states_objectSpread(states_objectSpread({}, baseState.options), {}, {
|
|
7382
|
-
optionActive: 'cobrowsing',
|
|
7383
|
-
panelActive: true,
|
|
7384
|
-
features: {
|
|
7385
|
-
cobrowsing: {
|
|
7386
|
-
enabled: true
|
|
7387
|
-
},
|
|
7388
|
-
sendTranscript: {
|
|
7389
|
-
enabled: true
|
|
7390
|
-
}
|
|
7391
|
-
}
|
|
7392
|
-
})
|
|
7393
|
-
}),
|
|
7394
|
-
optionCobrowseOn: states_objectSpread(states_objectSpread({
|
|
7395
|
-
category: categoryKeys.options,
|
|
7396
|
-
headingText: 'Cobrowse option on',
|
|
7397
|
-
description: ''
|
|
7398
|
-
}, baseState), {}, {
|
|
7399
|
-
options: states_objectSpread(states_objectSpread({}, baseState.options), {}, {
|
|
7400
|
-
optionActive: 'cobrowsing',
|
|
7401
|
-
panelActive: true,
|
|
7402
|
-
userSelectedOptions: {
|
|
7403
|
-
cobrowsing: true
|
|
7404
|
-
},
|
|
7405
|
-
features: {
|
|
7406
|
-
cobrowsing: {
|
|
7407
|
-
enabled: true
|
|
7408
|
-
},
|
|
7409
|
-
sendTranscript: {
|
|
7410
|
-
enabled: true
|
|
7411
|
-
}
|
|
7412
|
-
}
|
|
7413
|
-
})
|
|
7414
|
-
}),
|
|
7415
|
-
optionCobrowseUnavailable: states_objectSpread(states_objectSpread({
|
|
7416
|
-
category: categoryKeys.options,
|
|
7417
|
-
headingText: 'Cobrowse option unavailable',
|
|
7418
|
-
description: ''
|
|
7419
|
-
}, baseState), {}, {
|
|
7420
|
-
options: states_objectSpread(states_objectSpread({}, baseState.options), {}, {
|
|
7421
|
-
optionActive: 'cobrowsing',
|
|
7422
|
-
panelActive: true,
|
|
7423
|
-
features: {
|
|
7424
|
-
cobrowsing: {
|
|
7425
|
-
enabled: false
|
|
7426
|
-
},
|
|
7427
|
-
sendTranscript: {
|
|
7428
|
-
enabled: true
|
|
7429
|
-
}
|
|
7430
|
-
}
|
|
7431
|
-
})
|
|
7432
|
-
}),
|
|
7433
7460
|
optionSendTranscript: states_objectSpread(states_objectSpread({
|
|
7434
7461
|
category: categoryKeys.options,
|
|
7435
7462
|
headingText: 'Send transcript option',
|
|
@@ -7439,149 +7466,12 @@ const standardState = {
|
|
|
7439
7466
|
optionActive: 'sendTranscript',
|
|
7440
7467
|
panelActive: true,
|
|
7441
7468
|
features: {
|
|
7442
|
-
cobrowsing: {
|
|
7443
|
-
enabled: true
|
|
7444
|
-
},
|
|
7445
7469
|
sendTranscript: {
|
|
7446
7470
|
enabled: true
|
|
7447
7471
|
}
|
|
7448
7472
|
}
|
|
7449
7473
|
})
|
|
7450
7474
|
}),
|
|
7451
|
-
faqEmptyList: states_objectSpread(states_objectSpread({
|
|
7452
|
-
category: categoryKeys.faq,
|
|
7453
|
-
headingText: 'Empty FAQ list',
|
|
7454
|
-
description: ''
|
|
7455
|
-
}, baseState), {}, {
|
|
7456
|
-
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7457
|
-
showFaq: true
|
|
7458
|
-
}),
|
|
7459
|
-
serviceData: {
|
|
7460
|
-
suggestion: {
|
|
7461
|
-
body: []
|
|
7462
|
-
}
|
|
7463
|
-
}
|
|
7464
|
-
}),
|
|
7465
|
-
faqList: states_objectSpread(states_objectSpread({
|
|
7466
|
-
category: categoryKeys.faq,
|
|
7467
|
-
headingText: 'FAQ list',
|
|
7468
|
-
description: ''
|
|
7469
|
-
}, baseState), {}, {
|
|
7470
|
-
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7471
|
-
showFaq: true
|
|
7472
|
-
}),
|
|
7473
|
-
serviceData: {
|
|
7474
|
-
suggestion: {
|
|
7475
|
-
body: [{
|
|
7476
|
-
id: 1,
|
|
7477
|
-
question: 'Lorem ipsum dolor sit amet',
|
|
7478
|
-
categories: ['short']
|
|
7479
|
-
}, {
|
|
7480
|
-
id: 2,
|
|
7481
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
7482
|
-
categories: ['short']
|
|
7483
|
-
}, {
|
|
7484
|
-
id: 3,
|
|
7485
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
|
|
7486
|
-
categories: ['short']
|
|
7487
|
-
}]
|
|
7488
|
-
}
|
|
7489
|
-
}
|
|
7490
|
-
}),
|
|
7491
|
-
faqListLong: states_objectSpread(states_objectSpread({
|
|
7492
|
-
category: categoryKeys.faq,
|
|
7493
|
-
headingText: 'Long FAQ list',
|
|
7494
|
-
description: ''
|
|
7495
|
-
}, baseState), {}, {
|
|
7496
|
-
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7497
|
-
showFaq: true
|
|
7498
|
-
}),
|
|
7499
|
-
serviceData: {
|
|
7500
|
-
suggestion: {
|
|
7501
|
-
body: [{
|
|
7502
|
-
id: 1,
|
|
7503
|
-
question: 'Lorem ipsum dolor sit amet',
|
|
7504
|
-
categories: ['long']
|
|
7505
|
-
}, {
|
|
7506
|
-
id: 2,
|
|
7507
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
7508
|
-
categories: ['long']
|
|
7509
|
-
}, {
|
|
7510
|
-
id: 3,
|
|
7511
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
|
|
7512
|
-
categories: ['long']
|
|
7513
|
-
}, {
|
|
7514
|
-
id: 4,
|
|
7515
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
|
|
7516
|
-
categories: ['long']
|
|
7517
|
-
}, {
|
|
7518
|
-
id: 5,
|
|
7519
|
-
question: 'Lorem ipsum dolor sit amet',
|
|
7520
|
-
categories: ['long']
|
|
7521
|
-
}, {
|
|
7522
|
-
id: 6,
|
|
7523
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
7524
|
-
categories: ['long']
|
|
7525
|
-
}, {
|
|
7526
|
-
id: 7,
|
|
7527
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
|
|
7528
|
-
categories: ['long']
|
|
7529
|
-
}, {
|
|
7530
|
-
id: 8,
|
|
7531
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
|
|
7532
|
-
categories: ['long']
|
|
7533
|
-
}, {
|
|
7534
|
-
id: 9,
|
|
7535
|
-
question: 'Lorem ipsum dolor sit amet',
|
|
7536
|
-
categories: ['long']
|
|
7537
|
-
}, {
|
|
7538
|
-
id: 10,
|
|
7539
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
7540
|
-
categories: ['long']
|
|
7541
|
-
}, {
|
|
7542
|
-
id: 11,
|
|
7543
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
|
|
7544
|
-
categories: ['long']
|
|
7545
|
-
}, {
|
|
7546
|
-
id: 12,
|
|
7547
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
|
|
7548
|
-
categories: ['long']
|
|
7549
|
-
}, {
|
|
7550
|
-
id: 13,
|
|
7551
|
-
question: 'Lorem ipsum dolor sit amet',
|
|
7552
|
-
categories: ['long']
|
|
7553
|
-
}, {
|
|
7554
|
-
id: 14,
|
|
7555
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
7556
|
-
categories: ['long']
|
|
7557
|
-
}, {
|
|
7558
|
-
id: 15,
|
|
7559
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
|
|
7560
|
-
categories: ['long']
|
|
7561
|
-
}, {
|
|
7562
|
-
id: 16,
|
|
7563
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
|
|
7564
|
-
categories: ['long']
|
|
7565
|
-
}, {
|
|
7566
|
-
id: 17,
|
|
7567
|
-
question: 'Lorem ipsum dolor sit amet',
|
|
7568
|
-
categories: ['long']
|
|
7569
|
-
}, {
|
|
7570
|
-
id: 18,
|
|
7571
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
7572
|
-
categories: ['long']
|
|
7573
|
-
}, {
|
|
7574
|
-
id: 19,
|
|
7575
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
|
|
7576
|
-
categories: ['long']
|
|
7577
|
-
}, {
|
|
7578
|
-
id: 20,
|
|
7579
|
-
question: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed',
|
|
7580
|
-
categories: ['long']
|
|
7581
|
-
}]
|
|
7582
|
-
}
|
|
7583
|
-
}
|
|
7584
|
-
}),
|
|
7585
7475
|
translationsAvailable: states_objectSpread(states_objectSpread({
|
|
7586
7476
|
category: categoryKeys.translations,
|
|
7587
7477
|
headingText: 'Show translations available',
|
|
@@ -7605,9 +7495,6 @@ const standardState = {
|
|
|
7605
7495
|
}, baseState), {}, {
|
|
7606
7496
|
options: states_objectSpread(states_objectSpread({}, baseState.options), {}, {
|
|
7607
7497
|
features: {
|
|
7608
|
-
cobrowsing: {
|
|
7609
|
-
enabled: true
|
|
7610
|
-
},
|
|
7611
7498
|
sendTranscript: {
|
|
7612
7499
|
enabled: true
|
|
7613
7500
|
}
|
|
@@ -7670,6 +7557,73 @@ const standardState = {
|
|
|
7670
7557
|
})
|
|
7671
7558
|
})
|
|
7672
7559
|
};
|
|
7560
|
+
const inlineInterface = {
|
|
7561
|
+
minimizedInline: {
|
|
7562
|
+
category: categoryKeys.minimizedInline,
|
|
7563
|
+
headingText: 'Inline minimized',
|
|
7564
|
+
description: '',
|
|
7565
|
+
inline: states_objectSpread(states_objectSpread({}, baseState), {}, {
|
|
7566
|
+
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7567
|
+
layoutMode: 'inline'
|
|
7568
|
+
}),
|
|
7569
|
+
visibility: states_objectSpread(states_objectSpread({}, baseState.visibility), {}, {
|
|
7570
|
+
visibility: web_ui_namespaceObject.visibilityStates.minimized
|
|
7571
|
+
})
|
|
7572
|
+
})
|
|
7573
|
+
},
|
|
7574
|
+
minimizedInlinePrechat: {
|
|
7575
|
+
category: categoryKeys.minimizedInline,
|
|
7576
|
+
headingText: 'Inline minimized with pre-chat messages',
|
|
7577
|
+
description: '',
|
|
7578
|
+
inline: states_objectSpread(states_objectSpread({}, baseState), {}, {
|
|
7579
|
+
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7580
|
+
layoutMode: 'inline',
|
|
7581
|
+
preChatEvents: [splashMessage]
|
|
7582
|
+
}),
|
|
7583
|
+
visibility: states_objectSpread(states_objectSpread({}, baseState.visibility), {}, {
|
|
7584
|
+
visibility: web_ui_namespaceObject.visibilityStates.minimized
|
|
7585
|
+
})
|
|
7586
|
+
})
|
|
7587
|
+
},
|
|
7588
|
+
minimizedInlinePrechatSuggestions: {
|
|
7589
|
+
category: categoryKeys.minimizedInline,
|
|
7590
|
+
headingText: 'Inline minimized with pre-chat messages & suggestions',
|
|
7591
|
+
description: '',
|
|
7592
|
+
inline: states_objectSpread(states_objectSpread({}, baseState), {}, {
|
|
7593
|
+
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7594
|
+
layoutMode: 'inline',
|
|
7595
|
+
preChatEvents: [splashMessage]
|
|
7596
|
+
}),
|
|
7597
|
+
serviceData: {
|
|
7598
|
+
suggestion: {
|
|
7599
|
+
body: suggestions
|
|
7600
|
+
}
|
|
7601
|
+
},
|
|
7602
|
+
visibility: states_objectSpread(states_objectSpread({}, baseState.visibility), {}, {
|
|
7603
|
+
visibility: web_ui_namespaceObject.visibilityStates.minimized
|
|
7604
|
+
})
|
|
7605
|
+
})
|
|
7606
|
+
},
|
|
7607
|
+
inlineWithSuggestions: {
|
|
7608
|
+
category: categoryKeys.suggestions,
|
|
7609
|
+
headingText: 'Suggestions',
|
|
7610
|
+
description: '',
|
|
7611
|
+
inline: states_objectSpread(states_objectSpread({}, baseState), {}, {
|
|
7612
|
+
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7613
|
+
layoutMode: 'inline',
|
|
7614
|
+
showFaq: true
|
|
7615
|
+
}),
|
|
7616
|
+
visibility: states_objectSpread(states_objectSpread({}, baseState.visibility), {}, {
|
|
7617
|
+
visibility: web_ui_namespaceObject.visibilityStates.open
|
|
7618
|
+
}),
|
|
7619
|
+
serviceData: {
|
|
7620
|
+
suggestion: {
|
|
7621
|
+
body: suggestions
|
|
7622
|
+
}
|
|
7623
|
+
}
|
|
7624
|
+
})
|
|
7625
|
+
}
|
|
7626
|
+
};
|
|
7673
7627
|
|
|
7674
7628
|
const buildStandardState = (layoutModes, customComponentEventBodies = []) => {
|
|
7675
7629
|
const intermediateState = states_objectSpread(states_objectSpread({}, standardState), customComponentEventBodies.reduce((acc, eventBody) => {
|
|
@@ -7716,9 +7670,9 @@ const buildStandardState = (layoutModes, customComponentEventBodies = []) => {
|
|
|
7716
7670
|
}, {});
|
|
7717
7671
|
};
|
|
7718
7672
|
|
|
7719
|
-
const getStateObj = (layoutModes, customComponentEventBodies) => states_objectSpread(states_objectSpread({}, buildStandardState(layoutModes, customComponentEventBodies)), layoutModes.indexOf('window') !== -1 ? {
|
|
7720
|
-
|
|
7721
|
-
category: categoryKeys.
|
|
7673
|
+
const getStateObj = (layoutModes, customComponentEventBodies) => states_objectSpread(states_objectSpread(states_objectSpread({}, buildStandardState(layoutModes, customComponentEventBodies)), layoutModes.indexOf('window') !== -1 ? {
|
|
7674
|
+
minimizedWindow: {
|
|
7675
|
+
category: categoryKeys.minimizedWindow,
|
|
7722
7676
|
headingText: 'Unstarted minimized',
|
|
7723
7677
|
description: '',
|
|
7724
7678
|
window: states_objectSpread(states_objectSpread({}, baseState), {}, {
|
|
@@ -7730,8 +7684,8 @@ const getStateObj = (layoutModes, customComponentEventBodies) => states_objectSp
|
|
|
7730
7684
|
})
|
|
7731
7685
|
})
|
|
7732
7686
|
},
|
|
7733
|
-
|
|
7734
|
-
category: categoryKeys.
|
|
7687
|
+
minimizedWindowStarted: {
|
|
7688
|
+
category: categoryKeys.minimizedWindow,
|
|
7735
7689
|
headingText: 'Started minimized',
|
|
7736
7690
|
description: '',
|
|
7737
7691
|
window: states_objectSpread(states_objectSpread({}, baseState), {}, {
|
|
@@ -7745,8 +7699,8 @@ const getStateObj = (layoutModes, customComponentEventBodies) => states_objectSp
|
|
|
7745
7699
|
headerTitles
|
|
7746
7700
|
})
|
|
7747
7701
|
},
|
|
7748
|
-
|
|
7749
|
-
category: categoryKeys.
|
|
7702
|
+
minimizedWindowStartedUnread: {
|
|
7703
|
+
category: categoryKeys.minimizedWindow,
|
|
7750
7704
|
headingText: 'Minimized with unread messages',
|
|
7751
7705
|
description: '',
|
|
7752
7706
|
window: states_objectSpread(states_objectSpread({}, baseState), {}, {
|
|
@@ -7760,8 +7714,24 @@ const getStateObj = (layoutModes, customComponentEventBodies) => states_objectSp
|
|
|
7760
7714
|
headerTitles,
|
|
7761
7715
|
unreadEvents: 12
|
|
7762
7716
|
})
|
|
7717
|
+
},
|
|
7718
|
+
minimizedWindowPrechat: {
|
|
7719
|
+
category: categoryKeys.minimizedWindow,
|
|
7720
|
+
headingText: 'Minimized with pre-chat messages',
|
|
7721
|
+
description: '',
|
|
7722
|
+
window: states_objectSpread(states_objectSpread({}, baseState), {}, {
|
|
7723
|
+
config: states_objectSpread(states_objectSpread({}, baseState.config), {}, {
|
|
7724
|
+
layoutMode: 'window',
|
|
7725
|
+
preChatEvents: [splashMessage]
|
|
7726
|
+
}),
|
|
7727
|
+
visibility: states_objectSpread(states_objectSpread({}, baseState.visibility), {}, {
|
|
7728
|
+
visibility: web_ui_namespaceObject.visibilityStates.minimized
|
|
7729
|
+
}),
|
|
7730
|
+
participantInfo,
|
|
7731
|
+
headerTitles
|
|
7732
|
+
})
|
|
7763
7733
|
}
|
|
7764
|
-
} : {});
|
|
7734
|
+
} : {}), inlineInterface);
|
|
7765
7735
|
;// CONCATENATED MODULE: ./src/javascripts/style-guide/components/links.js
|
|
7766
7736
|
const links_excluded = ["headingText", "descriptionId", "description"];
|
|
7767
7737
|
|
|
@@ -7906,7 +7876,7 @@ const StyleGuideApp = ({
|
|
|
7906
7876
|
customMessageEventBodies
|
|
7907
7877
|
} = styleGuideConfig;
|
|
7908
7878
|
const [mainState] = (0,hooks_namespaceObject.useState)(() => {
|
|
7909
|
-
const mainStateObj = getStateObj(styleGuideConfig.showLayoutModes || ['inline', 'window'
|
|
7879
|
+
const mainStateObj = getStateObj(styleGuideConfig.showLayoutModes || ['inline', 'window'], customMessageEventBodies);
|
|
7910
7880
|
return Object.keys(mainStateObj).reduce((acc, key) => app_objectSpread(app_objectSpread({}, acc), {}, {
|
|
7911
7881
|
[key]: app_objectSpread(app_objectSpread({}, mainStateObj[key]), {}, {
|
|
7912
7882
|
descriptionId: (0,web_ui_namespaceObject.randomId)()
|