@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
package/build/dist/lib/index.js
CHANGED
|
@@ -9225,6 +9225,29 @@ const setLocale = i18n_utils_createThunk('setLocale', async (locale, {
|
|
|
9225
9225
|
return api.getTranslations(locale);
|
|
9226
9226
|
});
|
|
9227
9227
|
});
|
|
9228
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
9229
|
+
|
|
9230
|
+
const {
|
|
9231
|
+
createActions: utils_createActions,
|
|
9232
|
+
createReducer: translations_utils_createReducer,
|
|
9233
|
+
selectState: translations_utils_selectState
|
|
9234
|
+
} = createDomain('translations');
|
|
9235
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
9236
|
+
|
|
9237
|
+
const [enable, disable] = utils_createActions('translate', {
|
|
9238
|
+
enable: locale => ({
|
|
9239
|
+
locale
|
|
9240
|
+
}),
|
|
9241
|
+
disable: () => ({})
|
|
9242
|
+
});
|
|
9243
|
+
const [enableEvent, disableEvent] = utils_createActions('event', {
|
|
9244
|
+
enable: payloadId => ({
|
|
9245
|
+
payloadId
|
|
9246
|
+
}),
|
|
9247
|
+
disable: payloadId => ({
|
|
9248
|
+
payloadId
|
|
9249
|
+
})
|
|
9250
|
+
});
|
|
9228
9251
|
;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
|
|
9229
9252
|
|
|
9230
9253
|
const {
|
|
@@ -9243,7 +9266,7 @@ const selectUserHasResponded = createSelector(app_utils_selectState, state => st
|
|
|
9243
9266
|
|
|
9244
9267
|
const {
|
|
9245
9268
|
createAction: visibility_utils_createAction,
|
|
9246
|
-
createActions:
|
|
9269
|
+
createActions: visibility_utils_createActions,
|
|
9247
9270
|
createThunk: visibility_utils_createThunk,
|
|
9248
9271
|
createReducer: visibility_utils_createReducer,
|
|
9249
9272
|
selectState: visibility_utils_selectState
|
|
@@ -9265,6 +9288,12 @@ const calculateVisibility = ({
|
|
|
9265
9288
|
|
|
9266
9289
|
if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
|
|
9267
9290
|
return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
|
|
9291
|
+
} // Allow users to continue a conversation (if they have responded and no visibility is requested)
|
|
9292
|
+
// when switching from the window layout to the inline layout
|
|
9293
|
+
|
|
9294
|
+
|
|
9295
|
+
if (layoutMode === 'inline' && hasResponded && !requestedVisibility) {
|
|
9296
|
+
return previousVisibility || visibilityStates.open;
|
|
9268
9297
|
}
|
|
9269
9298
|
|
|
9270
9299
|
const baseVisibility = visibilityStates.minimized;
|
|
@@ -9509,6 +9538,7 @@ class SeamlyBaseError extends Error {
|
|
|
9509
9538
|
if (originalError !== null && originalError !== void 0 && originalError.payload) {
|
|
9510
9539
|
this.originalEvent = originalError;
|
|
9511
9540
|
this.originalError = originalError.payload.error;
|
|
9541
|
+
this.message = `Event of type ${originalError.payload.type} encountered`;
|
|
9512
9542
|
}
|
|
9513
9543
|
|
|
9514
9544
|
if (originalError !== null && originalError !== void 0 && originalError.error) {
|
|
@@ -9549,6 +9579,8 @@ const clear = interrupt_utils_createAction('clear');
|
|
|
9549
9579
|
|
|
9550
9580
|
|
|
9551
9581
|
|
|
9582
|
+
|
|
9583
|
+
|
|
9552
9584
|
const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
|
|
9553
9585
|
hasResponded
|
|
9554
9586
|
}));
|
|
@@ -9591,7 +9623,7 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
9591
9623
|
|
|
9592
9624
|
if (agentParticipant !== null && agentParticipant !== void 0 && agentParticipant.name) {
|
|
9593
9625
|
dispatch({
|
|
9594
|
-
type: seamlyActions.
|
|
9626
|
+
type: seamlyActions.SET_HEADER_SUB_TITLE,
|
|
9595
9627
|
title: agentParticipant.name
|
|
9596
9628
|
});
|
|
9597
9629
|
}
|
|
@@ -9600,6 +9632,8 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
9600
9632
|
}
|
|
9601
9633
|
|
|
9602
9634
|
try {
|
|
9635
|
+
var _config$context2;
|
|
9636
|
+
|
|
9603
9637
|
if (api.hasConversation()) {
|
|
9604
9638
|
var _initialState$transla;
|
|
9605
9639
|
|
|
@@ -9613,6 +9647,16 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
9613
9647
|
if ('userResponded' in initialState) {
|
|
9614
9648
|
dispatch(setHasResponded(initialState.userResponded));
|
|
9615
9649
|
}
|
|
9650
|
+
} else if (config !== null && config !== void 0 && (_config$context2 = config.context) !== null && _config$context2 !== void 0 && _config$context2.translationLocale) {
|
|
9651
|
+
locale = config.context.translationLocale;
|
|
9652
|
+
api.send('action', {
|
|
9653
|
+
type: actionTypes.setTranslation,
|
|
9654
|
+
body: {
|
|
9655
|
+
enabled: true,
|
|
9656
|
+
locale
|
|
9657
|
+
}
|
|
9658
|
+
});
|
|
9659
|
+
dispatch(enable(locale));
|
|
9616
9660
|
}
|
|
9617
9661
|
} catch (e) {
|
|
9618
9662
|
if (e instanceof SeamlySessionExpiredError) {
|
|
@@ -11848,29 +11892,6 @@ const app_reducer_initialState = {
|
|
|
11848
11892
|
|
|
11849
11893
|
|
|
11850
11894
|
|
|
11851
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
|
|
11852
|
-
|
|
11853
|
-
const {
|
|
11854
|
-
createActions: translations_utils_createActions,
|
|
11855
|
-
createReducer: translations_utils_createReducer,
|
|
11856
|
-
selectState: translations_utils_selectState
|
|
11857
|
-
} = createDomain('translations');
|
|
11858
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
|
|
11859
|
-
|
|
11860
|
-
const [enable, disable] = translations_utils_createActions('translate', {
|
|
11861
|
-
enable: locale => ({
|
|
11862
|
-
locale
|
|
11863
|
-
}),
|
|
11864
|
-
disable: () => ({})
|
|
11865
|
-
});
|
|
11866
|
-
const [enableEvent, disableEvent] = translations_utils_createActions('event', {
|
|
11867
|
-
enable: payloadId => ({
|
|
11868
|
-
payloadId
|
|
11869
|
-
}),
|
|
11870
|
-
disable: payloadId => ({
|
|
11871
|
-
payloadId
|
|
11872
|
-
})
|
|
11873
|
-
});
|
|
11874
11895
|
;// CONCATENATED MODULE: ./src/javascripts/domains/redux/utils.js
|
|
11875
11896
|
const arrayContentEquals = (a, b) => {
|
|
11876
11897
|
if (a === b) {
|
|
@@ -12635,10 +12656,14 @@ function FormProvider(_ref) {
|
|
|
12635
12656
|
});
|
|
12636
12657
|
}, [setExternalErrors]);
|
|
12637
12658
|
const handleSubmit = (0,hooks_namespaceObject.useCallback)(e => {
|
|
12638
|
-
|
|
12639
|
-
|
|
12659
|
+
var _e$submitter;
|
|
12660
|
+
|
|
12661
|
+
e.preventDefault(); // If the submitter is set to being aria-disabled, block the submit action
|
|
12640
12662
|
|
|
12641
|
-
|
|
12663
|
+
const ariaDisabled = ((_e$submitter = e.submitter) === null || _e$submitter === void 0 ? void 0 : _e$submitter.ariaDisabled) === 'true';
|
|
12664
|
+
setIsSubmitted(!ariaDisabled);
|
|
12665
|
+
|
|
12666
|
+
if (!ariaDisabled && validationIsValid) {
|
|
12642
12667
|
onSubmit(values, {
|
|
12643
12668
|
updateControlValue,
|
|
12644
12669
|
setError
|
|
@@ -20740,7 +20765,7 @@ function TextEntryForm({
|
|
|
20740
20765
|
}), (0,jsx_runtime_namespaceObject.jsx)("button", {
|
|
20741
20766
|
className: css_className('button', 'input__submit'),
|
|
20742
20767
|
type: "submit",
|
|
20743
|
-
disabled: !hasValue || reachedCharacterLimit,
|
|
20768
|
+
"aria-disabled": !hasValue || reachedCharacterLimit ? 'true' : null,
|
|
20744
20769
|
children: (0,jsx_runtime_namespaceObject.jsx)(icon, {
|
|
20745
20770
|
name: "send",
|
|
20746
20771
|
size: "32",
|
|
@@ -20874,9 +20899,9 @@ const UploadToggle = () => {
|
|
|
20874
20899
|
children: (0,jsx_runtime_namespaceObject.jsx)("button", {
|
|
20875
20900
|
className: css_className(['button', 'button--secondary', 'upload-toggle']),
|
|
20876
20901
|
ref: uploadButton,
|
|
20877
|
-
disabled: !showUploadButton ? 'true' : null,
|
|
20902
|
+
"aria-disabled": !showUploadButton ? 'true' : null,
|
|
20878
20903
|
type: "button",
|
|
20879
|
-
onClick: onClickHandler,
|
|
20904
|
+
onClick: showUploadButton ? onClickHandler : null,
|
|
20880
20905
|
children: (0,jsx_runtime_namespaceObject.jsx)(icon, {
|
|
20881
20906
|
name: "file",
|
|
20882
20907
|
size: "32",
|
|
@@ -21723,7 +21748,7 @@ const OptionsButton = () => {
|
|
|
21723
21748
|
ref: item => {
|
|
21724
21749
|
menuItemButtons.current[i] = item;
|
|
21725
21750
|
},
|
|
21726
|
-
className: css_className(['button', 'button--secondary'
|
|
21751
|
+
className: css_className(['button', 'button--secondary']),
|
|
21727
21752
|
onKeyDown: e => onMenuItemKeyDownHandler(e, i),
|
|
21728
21753
|
onKeyPress: e => onKeyPressHandler(e, i),
|
|
21729
21754
|
onClick: () => onMenuItemClickHandler(name, available),
|
|
@@ -21740,7 +21765,7 @@ const OptionsButton = () => {
|
|
|
21740
21765
|
})
|
|
21741
21766
|
}), (0,jsx_runtime_namespaceObject.jsxs)("button", {
|
|
21742
21767
|
type: "button",
|
|
21743
|
-
className: css_className(['button', 'button--secondary', 'chat__options__button', ...(!multiMenu && firstOptionName ? [`chat__options__button--${firstOptionName}`] : [])
|
|
21768
|
+
className: css_className(['button', 'button--secondary', 'chat__options__button', ...(!multiMenu && firstOptionName ? [`chat__options__button--${firstOptionName}`] : [])]),
|
|
21744
21769
|
id: id,
|
|
21745
21770
|
onClick: onClickHandler,
|
|
21746
21771
|
onKeyDown: multiMenu ? onButtonKeyDownHandler : null,
|
|
@@ -24920,15 +24945,6 @@ function getTimeZone() {
|
|
|
24920
24945
|
}
|
|
24921
24946
|
}
|
|
24922
24947
|
|
|
24923
|
-
function getEnvironment() {
|
|
24924
|
-
return {
|
|
24925
|
-
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
24926
|
-
userAgent: navigator.userAgent,
|
|
24927
|
-
currentUrl: window.location.toString(),
|
|
24928
|
-
timezone: getTimeZone()
|
|
24929
|
-
};
|
|
24930
|
-
}
|
|
24931
|
-
|
|
24932
24948
|
class API {
|
|
24933
24949
|
/**
|
|
24934
24950
|
* Creates an instance of API.
|
|
@@ -24938,14 +24954,17 @@ class API {
|
|
|
24938
24954
|
* @param {string} config.secure Connect securely
|
|
24939
24955
|
* @param {string} config.externalId Unique visitor identifier (optional)
|
|
24940
24956
|
* @param {boolean} config.sendEnvironment
|
|
24957
|
+
* @param {string} layoutMode
|
|
24941
24958
|
* @param {string} namespace
|
|
24942
|
-
* @param {Object} [context={ channelName: undefined, variables: undefined, locale: undefined }]
|
|
24959
|
+
* @param {Object} [context={ channelName: undefined, variables: undefined, locale: undefined, translationLocale: undefined }]
|
|
24943
24960
|
* @param {string} context.channelName
|
|
24944
24961
|
* @param {object} context.variables
|
|
24945
24962
|
* @param {string} context.locale
|
|
24963
|
+
* @param {string} context.translationLocale
|
|
24946
24964
|
* @memberof API
|
|
24947
24965
|
*/
|
|
24948
24966
|
constructor({
|
|
24967
|
+
layoutMode,
|
|
24949
24968
|
namespace,
|
|
24950
24969
|
config = {},
|
|
24951
24970
|
context = {}
|
|
@@ -24965,6 +24984,7 @@ class API {
|
|
|
24965
24984
|
this.connected = false;
|
|
24966
24985
|
this.configReady = false;
|
|
24967
24986
|
this.externalId = config.externalId;
|
|
24987
|
+
this.layoutMode = layoutMode;
|
|
24968
24988
|
this.internalProducer = new EventProducer('API');
|
|
24969
24989
|
this.internal$ = xstream_default().create(this.internalProducer).flatten();
|
|
24970
24990
|
this.connection$ = this.internal$.filter(event => event.type === 'connection');
|
|
@@ -25089,7 +25109,7 @@ class API {
|
|
|
25089
25109
|
v: apiVersion
|
|
25090
25110
|
}).send({
|
|
25091
25111
|
context: api_objectSpread(api_objectSpread({}, this.config.context), {}, {
|
|
25092
|
-
environment: this.config.sendEnvironment === true ? getEnvironment() : this.config.sendEnvironment
|
|
25112
|
+
environment: this.config.sendEnvironment === true ? this.getEnvironment() : this.config.sendEnvironment
|
|
25093
25113
|
})
|
|
25094
25114
|
}).then(({
|
|
25095
25115
|
body
|
|
@@ -25103,7 +25123,7 @@ class API {
|
|
|
25103
25123
|
}
|
|
25104
25124
|
|
|
25105
25125
|
if (error.status >= 500) {
|
|
25106
|
-
throw new SeamlyGeneralError();
|
|
25126
|
+
throw new SeamlyGeneralError(error);
|
|
25107
25127
|
}
|
|
25108
25128
|
|
|
25109
25129
|
throw error;
|
|
@@ -25177,7 +25197,7 @@ class API {
|
|
|
25177
25197
|
|
|
25178
25198
|
if (this.config.sendEnvironment) {
|
|
25179
25199
|
this.send('context', {
|
|
25180
|
-
environment: this.config.sendEnvironment === true ? getEnvironment() : this.config.sendEnvironment
|
|
25200
|
+
environment: this.config.sendEnvironment === true ? this.getEnvironment() : this.config.sendEnvironment
|
|
25181
25201
|
}, false);
|
|
25182
25202
|
}
|
|
25183
25203
|
|
|
@@ -25302,6 +25322,18 @@ class API {
|
|
|
25302
25322
|
return this.internal$.filter(event => event.type !== 'connection');
|
|
25303
25323
|
}
|
|
25304
25324
|
|
|
25325
|
+
getEnvironment() {
|
|
25326
|
+
return {
|
|
25327
|
+
clientName: "@seamly/web-ui",
|
|
25328
|
+
clientVariant: this.layoutMode,
|
|
25329
|
+
clientVersion: "20.1.0",
|
|
25330
|
+
currentUrl: window.location.toString(),
|
|
25331
|
+
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
25332
|
+
timezone: getTimeZone(),
|
|
25333
|
+
userAgent: navigator.userAgent
|
|
25334
|
+
};
|
|
25335
|
+
}
|
|
25336
|
+
|
|
25305
25337
|
}
|
|
25306
25338
|
;// CONCATENATED MODULE: ./node_modules/redux-thunk/es/index.js
|
|
25307
25339
|
function createThunkMiddleware(extraArgument) {
|
|
@@ -25495,6 +25527,7 @@ class Engine {
|
|
|
25495
25527
|
this.parentElement = parentElement;
|
|
25496
25528
|
this.externalApi = externalApi;
|
|
25497
25529
|
this.api = new API({
|
|
25530
|
+
layoutMode: config.layoutMode,
|
|
25498
25531
|
namespace: config.namespace,
|
|
25499
25532
|
config: config.api,
|
|
25500
25533
|
context: config.context
|
|
@@ -25610,6 +25643,7 @@ class ExternalApi {
|
|
|
25610
25643
|
this._waitingActions = [];
|
|
25611
25644
|
this._instances = {};
|
|
25612
25645
|
this.appConfig = appConfig;
|
|
25646
|
+
this.context = {};
|
|
25613
25647
|
}
|
|
25614
25648
|
|
|
25615
25649
|
push(...actionObjects) {
|
|
@@ -25637,7 +25671,8 @@ class ExternalApi {
|
|
|
25637
25671
|
break;
|
|
25638
25672
|
|
|
25639
25673
|
default:
|
|
25640
|
-
if (!this.handleAction(actionObj)
|
|
25674
|
+
if (!this.handleAction(actionObj) && // Store context properties for the next instance that will be created
|
|
25675
|
+
!this.setContext(actionObj.action, ...actionObj.args)) {
|
|
25641
25676
|
this._waitingActions.push(actionObj);
|
|
25642
25677
|
}
|
|
25643
25678
|
|
|
@@ -25646,6 +25681,25 @@ class ExternalApi {
|
|
|
25646
25681
|
});
|
|
25647
25682
|
}
|
|
25648
25683
|
|
|
25684
|
+
setContext(action, args) {
|
|
25685
|
+
switch (action) {
|
|
25686
|
+
case 'setTranslation':
|
|
25687
|
+
const {
|
|
25688
|
+
enabled,
|
|
25689
|
+
locale
|
|
25690
|
+
} = args;
|
|
25691
|
+
|
|
25692
|
+
if (!!enabled && locale) {
|
|
25693
|
+
this.context.translationLocale = locale;
|
|
25694
|
+
}
|
|
25695
|
+
|
|
25696
|
+
return true;
|
|
25697
|
+
|
|
25698
|
+
default:
|
|
25699
|
+
return false;
|
|
25700
|
+
}
|
|
25701
|
+
}
|
|
25702
|
+
|
|
25649
25703
|
handleInit(actionObj) {
|
|
25650
25704
|
const userConfig = this.getUserConfig(...actionObj.args);
|
|
25651
25705
|
const config = this.getCombinedConfig(userConfig); // if this.appConfig is a function, it might return an invalid configuration (false, null, undefined)
|
|
@@ -25667,7 +25721,9 @@ class ExternalApi {
|
|
|
25667
25721
|
|
|
25668
25722
|
if (config) {
|
|
25669
25723
|
const instance = this.createInstance(config);
|
|
25670
|
-
this._instances[config.namespace] = instance;
|
|
25724
|
+
this._instances[config.namespace] = instance; // Clear the context after creating the instance, so we do not reuse it for the next
|
|
25725
|
+
|
|
25726
|
+
this.context = {};
|
|
25671
25727
|
instance.render();
|
|
25672
25728
|
}
|
|
25673
25729
|
}
|
|
@@ -25731,10 +25787,13 @@ class ExternalApi {
|
|
|
25731
25787
|
return this.appConfig(userConfig);
|
|
25732
25788
|
}
|
|
25733
25789
|
|
|
25790
|
+
const context = external_api_objectSpread(external_api_objectSpread({}, userConfig.context || this.appConfig.context), this.context);
|
|
25791
|
+
|
|
25734
25792
|
const defaults = external_api_objectSpread(external_api_objectSpread({}, this.appConfig.defaults), userConfig.defaults);
|
|
25735
25793
|
|
|
25736
25794
|
return external_api_objectSpread(external_api_objectSpread(external_api_objectSpread({}, this.appConfig), userConfig), {}, {
|
|
25737
25795
|
api: external_api_objectSpread(external_api_objectSpread({}, this.appConfig.api), userConfig.api),
|
|
25796
|
+
context: Object.keys(context).length ? context : undefined,
|
|
25738
25797
|
defaults: Object.keys(defaults).length ? defaults : undefined
|
|
25739
25798
|
});
|
|
25740
25799
|
}
|