@seamly/web-ui 20.1.0-alpha.1 → 20.2.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/lib/deprecated-view.css +1 -1
- package/build/dist/lib/index.debug.js +135 -135
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.js +107 -48
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +107 -48
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +53 -28
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles-default-implementation.css +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +2 -2
- package/src/javascripts/api/errors/seamly-base-error.js +1 -0
- package/src/javascripts/api/index.js +26 -20
- package/src/javascripts/api/producer.js +3 -3
- package/src/javascripts/domains/app/actions.js +17 -8
- package/src/javascripts/domains/app/hooks.js +1 -1
- package/src/javascripts/domains/app/utils.js +1 -1
- package/src/javascripts/domains/config/hooks.js +1 -1
- package/src/javascripts/domains/config/reducer.js +3 -3
- package/src/javascripts/domains/config/selectors.js +1 -1
- package/src/javascripts/domains/config/utils.js +1 -1
- package/src/javascripts/domains/errors/index.js +2 -2
- package/src/javascripts/domains/forms/hooks.js +1 -1
- package/src/javascripts/domains/forms/provider.js +5 -3
- package/src/javascripts/domains/forms/reducer.js +1 -1
- package/src/javascripts/domains/forms/selectors.js +1 -1
- package/src/javascripts/domains/forms/utils.js +1 -1
- package/src/javascripts/domains/i18n/actions.js +1 -1
- package/src/javascripts/domains/i18n/hooks.js +1 -1
- package/src/javascripts/domains/i18n/reducer.js +1 -1
- package/src/javascripts/domains/i18n/utils.js +1 -1
- package/src/javascripts/domains/interrupt/hooks.js +2 -2
- package/src/javascripts/domains/interrupt/middleware.js +6 -6
- package/src/javascripts/domains/interrupt/reducer.js +1 -1
- package/src/javascripts/domains/interrupt/utils.js +1 -1
- package/src/javascripts/domains/options/middleware.js +1 -1
- package/src/javascripts/domains/store/index.js +10 -10
- package/src/javascripts/domains/store/state-reducer.js +3 -3
- package/src/javascripts/domains/translations/components/chat-status.js +5 -5
- package/src/javascripts/domains/translations/components/options-button.js +6 -6
- package/src/javascripts/domains/translations/components/options-dialog/form.js +5 -5
- package/src/javascripts/domains/translations/components/options-dialog/index.js +7 -7
- package/src/javascripts/domains/translations/hooks.js +3 -3
- package/src/javascripts/domains/translations/middleware.js +2 -2
- package/src/javascripts/domains/translations/reducer.js +3 -3
- package/src/javascripts/domains/translations/selectors.js +1 -1
- package/src/javascripts/domains/translations/utils.js +1 -1
- package/src/javascripts/domains/visibility/actions.js +3 -3
- package/src/javascripts/domains/visibility/hooks.js +1 -1
- package/src/javascripts/domains/visibility/utils.js +7 -1
- package/src/javascripts/lib/css.js +1 -1
- package/src/javascripts/lib/engine/index.js +6 -5
- package/src/javascripts/lib/external-api/index.js +28 -2
- package/src/javascripts/lib/redux-helpers/index.js +1 -1
- package/src/javascripts/style-guide/components/app.js +1 -1
- package/src/javascripts/style-guide/components/links.js +1 -1
- package/src/javascripts/style-guide/components/static-core.js +8 -8
- package/src/javascripts/ui/components/app-options/index.js +4 -4
- package/src/javascripts/ui/components/chat-status/index.js +2 -2
- package/src/javascripts/ui/components/conversation/component-filter.js +1 -1
- package/src/javascripts/ui/components/conversation/conversation.js +6 -6
- package/src/javascripts/ui/components/conversation/event/card-component.js +4 -4
- package/src/javascripts/ui/components/conversation/event/card-message.js +3 -3
- package/src/javascripts/ui/components/conversation/event/carousel-component/components/controls.js +3 -3
- package/src/javascripts/ui/components/conversation/event/carousel-component/components/pagination.js +1 -1
- package/src/javascripts/ui/components/conversation/event/carousel-component/index.js +3 -3
- package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js +3 -3
- package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +3 -3
- package/src/javascripts/ui/components/conversation/event/choice-prompt.js +7 -7
- package/src/javascripts/ui/components/conversation/event/cta.js +6 -6
- package/src/javascripts/ui/components/conversation/event/divider/index.js +1 -1
- package/src/javascripts/ui/components/conversation/event/divider/variants/default.js +3 -3
- package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +4 -4
- package/src/javascripts/ui/components/conversation/event/divider/variants/time-indicator.js +5 -5
- package/src/javascripts/ui/components/conversation/event/event-participant.js +4 -4
- package/src/javascripts/ui/components/conversation/event/event.js +2 -2
- package/src/javascripts/ui/components/conversation/event/hooks/use-event-link-click-handler.js +2 -2
- package/src/javascripts/ui/components/conversation/event/hooks/use-formatted-date.js +3 -3
- package/src/javascripts/ui/components/conversation/event/image-lightbox.js +4 -4
- package/src/javascripts/ui/components/conversation/event/image.js +2 -2
- package/src/javascripts/ui/components/conversation/event/participant.js +4 -4
- package/src/javascripts/ui/components/conversation/event/text.js +3 -3
- package/src/javascripts/ui/components/conversation/event/translation.js +3 -3
- package/src/javascripts/ui/components/conversation/event/upload.js +5 -5
- package/src/javascripts/ui/components/conversation/event/video.js +4 -4
- package/src/javascripts/ui/components/conversation/event-divider.js +2 -2
- package/src/javascripts/ui/components/conversation/loader.js +2 -2
- package/src/javascripts/ui/components/conversation/message-container.js +4 -4
- package/src/javascripts/ui/components/core/seamly-activity-monitor.js +3 -3
- package/src/javascripts/ui/components/core/seamly-core.js +2 -2
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +8 -8
- package/src/javascripts/ui/components/core/seamly-file-upload.js +4 -4
- package/src/javascripts/ui/components/core/seamly-idle-detach-counter.js +2 -2
- package/src/javascripts/ui/components/core/seamly-initializer.js +2 -2
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +5 -5
- package/src/javascripts/ui/components/core/seamly-live-region.js +2 -2
- package/src/javascripts/ui/components/core/seamly-new-notifications.js +5 -5
- package/src/javascripts/ui/components/core/seamly-read-state.js +6 -6
- package/src/javascripts/ui/components/entry/deprecated-toggle-button.js +5 -5
- package/src/javascripts/ui/components/entry/entry-container.js +8 -8
- package/src/javascripts/ui/components/entry/text-entry/hooks.js +6 -6
- package/src/javascripts/ui/components/entry/text-entry/index.js +2 -2
- package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +8 -8
- package/src/javascripts/ui/components/entry/upload/file-upload-form.js +5 -5
- package/src/javascripts/ui/components/entry/upload/index.js +10 -10
- package/src/javascripts/ui/components/entry/upload-toggle.js +9 -9
- package/src/javascripts/ui/components/faq/faq.js +16 -16
- package/src/javascripts/ui/components/form-controls/error.js +2 -2
- package/src/javascripts/ui/components/form-controls/file-input.js +4 -4
- package/src/javascripts/ui/components/form-controls/form.js +2 -2
- package/src/javascripts/ui/components/form-controls/input.js +1 -1
- package/src/javascripts/ui/components/form-controls/select.js +1 -1
- package/src/javascripts/ui/components/form-controls/wrapper.js +1 -1
- package/src/javascripts/ui/components/layout/agent-info.js +6 -6
- package/src/javascripts/ui/components/layout/chat-frame.js +5 -5
- package/src/javascripts/ui/components/layout/deprecated-app-frame.js +7 -7
- package/src/javascripts/ui/components/layout/header.js +3 -3
- package/src/javascripts/ui/components/layout/icon.js +1 -1
- package/src/javascripts/ui/components/layout/interrupt.js +3 -3
- package/src/javascripts/ui/components/layout/privacy-disclaimer.js +3 -3
- package/src/javascripts/ui/components/options/options-button.js +7 -12
- package/src/javascripts/ui/components/options/options-frame.js +4 -4
- package/src/javascripts/ui/components/options/options.js +1 -1
- package/src/javascripts/ui/components/options/transcript/index.js +8 -8
- package/src/javascripts/ui/components/options/transcript/transcript-form.js +4 -4
- package/src/javascripts/ui/components/warnings/idle-detach-warning.js +6 -6
- package/src/javascripts/ui/components/warnings/prompt.js +2 -2
- package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +5 -5
- package/src/javascripts/ui/components/widgets/in-out-transition.js +3 -3
- package/src/javascripts/ui/components/widgets/lightbox.js +5 -5
- package/src/javascripts/ui/components/widgets/modal.js +2 -2
- package/src/javascripts/ui/components/widgets/upload-progress.js +4 -4
- package/src/javascripts/ui/hooks/component-helper-hooks.js +1 -1
- package/src/javascripts/ui/hooks/file-upload-hooks.js +2 -2
- package/src/javascripts/ui/hooks/focus-helper-hooks.js +2 -2
- package/src/javascripts/ui/hooks/live-region-hooks.js +2 -2
- package/src/javascripts/ui/hooks/seamly-api-hooks.js +1 -1
- package/src/javascripts/ui/hooks/seamly-entry-hooks.js +2 -2
- package/src/javascripts/ui/hooks/seamly-option-hooks.js +2 -2
- package/src/javascripts/ui/hooks/seamly-state-hooks.js +5 -5
- package/src/javascripts/ui/hooks/use-event-component-mapping.js +2 -2
- package/src/javascripts/ui/hooks/use-seamly-activity-event-handler.js +1 -1
- package/src/javascripts/ui/hooks/use-seamly-chat.js +3 -3
- package/src/javascripts/ui/hooks/use-seamly-commands.js +9 -9
- package/src/javascripts/ui/hooks/use-seamly-dispatch.js +1 -1
- package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +5 -5
- package/src/javascripts/ui/hooks/use-seamly-resume-conversation-prompt.js +2 -2
- package/src/javascripts/ui/hooks/use-single-file-upload.js +2 -2
- package/src/javascripts/ui/hooks/utility-hooks.js +1 -1
- package/src/stylesheets/4-base/_formelements.scss +3 -3
- package/src/stylesheets/5-components/_buttons.scss +1 -1
- package/src/stylesheets/5-components/_chat-status.scss +4 -0
- package/src/stylesheets/5-components/_input.scss +2 -2
- package/src/stylesheets/5-components/_message-translation-info.scss +4 -0
- package/src/stylesheets/6-default-implementation/_hover.scss +5 -5
- package/src/stylesheets/7-deprecated/4-base/_formelements.scss +4 -4
- package/src/stylesheets/7-deprecated/5-components/_buttons.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_input.scss +1 -1
- package/src/stylesheets/7-deprecated/5-components/_message.scss +4 -0
- package/src/stylesheets/7-deprecated/5-components/_options.scss +2 -2
- package/webpack/config.common.js +5 -0
- package/webpack/config.package.js +10 -0
- package/src/.DS_Store +0 -0
|
@@ -16964,6 +16964,29 @@ const setLocale = i18n_utils_createThunk('setLocale', async (locale, {
|
|
|
16964
16964
|
return api.getTranslations(locale);
|
|
16965
16965
|
});
|
|
16966
16966
|
});
|
|
16967
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
16968
|
+
|
|
16969
|
+
const {
|
|
16970
|
+
createActions: utils_createActions,
|
|
16971
|
+
createReducer: translations_utils_createReducer,
|
|
16972
|
+
selectState: translations_utils_selectState
|
|
16973
|
+
} = createDomain('translations');
|
|
16974
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
16975
|
+
|
|
16976
|
+
const [enable, disable] = utils_createActions('translate', {
|
|
16977
|
+
enable: locale => ({
|
|
16978
|
+
locale
|
|
16979
|
+
}),
|
|
16980
|
+
disable: () => ({})
|
|
16981
|
+
});
|
|
16982
|
+
const [enableEvent, disableEvent] = utils_createActions('event', {
|
|
16983
|
+
enable: payloadId => ({
|
|
16984
|
+
payloadId
|
|
16985
|
+
}),
|
|
16986
|
+
disable: payloadId => ({
|
|
16987
|
+
payloadId
|
|
16988
|
+
})
|
|
16989
|
+
});
|
|
16967
16990
|
;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
|
|
16968
16991
|
|
|
16969
16992
|
const {
|
|
@@ -16982,7 +17005,7 @@ const selectUserHasResponded = createSelector(app_utils_selectState, state => st
|
|
|
16982
17005
|
|
|
16983
17006
|
const {
|
|
16984
17007
|
createAction: visibility_utils_createAction,
|
|
16985
|
-
createActions:
|
|
17008
|
+
createActions: visibility_utils_createActions,
|
|
16986
17009
|
createThunk: visibility_utils_createThunk,
|
|
16987
17010
|
createReducer: visibility_utils_createReducer,
|
|
16988
17011
|
selectState: visibility_utils_selectState
|
|
@@ -17004,6 +17027,12 @@ const calculateVisibility = ({
|
|
|
17004
17027
|
|
|
17005
17028
|
if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
|
|
17006
17029
|
return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
|
|
17030
|
+
} // Allow users to continue a conversation (if they have responded and no visibility is requested)
|
|
17031
|
+
// when switching from the window layout to the inline layout
|
|
17032
|
+
|
|
17033
|
+
|
|
17034
|
+
if (layoutMode === 'inline' && hasResponded && !requestedVisibility) {
|
|
17035
|
+
return previousVisibility || visibilityStates.open;
|
|
17007
17036
|
}
|
|
17008
17037
|
|
|
17009
17038
|
const baseVisibility = visibilityStates.minimized;
|
|
@@ -17272,6 +17301,7 @@ class SeamlyBaseError extends Error {
|
|
|
17272
17301
|
if (originalError !== null && originalError !== void 0 && originalError.payload) {
|
|
17273
17302
|
this.originalEvent = originalError;
|
|
17274
17303
|
this.originalError = originalError.payload.error;
|
|
17304
|
+
this.message = `Event of type ${originalError.payload.type} encountered`;
|
|
17275
17305
|
}
|
|
17276
17306
|
|
|
17277
17307
|
if (originalError !== null && originalError !== void 0 && originalError.error) {
|
|
@@ -17313,6 +17343,8 @@ const clear = interrupt_utils_createAction('clear');
|
|
|
17313
17343
|
|
|
17314
17344
|
|
|
17315
17345
|
|
|
17346
|
+
|
|
17347
|
+
|
|
17316
17348
|
const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
|
|
17317
17349
|
hasResponded
|
|
17318
17350
|
}));
|
|
@@ -17355,7 +17387,7 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
17355
17387
|
|
|
17356
17388
|
if (agentParticipant !== null && agentParticipant !== void 0 && agentParticipant.name) {
|
|
17357
17389
|
dispatch({
|
|
17358
|
-
type: seamlyActions.
|
|
17390
|
+
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
17359
17391
|
title: agentParticipant.name
|
|
17360
17392
|
});
|
|
17361
17393
|
}
|
|
@@ -17364,6 +17396,8 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
17364
17396
|
}
|
|
17365
17397
|
|
|
17366
17398
|
try {
|
|
17399
|
+
var _config$context2;
|
|
17400
|
+
|
|
17367
17401
|
if (api.hasConversation()) {
|
|
17368
17402
|
var _initialState$transla;
|
|
17369
17403
|
|
|
@@ -17377,6 +17411,16 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
17377
17411
|
if ('userResponded' in initialState) {
|
|
17378
17412
|
dispatch(setHasResponded(initialState.userResponded));
|
|
17379
17413
|
}
|
|
17414
|
+
} else if (config !== null && config !== void 0 && (_config$context2 = config.context) !== null && _config$context2 !== void 0 && _config$context2.translationLocale) {
|
|
17415
|
+
locale = config.context.translationLocale;
|
|
17416
|
+
api.send('action', {
|
|
17417
|
+
type: actionTypes.setTranslation,
|
|
17418
|
+
body: {
|
|
17419
|
+
enabled: true,
|
|
17420
|
+
locale
|
|
17421
|
+
}
|
|
17422
|
+
});
|
|
17423
|
+
dispatch(enable(locale));
|
|
17380
17424
|
}
|
|
17381
17425
|
} catch (e) {
|
|
17382
17426
|
if (e instanceof SeamlySessionExpiredError) {
|
|
@@ -19741,29 +19785,6 @@ const app_reducer_initialState = {
|
|
|
19741
19785
|
|
|
19742
19786
|
|
|
19743
19787
|
|
|
19744
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
19745
|
-
|
|
19746
|
-
const {
|
|
19747
|
-
createActions: translations_utils_createActions,
|
|
19748
|
-
createReducer: translations_utils_createReducer,
|
|
19749
|
-
selectState: translations_utils_selectState
|
|
19750
|
-
} = createDomain('translations');
|
|
19751
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
19752
|
-
|
|
19753
|
-
const [enable, disable] = translations_utils_createActions('translate', {
|
|
19754
|
-
enable: locale => ({
|
|
19755
|
-
locale
|
|
19756
|
-
}),
|
|
19757
|
-
disable: () => ({})
|
|
19758
|
-
});
|
|
19759
|
-
const [enableEvent, disableEvent] = translations_utils_createActions('event', {
|
|
19760
|
-
enable: payloadId => ({
|
|
19761
|
-
payloadId
|
|
19762
|
-
}),
|
|
19763
|
-
disable: payloadId => ({
|
|
19764
|
-
payloadId
|
|
19765
|
-
})
|
|
19766
|
-
});
|
|
19767
19788
|
;// CONCATENATED MODULE: ./src/javascripts/domains/redux/utils.js
|
|
19768
19789
|
|
|
19769
19790
|
|
|
@@ -20577,10 +20598,14 @@ function FormProvider(_ref) {
|
|
|
20577
20598
|
});
|
|
20578
20599
|
}, [setExternalErrors]);
|
|
20579
20600
|
const handleSubmit = hooks_module_A(e => {
|
|
20580
|
-
|
|
20581
|
-
|
|
20601
|
+
var _e$submitter;
|
|
20602
|
+
|
|
20603
|
+
e.preventDefault(); // If the submitter is set to being aria-disabled, block the submit action
|
|
20582
20604
|
|
|
20583
|
-
|
|
20605
|
+
const ariaDisabled = ((_e$submitter = e.submitter) === null || _e$submitter === void 0 ? void 0 : _e$submitter.ariaDisabled) === 'true';
|
|
20606
|
+
setIsSubmitted(!ariaDisabled);
|
|
20607
|
+
|
|
20608
|
+
if (!ariaDisabled && validationIsValid) {
|
|
20584
20609
|
onSubmit(values, {
|
|
20585
20610
|
updateControlValue,
|
|
20586
20611
|
setError
|
|
@@ -28878,7 +28903,7 @@ function TextEntryForm({
|
|
|
28878
28903
|
}), jsxRuntime_module_e("button", {
|
|
28879
28904
|
className: css_className('button', 'input__submit'),
|
|
28880
28905
|
type: "submit",
|
|
28881
|
-
disabled: !hasValue || reachedCharacterLimit,
|
|
28906
|
+
"aria-disabled": !hasValue || reachedCharacterLimit ? 'true' : null,
|
|
28882
28907
|
children: jsxRuntime_module_e(icon, {
|
|
28883
28908
|
name: "send",
|
|
28884
28909
|
size: "32",
|
|
@@ -29019,9 +29044,9 @@ const UploadToggle = () => {
|
|
|
29019
29044
|
children: jsxRuntime_module_e("button", {
|
|
29020
29045
|
className: css_className(['button', 'button--secondary', 'upload-toggle']),
|
|
29021
29046
|
ref: uploadButton,
|
|
29022
|
-
disabled: !showUploadButton ? 'true' : null,
|
|
29047
|
+
"aria-disabled": !showUploadButton ? 'true' : null,
|
|
29023
29048
|
type: "button",
|
|
29024
|
-
onClick: onClickHandler,
|
|
29049
|
+
onClick: showUploadButton ? onClickHandler : null,
|
|
29025
29050
|
children: jsxRuntime_module_e(icon, {
|
|
29026
29051
|
name: "file",
|
|
29027
29052
|
size: "32",
|
|
@@ -29896,7 +29921,7 @@ const OptionsButton = () => {
|
|
|
29896
29921
|
ref: item => {
|
|
29897
29922
|
menuItemButtons.current[i] = item;
|
|
29898
29923
|
},
|
|
29899
|
-
className: css_className(['button', 'button--secondary'
|
|
29924
|
+
className: css_className(['button', 'button--secondary']),
|
|
29900
29925
|
onKeyDown: e => onMenuItemKeyDownHandler(e, i),
|
|
29901
29926
|
onKeyPress: e => onKeyPressHandler(e, i),
|
|
29902
29927
|
onClick: () => onMenuItemClickHandler(name, available),
|
|
@@ -29913,7 +29938,7 @@ const OptionsButton = () => {
|
|
|
29913
29938
|
})
|
|
29914
29939
|
}), jsxRuntime_module_e("button", {
|
|
29915
29940
|
type: "button",
|
|
29916
|
-
className: css_className(['button', 'button--secondary', 'chat__options__button', ...(!multiMenu && firstOptionName ? [`chat__options__button--${firstOptionName}`] : [])
|
|
29941
|
+
className: css_className(['button', 'button--secondary', 'chat__options__button', ...(!multiMenu && firstOptionName ? [`chat__options__button--${firstOptionName}`] : [])]),
|
|
29917
29942
|
id: id,
|
|
29918
29943
|
onClick: onClickHandler,
|
|
29919
29944
|
onKeyDown: multiMenu ? onButtonKeyDownHandler : null,
|
|
@@ -33272,15 +33297,6 @@ function getTimeZone() {
|
|
|
33272
33297
|
}
|
|
33273
33298
|
}
|
|
33274
33299
|
|
|
33275
|
-
function getEnvironment() {
|
|
33276
|
-
return {
|
|
33277
|
-
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
33278
|
-
userAgent: navigator.userAgent,
|
|
33279
|
-
currentUrl: window.location.toString(),
|
|
33280
|
-
timezone: getTimeZone()
|
|
33281
|
-
};
|
|
33282
|
-
}
|
|
33283
|
-
|
|
33284
33300
|
class API {
|
|
33285
33301
|
/**
|
|
33286
33302
|
* Creates an instance of API.
|
|
@@ -33290,14 +33306,17 @@ class API {
|
|
|
33290
33306
|
* @param {string} config.secure Connect securely
|
|
33291
33307
|
* @param {string} config.externalId Unique visitor identifier (optional)
|
|
33292
33308
|
* @param {boolean} config.sendEnvironment
|
|
33309
|
+
* @param {string} layoutMode
|
|
33293
33310
|
* @param {string} namespace
|
|
33294
|
-
* @param {Object} [context={ channelName: undefined, variables: undefined, locale: undefined }]
|
|
33311
|
+
* @param {Object} [context={ channelName: undefined, variables: undefined, locale: undefined, translationLocale: undefined }]
|
|
33295
33312
|
* @param {string} context.channelName
|
|
33296
33313
|
* @param {object} context.variables
|
|
33297
33314
|
* @param {string} context.locale
|
|
33315
|
+
* @param {string} context.translationLocale
|
|
33298
33316
|
* @memberof API
|
|
33299
33317
|
*/
|
|
33300
33318
|
constructor({
|
|
33319
|
+
layoutMode,
|
|
33301
33320
|
namespace,
|
|
33302
33321
|
config = {},
|
|
33303
33322
|
context = {}
|
|
@@ -33319,6 +33338,7 @@ class API {
|
|
|
33319
33338
|
this.connected = false;
|
|
33320
33339
|
this.configReady = false;
|
|
33321
33340
|
this.externalId = config.externalId;
|
|
33341
|
+
this.layoutMode = layoutMode;
|
|
33322
33342
|
this.internalProducer = new EventProducer('API');
|
|
33323
33343
|
this.internal$ = xstream_default().create(this.internalProducer).flatten();
|
|
33324
33344
|
this.connection$ = filter_default()(_context = this.internal$).call(_context, event => event.type === 'connection');
|
|
@@ -33445,7 +33465,7 @@ class API {
|
|
|
33445
33465
|
v: apiVersion
|
|
33446
33466
|
}).send({
|
|
33447
33467
|
context: api_objectSpread(api_objectSpread({}, this.config.context), {}, {
|
|
33448
|
-
environment: this.config.sendEnvironment === true ? getEnvironment() : this.config.sendEnvironment
|
|
33468
|
+
environment: this.config.sendEnvironment === true ? this.getEnvironment() : this.config.sendEnvironment
|
|
33449
33469
|
})
|
|
33450
33470
|
}).then(({
|
|
33451
33471
|
body
|
|
@@ -33459,7 +33479,7 @@ class API {
|
|
|
33459
33479
|
}
|
|
33460
33480
|
|
|
33461
33481
|
if (error.status >= 500) {
|
|
33462
|
-
throw new SeamlyGeneralError();
|
|
33482
|
+
throw new SeamlyGeneralError(error);
|
|
33463
33483
|
}
|
|
33464
33484
|
|
|
33465
33485
|
throw error;
|
|
@@ -33533,7 +33553,7 @@ class API {
|
|
|
33533
33553
|
|
|
33534
33554
|
if (this.config.sendEnvironment) {
|
|
33535
33555
|
this.send('context', {
|
|
33536
|
-
environment: this.config.sendEnvironment === true ? getEnvironment() : this.config.sendEnvironment
|
|
33556
|
+
environment: this.config.sendEnvironment === true ? this.getEnvironment() : this.config.sendEnvironment
|
|
33537
33557
|
}, false);
|
|
33538
33558
|
}
|
|
33539
33559
|
|
|
@@ -33663,6 +33683,18 @@ class API {
|
|
|
33663
33683
|
return filter_default()(_context5 = this.internal$).call(_context5, event => event.type !== 'connection');
|
|
33664
33684
|
}
|
|
33665
33685
|
|
|
33686
|
+
getEnvironment() {
|
|
33687
|
+
return {
|
|
33688
|
+
clientName: "@seamly/web-ui",
|
|
33689
|
+
clientVariant: this.layoutMode,
|
|
33690
|
+
clientVersion: "20.1.0",
|
|
33691
|
+
currentUrl: window.location.toString(),
|
|
33692
|
+
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
33693
|
+
timezone: getTimeZone(),
|
|
33694
|
+
userAgent: navigator.userAgent
|
|
33695
|
+
};
|
|
33696
|
+
}
|
|
33697
|
+
|
|
33666
33698
|
}
|
|
33667
33699
|
;// CONCATENATED MODULE: ./node_modules/redux-thunk/es/index.js
|
|
33668
33700
|
function createThunkMiddleware(extraArgument) {
|
|
@@ -33869,6 +33901,7 @@ class Engine {
|
|
|
33869
33901
|
this.parentElement = parentElement;
|
|
33870
33902
|
this.externalApi = externalApi;
|
|
33871
33903
|
this.api = new API({
|
|
33904
|
+
layoutMode: config.layoutMode,
|
|
33872
33905
|
namespace: config.namespace,
|
|
33873
33906
|
config: config.api,
|
|
33874
33907
|
context: config.context
|
|
@@ -34000,6 +34033,7 @@ class ExternalApi {
|
|
|
34000
34033
|
this._waitingActions = [];
|
|
34001
34034
|
this._instances = {};
|
|
34002
34035
|
this.appConfig = appConfig;
|
|
34036
|
+
this.context = {};
|
|
34003
34037
|
}
|
|
34004
34038
|
|
|
34005
34039
|
push(...actionObjects) {
|
|
@@ -34030,7 +34064,8 @@ class ExternalApi {
|
|
|
34030
34064
|
break;
|
|
34031
34065
|
|
|
34032
34066
|
default:
|
|
34033
|
-
if (!this.handleAction(actionObj)
|
|
34067
|
+
if (!this.handleAction(actionObj) && // Store context properties for the next instance that will be created
|
|
34068
|
+
!this.setContext(actionObj.action, ...actionObj.args)) {
|
|
34034
34069
|
this._waitingActions.push(actionObj);
|
|
34035
34070
|
}
|
|
34036
34071
|
|
|
@@ -34039,6 +34074,25 @@ class ExternalApi {
|
|
|
34039
34074
|
});
|
|
34040
34075
|
}
|
|
34041
34076
|
|
|
34077
|
+
setContext(action, args) {
|
|
34078
|
+
switch (action) {
|
|
34079
|
+
case 'setTranslation':
|
|
34080
|
+
const {
|
|
34081
|
+
enabled,
|
|
34082
|
+
locale
|
|
34083
|
+
} = args;
|
|
34084
|
+
|
|
34085
|
+
if (!!enabled && locale) {
|
|
34086
|
+
this.context.translationLocale = locale;
|
|
34087
|
+
}
|
|
34088
|
+
|
|
34089
|
+
return true;
|
|
34090
|
+
|
|
34091
|
+
default:
|
|
34092
|
+
return false;
|
|
34093
|
+
}
|
|
34094
|
+
}
|
|
34095
|
+
|
|
34042
34096
|
handleInit(actionObj) {
|
|
34043
34097
|
const userConfig = this.getUserConfig(...actionObj.args);
|
|
34044
34098
|
const config = this.getCombinedConfig(userConfig); // if this.appConfig is a function, it might return an invalid configuration (false, null, undefined)
|
|
@@ -34062,7 +34116,9 @@ class ExternalApi {
|
|
|
34062
34116
|
|
|
34063
34117
|
if (config) {
|
|
34064
34118
|
const instance = this.createInstance(config);
|
|
34065
|
-
this._instances[config.namespace] = instance;
|
|
34119
|
+
this._instances[config.namespace] = instance; // Clear the context after creating the instance, so we do not reuse it for the next
|
|
34120
|
+
|
|
34121
|
+
this.context = {};
|
|
34066
34122
|
instance.render();
|
|
34067
34123
|
}
|
|
34068
34124
|
}
|
|
@@ -34130,10 +34186,13 @@ class ExternalApi {
|
|
|
34130
34186
|
return this.appConfig(userConfig);
|
|
34131
34187
|
}
|
|
34132
34188
|
|
|
34189
|
+
const context = external_api_objectSpread(external_api_objectSpread({}, userConfig.context || this.appConfig.context), this.context);
|
|
34190
|
+
|
|
34133
34191
|
const defaults = external_api_objectSpread(external_api_objectSpread({}, this.appConfig.defaults), userConfig.defaults);
|
|
34134
34192
|
|
|
34135
34193
|
return external_api_objectSpread(external_api_objectSpread(external_api_objectSpread({}, this.appConfig), userConfig), {}, {
|
|
34136
34194
|
api: external_api_objectSpread(external_api_objectSpread({}, this.appConfig.api), userConfig.api),
|
|
34195
|
+
context: keys_default()(context).length ? context : undefined,
|
|
34137
34196
|
defaults: keys_default()(defaults).length ? defaults : undefined
|
|
34138
34197
|
});
|
|
34139
34198
|
}
|