@seamly/web-ui 24.3.1 → 24.4.0

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.
@@ -13998,7 +13998,7 @@ class API {
13998
13998
  return {
13999
13999
  clientName: "@seamly/web-ui",
14000
14000
  clientVariant: this.#layoutMode,
14001
- clientVersion: "24.3.1",
14001
+ clientVersion: "24.4.0",
14002
14002
  currentUrl: window.location.toString(),
14003
14003
  screenResolution: `${window.screen.width}x${window.screen.height}`,
14004
14004
  timezone: (0,_utils__WEBPACK_IMPORTED_MODULE_10__.getTimeZone)(),
@@ -15920,6 +15920,7 @@ const selectShowNotifications = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_6__
15920
15920
  __webpack_require__.r(__webpack_exports__);
15921
15921
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
15922
15922
  /* harmony export */ addEvent: () => (/* binding */ addEvent),
15923
+ /* harmony export */ calculateNewEntryMeta: () => (/* binding */ calculateNewEntryMeta),
15923
15924
  /* harmony export */ clearAbortTransaction: () => (/* binding */ clearAbortTransaction),
15924
15925
  /* harmony export */ clearAllUploads: () => (/* binding */ clearAllUploads),
15925
15926
  /* harmony export */ clearEvents: () => (/* binding */ clearEvents),
@@ -16077,6 +16078,10 @@ const participantReducer = (participantInfo, action) => {
16077
16078
  };
16078
16079
  };
16079
16080
  const calculateNewEntryMeta = (entryMeta, channelEvent) => {
16081
+ // Events originating from the client should leave the entry meta as is
16082
+ if (channelEvent?.payload?.fromClient === true) {
16083
+ return entryMeta;
16084
+ }
16080
16085
  const entry = channelEvent?.type === 'message' ? channelEvent?.payload.translatedEntry || channelEvent?.payload.entry : {
16081
16086
  options: undefined,
16082
16087
  type: undefined
@@ -16298,7 +16303,7 @@ const storeSlice = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_12__.createSlice
16298
16303
  // Use the messages from the payload, as `events` only contains displayable ones.
16299
16304
  // The first participant message found is the 'last', as we receive them from newest to oldest.
16300
16305
  const lastParticipantEvent = messages.find(m => m.type === 'participant');
16301
- // @ts-ignore TypeScript incorrectly assumes that the payload can be any of info/message/participant
16306
+ // @ts-expect-error TypeScript incorrectly assumes that the payload can be any of info/message/participant
16302
16307
  const lastParticipantId = lastParticipantEvent?.payload?.participant?.id;
16303
16308
  const {
16304
16309
  entry
@@ -16312,10 +16317,25 @@ const storeSlice = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_12__.createSlice
16312
16317
  ...(entry?.options ? entry.options : {})
16313
16318
  }
16314
16319
  }, events[events.length - 1]);
16315
- const newFeatures = {
16320
+ let newFeatures = {
16316
16321
  ...state.options.features
16317
16322
  };
16323
+ // The first service message found is the 'last', as we receive them from newest to oldest.
16324
+ const lastServiceMessage = messages.find(m => !m.payload.fromClient && ['message', 'participant'].includes(m.type));
16318
16325
  const newFeaturesHasUpload = newFeatures.hasOwnProperty(ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_11__.featureKeys.uploads);
16326
+
16327
+ // Check for upload enabled by entry type
16328
+ if (newFeaturesHasUpload && lastServiceMessage?.type === 'message') {
16329
+ // @ts-expect-error TypeScript incorrectly assumes that the payload can be any of info/message/participant
16330
+ const entryType = lastServiceMessage.payload.entry?.type || '';
16331
+ newFeatures = {
16332
+ ...newFeatures,
16333
+ uploads: {
16334
+ enabled: newFeatures.uploads?.enabled || false,
16335
+ enabledFromEntry: entryType === ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_11__.entryTypes.upload
16336
+ }
16337
+ };
16338
+ }
16319
16339
  state.unreadEvents = unreadMessageCount;
16320
16340
  state.userHasResponded = userResponded;
16321
16341
  state.events = events.filter(e => e.type !== 'participant' || !!e.payload.participant?.introduction);
@@ -19932,10 +19952,12 @@ __webpack_require__.r(__webpack_exports__);
19932
19952
  /* harmony import */ var lib_id__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/id */ "./src/javascripts/core/lib/id.ts");
19933
19953
  /* harmony import */ var ui_components_conversation_message_container__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ui/components/conversation/message-container */ "./src/javascripts/core/ui/components/conversation/message-container.tsx");
19934
19954
  /* harmony import */ var ui_components_layout_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ui/components/layout/icon */ "./src/javascripts/core/ui/components/layout/icon.tsx");
19935
- /* harmony import */ var ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ui/hooks/seamly-hooks */ "./src/javascripts/core/ui/hooks/seamly-hooks.ts");
19936
- /* harmony import */ var ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ui/utils/general-utils */ "./src/javascripts/core/ui/utils/general-utils.ts");
19937
- /* harmony import */ var ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ui/utils/seamly-utils */ "./src/javascripts/core/ui/utils/seamly-utils.ts");
19938
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/preact/compat/jsx-runtime.mjs");
19955
+ /* harmony import */ var ui_hooks_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ui/hooks/seamly-api-hooks */ "./src/javascripts/core/ui/hooks/seamly-api-hooks.ts");
19956
+ /* harmony import */ var ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ui/hooks/seamly-hooks */ "./src/javascripts/core/ui/hooks/seamly-hooks.ts");
19957
+ /* harmony import */ var ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ui/utils/general-utils */ "./src/javascripts/core/ui/utils/general-utils.ts");
19958
+ /* harmony import */ var ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ui/utils/seamly-utils */ "./src/javascripts/core/ui/utils/seamly-utils.ts");
19959
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/preact/compat/jsx-runtime.mjs");
19960
+
19939
19961
 
19940
19962
 
19941
19963
 
@@ -19960,11 +19982,12 @@ const useChoicePrompt = event => {
19960
19982
  addMessageBubble,
19961
19983
  emitEvent,
19962
19984
  sendAction
19963
- } = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_11__.useSeamlyCommands)();
19985
+ } = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_12__.useSeamlyCommands)();
19986
+ const hasConversation = (0,ui_hooks_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_11__.useSeamlyHasConversation)();
19964
19987
  const {
19965
19988
  activeServiceSessionId
19966
- } = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_11__.useSeamlyServiceInfo)();
19967
- const lastEventId = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_11__.useLastMessageEventId)();
19989
+ } = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_12__.useSeamlyServiceInfo)();
19990
+ const lastEventId = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_12__.useLastMessageEventId)();
19968
19991
  const {
19969
19992
  body
19970
19993
  } = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_6__.useTranslatedEventData)(event);
@@ -19990,9 +20013,13 @@ const useChoicePrompt = event => {
19990
20013
  setShowOptions(payload.id === lastEventId);
19991
20014
  }, [payload, lastEventId]);
19992
20015
  const onChoiceClickHandler = choice => {
20016
+ // Do not allow interaction without a conversation
20017
+ if (!hasConversation()) {
20018
+ return;
20019
+ }
19993
20020
  const transactionId = (0,lib_id__WEBPACK_IMPORTED_MODULE_8__.randomId)();
19994
20021
  const action = {
19995
- type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_13__.actionTypes.pickChoice,
20022
+ type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_14__.actionTypes.pickChoice,
19996
20023
  originMessage: payload.id,
19997
20024
  choice: {
19998
20025
  chooseAgain,
@@ -20031,7 +20058,7 @@ const ChoicePrompt = ({
20031
20058
  const {
20032
20059
  t
20033
20060
  } = (0,domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_5__.useI18n)();
20034
- const descriptorId = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_11__.useGeneratedId)();
20061
+ const descriptorId = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_12__.useGeneratedId)();
20035
20062
  const {
20036
20063
  body,
20037
20064
  subEvent,
@@ -20040,8 +20067,8 @@ const ChoicePrompt = ({
20040
20067
  onChoiceClickHandler,
20041
20068
  onChooseAgainClickHandler
20042
20069
  } = useChoicePrompt(event);
20043
- return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.Fragment, {
20044
- children: [(0,preact__WEBPACK_IMPORTED_MODULE_3__.toChildArray)(children).filter(ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_12__.childIsVNode).map(child => {
20070
+ return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.Fragment, {
20071
+ children: [(0,preact__WEBPACK_IMPORTED_MODULE_3__.toChildArray)(children).filter(ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_13__.childIsVNode).map(child => {
20045
20072
  child.props = {
20046
20073
  ...child.props,
20047
20074
  event: subEvent,
@@ -20049,29 +20076,29 @@ const ChoicePrompt = ({
20049
20076
  showTranslationToggle: false
20050
20077
  };
20051
20078
  return child;
20052
- }), chooseAgain && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsxs)("button", {
20079
+ }), chooseAgain && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsxs)("button", {
20053
20080
  type: "button",
20054
20081
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)('button', 'button--secondary', 'button--choose-again'),
20055
20082
  "aria-expanded": showOptions ? 'true' : 'false',
20056
20083
  onClick: onChooseAgainClickHandler,
20057
20084
  "aria-describedby": descriptorId,
20058
- children: [showOptions ? t('message.choicePrompts.cancelChooseAgain') : t('message.choicePrompts.chooseAgain'), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsx)(ui_components_layout_icon__WEBPACK_IMPORTED_MODULE_10__["default"], {
20085
+ children: [showOptions ? t('message.choicePrompts.cancelChooseAgain') : t('message.choicePrompts.chooseAgain'), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsx)(ui_components_layout_icon__WEBPACK_IMPORTED_MODULE_10__["default"], {
20059
20086
  name: "chevronDown",
20060
20087
  size: "8",
20061
20088
  alt: ""
20062
20089
  })]
20063
- }), showOptions && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsx)(ui_components_conversation_message_container__WEBPACK_IMPORTED_MODULE_9__["default"], {
20090
+ }), showOptions && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsx)(ui_components_conversation_message_container__WEBPACK_IMPORTED_MODULE_9__["default"], {
20064
20091
  type: "choice-prompt",
20065
20092
  showParticipant: false,
20066
20093
  event: event,
20067
20094
  ...props,
20068
- children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsx)("ul", {
20095
+ children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsx)("ul", {
20069
20096
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)('choice-prompt', 'choice-prompt--many'),
20070
- children: body?.choices?.map(choice => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsx)("li", {
20097
+ children: body?.choices?.map(choice => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsx)("li", {
20071
20098
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)('choice-prompt__item', {
20072
20099
  [`choice-prompt__item--${choice?.category}`]: !!choice.category
20073
20100
  }),
20074
- children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsx)("button", {
20101
+ children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsx)("button", {
20075
20102
  type: "button",
20076
20103
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_7__.className)('button', 'button--primary'),
20077
20104
  onClick: () => {
@@ -20116,9 +20143,11 @@ __webpack_require__.r(__webpack_exports__);
20116
20143
  /* harmony import */ var lib_id__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! lib/id */ "./src/javascripts/core/lib/id.ts");
20117
20144
  /* harmony import */ var ui_components_conversation_message_container__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ui/components/conversation/message-container */ "./src/javascripts/core/ui/components/conversation/message-container.tsx");
20118
20145
  /* harmony import */ var ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ui/components/suggestions/suggestions-list */ "./src/javascripts/core/ui/components/suggestions/suggestions-list.tsx");
20119
- /* harmony import */ var ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ui/hooks/seamly-hooks */ "./src/javascripts/core/ui/hooks/seamly-hooks.ts");
20120
- /* harmony import */ var ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ui/utils/seamly-utils */ "./src/javascripts/core/ui/utils/seamly-utils.ts");
20121
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/preact/compat/jsx-runtime.mjs");
20146
+ /* harmony import */ var ui_hooks_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ui/hooks/seamly-api-hooks */ "./src/javascripts/core/ui/hooks/seamly-api-hooks.ts");
20147
+ /* harmony import */ var ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ui/hooks/seamly-hooks */ "./src/javascripts/core/ui/hooks/seamly-hooks.ts");
20148
+ /* harmony import */ var ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ui/utils/seamly-utils */ "./src/javascripts/core/ui/utils/seamly-utils.ts");
20149
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/preact/compat/jsx-runtime.mjs");
20150
+
20122
20151
 
20123
20152
 
20124
20153
 
@@ -20158,7 +20187,8 @@ const ConversationSuggestions = ({
20158
20187
  addMessageBubble,
20159
20188
  emitEvent,
20160
20189
  sendAction
20161
- } = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_13__.useSeamlyCommands)();
20190
+ } = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_14__.useSeamlyCommands)();
20191
+ const hasConversation = (0,ui_hooks_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_13__.useSeamlyHasConversation)();
20162
20192
  const {
20163
20193
  suggestions,
20164
20194
  payload
@@ -20166,7 +20196,7 @@ const ConversationSuggestions = ({
20166
20196
  const {
20167
20197
  showSuggestions
20168
20198
  } = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_5__.useConfig)();
20169
- const events = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_13__.useEvents)();
20199
+ const events = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_14__.useEvents)();
20170
20200
  const {
20171
20201
  t
20172
20202
  } = (0,domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_6__.useI18n)();
@@ -20183,11 +20213,15 @@ const ConversationSuggestions = ({
20183
20213
  id,
20184
20214
  question
20185
20215
  }) => {
20216
+ // Do not allow interaction without a conversation
20217
+ if (!hasConversation()) {
20218
+ return;
20219
+ }
20186
20220
  setIsExpanded(false);
20187
20221
  dispatch((0,domains_app_slice__WEBPACK_IMPORTED_MODULE_4__.setHasResponded)(true));
20188
20222
  const transactionId = (0,lib_id__WEBPACK_IMPORTED_MODULE_10__.randomId)();
20189
20223
  const action = {
20190
- type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_14__.actionTypes.custom,
20224
+ type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_15__.actionTypes.custom,
20191
20225
  originMessage: payload.id,
20192
20226
  body: {
20193
20227
  type: 'faqclick',
@@ -20203,25 +20237,25 @@ const ConversationSuggestions = ({
20203
20237
  sendAction(action);
20204
20238
  addMessageBubble(question, transactionId);
20205
20239
  emitEvent(`action.${action.type}`, action);
20206
- }, [addMessageBubble, dispatch, emitEvent, payload.id, sendAction]);
20240
+ }, [addMessageBubble, dispatch, emitEvent, hasConversation, payload.id, sendAction]);
20207
20241
  if (!isExpanded || userHasResponded || !hasLastTransactionEvent || !showSuggestions) {
20208
20242
  return null;
20209
20243
  }
20210
- return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsxs)("div", {
20244
+ return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_16__.jsxs)("div", {
20211
20245
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_9__.className)('suggestions', 'suggestions--conversation'),
20212
- children: [headingText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsx)("p", {
20246
+ children: [headingText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_16__.jsx)("p", {
20213
20247
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_9__.className)('suggestions__heading'),
20214
20248
  children: headingText
20215
- }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsxs)(ui_components_conversation_message_container__WEBPACK_IMPORTED_MODULE_11__["default"], {
20249
+ }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_16__.jsxs)(ui_components_conversation_message_container__WEBPACK_IMPORTED_MODULE_11__["default"], {
20216
20250
  type: "suggestions",
20217
20251
  showParticipant: false,
20218
20252
  event: event,
20219
20253
  ...props,
20220
- children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsx)(ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_12__["default"], {
20254
+ children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_16__.jsx)(ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_12__["default"], {
20221
20255
  className: "suggestions__list--conversation",
20222
20256
  onClickSuggestion: handleClick,
20223
20257
  suggestions: suggestions
20224
- }), footerText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_15__.jsx)("p", {
20258
+ }), footerText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_16__.jsx)("p", {
20225
20259
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_9__.className)('suggestions__footer'),
20226
20260
  children: footerText
20227
20261
  })]
@@ -22934,7 +22968,6 @@ const EntryContainer = () => {
22934
22968
  upload: _upload__WEBPACK_IMPORTED_MODULE_11__["default"]
22935
22969
  });
22936
22970
  const [renderEntry, setRenderEntry] = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(() => activeEntry);
22937
- const [renderEntryOptions, setRenderEntryOptions] = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(() => activeEntryOptions);
22938
22971
  const config = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_1__.useConfig)();
22939
22972
  const {
22940
22973
  accountAllowsUploads
@@ -22965,11 +22998,10 @@ const EntryContainer = () => {
22965
22998
  }, [hasCountdown, hasResumeConversationPrompt, focusFn]);
22966
22999
  (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
22967
23000
  setRenderEntry(activeEntry);
22968
- setRenderEntryOptions(activeEntryOptions);
22969
23001
  // This focus action is required for auto entry changes. User driven
22970
23002
  // changes should be handled in the originating components.
22971
23003
  focusFn();
22972
- }, [activeEntry, activeEntryOptions, focusFn, entryContainer]);
23004
+ }, [activeEntry, focusFn, entryContainer]);
22973
23005
 
22974
23006
  // Check if the active element is inside this container and save it.
22975
23007
  containedFocus.current = !!(entryContainer.current && entryContainer.current.contains(document.activeElement));
@@ -22978,7 +23010,7 @@ const EntryContainer = () => {
22978
23010
  // Once we do, this property should be moved to that component instead.
22979
23011
  const {
22980
23012
  allowManualInput = true
22981
- } = renderEntryOptions;
23013
+ } = activeEntryOptions;
22982
23014
  return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div", {
22983
23015
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_3__.className)('chat__entry'),
22984
23016
  ref: entryContainer,
@@ -23607,6 +23639,19 @@ const Upload = () => {
23607
23639
  }
23608
23640
  prevIsComplete.current = isComplete;
23609
23641
  }, [isUploading, isComplete, clearUploads, cancelEntrySelection, focusSkiplinkTarget, sendPolite, t]);
23642
+
23643
+ // Reset form when service no longer allows uploads
23644
+ (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
23645
+ // If we are currently uploading, don't clear the uploads as that
23646
+ // may be confusing to the user.
23647
+ // When the upload completes and the user clicks the submit button,
23648
+ // there will be an error.
23649
+ if (!serviceAllowsUploads && !isUploading) {
23650
+ clearUploads();
23651
+ cancelEntrySelection();
23652
+ focusSkiplinkTarget();
23653
+ }
23654
+ }, [serviceAllowsUploads, isUploading, clearUploads, cancelEntrySelection, focusSkiplinkTarget]);
23610
23655
  const handleSubmit = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(({
23611
23656
  fileList
23612
23657
  }) => {
@@ -25279,7 +25324,7 @@ __webpack_require__.r(__webpack_exports__);
25279
25324
  /* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);
25280
25325
  /* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! preact/hooks */ "preact/hooks");
25281
25326
  /* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(preact_hooks__WEBPACK_IMPORTED_MODULE_1__);
25282
- /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/dist/react-redux.mjs");
25327
+ /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/dist/react-redux.mjs");
25283
25328
  /* harmony import */ var domains_app_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! domains/app/hooks */ "./src/javascripts/core/domains/app/hooks.ts");
25284
25329
  /* harmony import */ var domains_config_hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! domains/config/hooks */ "./src/javascripts/core/domains/config/hooks.ts");
25285
25330
  /* harmony import */ var domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! domains/i18n/hooks */ "./src/javascripts/core/domains/i18n/hooks.ts");
@@ -25293,14 +25338,16 @@ __webpack_require__.r(__webpack_exports__);
25293
25338
  /* harmony import */ var ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ui/components/widgets/in-out-transition */ "./src/javascripts/core/ui/components/widgets/in-out-transition.tsx");
25294
25339
  /* harmony import */ var ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ui/hooks/focus-helper-hooks */ "./src/javascripts/core/ui/hooks/focus-helper-hooks.ts");
25295
25340
  /* harmony import */ var ui_hooks_live_region_hooks__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ui/hooks/live-region-hooks */ "./src/javascripts/core/ui/hooks/live-region-hooks.ts");
25296
- /* harmony import */ var ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ui/hooks/seamly-state-hooks */ "./src/javascripts/core/ui/hooks/seamly-state-hooks.ts");
25297
- /* harmony import */ var ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ui/hooks/use-seamly-commands */ "./src/javascripts/core/ui/hooks/use-seamly-commands.ts");
25298
- /* harmony import */ var ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ui/hooks/use-seamly-idle-detach-countdown */ "./src/javascripts/core/ui/hooks/use-seamly-idle-detach-countdown.ts");
25299
- /* harmony import */ var ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ui/hooks/use-seamly-resume-conversation-prompt */ "./src/javascripts/core/ui/hooks/use-seamly-resume-conversation-prompt.ts");
25300
- /* harmony import */ var ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ui/hooks/utility-hooks */ "./src/javascripts/core/ui/hooks/utility-hooks.ts");
25301
- /* harmony import */ var ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ui/utils/general-utils */ "./src/javascripts/core/ui/utils/general-utils.ts");
25302
- /* harmony import */ var ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ui/utils/seamly-utils */ "./src/javascripts/core/ui/utils/seamly-utils.ts");
25303
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/preact/compat/jsx-runtime.mjs");
25341
+ /* harmony import */ var ui_hooks_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ui/hooks/seamly-api-hooks */ "./src/javascripts/core/ui/hooks/seamly-api-hooks.ts");
25342
+ /* harmony import */ var ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ui/hooks/seamly-state-hooks */ "./src/javascripts/core/ui/hooks/seamly-state-hooks.ts");
25343
+ /* harmony import */ var ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ui/hooks/use-seamly-commands */ "./src/javascripts/core/ui/hooks/use-seamly-commands.ts");
25344
+ /* harmony import */ var ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ui/hooks/use-seamly-idle-detach-countdown */ "./src/javascripts/core/ui/hooks/use-seamly-idle-detach-countdown.ts");
25345
+ /* harmony import */ var ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ui/hooks/use-seamly-resume-conversation-prompt */ "./src/javascripts/core/ui/hooks/use-seamly-resume-conversation-prompt.ts");
25346
+ /* harmony import */ var ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ui/hooks/utility-hooks */ "./src/javascripts/core/ui/hooks/utility-hooks.ts");
25347
+ /* harmony import */ var ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ui/utils/general-utils */ "./src/javascripts/core/ui/utils/general-utils.ts");
25348
+ /* harmony import */ var ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ui/utils/seamly-utils */ "./src/javascripts/core/ui/utils/seamly-utils.ts");
25349
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/preact/compat/jsx-runtime.mjs");
25350
+
25304
25351
 
25305
25352
 
25306
25353
 
@@ -25331,7 +25378,7 @@ const Suggestions = ({
25331
25378
  // generic hooks
25332
25379
  const {
25333
25380
  isInline
25334
- } = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_15__.useSeamlyLayoutMode)();
25381
+ } = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_16__.useSeamlyLayoutMode)();
25335
25382
  const {
25336
25383
  t
25337
25384
  } = (0,domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_4__.useI18n)();
@@ -25339,7 +25386,8 @@ const Suggestions = ({
25339
25386
  addMessageBubble,
25340
25387
  emitEvent,
25341
25388
  sendAction
25342
- } = (0,ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_16__["default"])();
25389
+ } = (0,ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_17__["default"])();
25390
+ const hasConversation = (0,ui_hooks_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_15__.useSeamlyHasConversation)();
25343
25391
  const {
25344
25392
  isOpen,
25345
25393
  setVisibility
@@ -25348,25 +25396,25 @@ const Suggestions = ({
25348
25396
  showSuggestions
25349
25397
  } = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_3__.useConfig)();
25350
25398
  // a11y hooks
25351
- const sectionId = (0,ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_19__.useGeneratedId)();
25399
+ const sectionId = (0,ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_20__.useGeneratedId)();
25352
25400
  const focusSkiplinkTarget = (0,ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_13__.useSkiplinkTargetFocusing)();
25353
25401
  const containerRef = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
25354
25402
  const {
25355
25403
  sendPolite
25356
25404
  } = (0,ui_hooks_live_region_hooks__WEBPACK_IMPORTED_MODULE_14__.useLiveRegion)();
25357
25405
  // interrupt & countdown hooks
25358
- const hasError = (0,react_redux__WEBPACK_IMPORTED_MODULE_23__.useSelector)(domains_interrupt_selectors__WEBPACK_IMPORTED_MODULE_5__.selectHasError);
25406
+ const hasError = (0,react_redux__WEBPACK_IMPORTED_MODULE_24__.useSelector)(domains_interrupt_selectors__WEBPACK_IMPORTED_MODULE_5__.selectHasError);
25359
25407
  const {
25360
25408
  hasCountdown,
25361
25409
  endCountdown
25362
- } = (0,ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_17__["default"])();
25410
+ } = (0,ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_18__["default"])();
25363
25411
  const {
25364
25412
  hasPrompt,
25365
25413
  continueChat
25366
- } = (0,ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_18__["default"])();
25414
+ } = (0,ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_19__["default"])();
25367
25415
  // data hooks
25368
25416
  const userHasResponded = (0,domains_app_hooks__WEBPACK_IMPORTED_MODULE_2__.useUserHasResponded)();
25369
- const payload = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_15__.useSeamlyServiceData)('suggestion');
25417
+ const payload = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_16__.useSeamlyServiceData)('suggestion');
25370
25418
  const {
25371
25419
  body: eventBody
25372
25420
  } = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_6__.useTranslatedEventData)({
@@ -25402,6 +25450,10 @@ const Suggestions = ({
25402
25450
  id,
25403
25451
  question
25404
25452
  }) => {
25453
+ // Do not allow interaction without a conversation
25454
+ if (!hasConversation()) {
25455
+ return;
25456
+ }
25405
25457
  if (hasCountdown) {
25406
25458
  endCountdown(true);
25407
25459
  }
@@ -25410,7 +25462,7 @@ const Suggestions = ({
25410
25462
  }
25411
25463
  const transactionId = (0,lib_id__WEBPACK_IMPORTED_MODULE_10__.randomId)();
25412
25464
  const action = {
25413
- type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_21__.actionTypes.custom,
25465
+ type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_22__.actionTypes.custom,
25414
25466
  originMessage: payload.id,
25415
25467
  body: {
25416
25468
  type: 'faqclick',
@@ -25432,7 +25484,7 @@ const Suggestions = ({
25432
25484
  });
25433
25485
  }
25434
25486
  focusSkiplinkTarget();
25435
- }, [addMessageBubble, continueChat, endCountdown, emitEvent, focusSkiplinkTarget, hasCountdown, hasPrompt, isOpen, payload, sendAction, setVisibility]);
25487
+ }, [addMessageBubble, continueChat, endCountdown, emitEvent, focusSkiplinkTarget, hasConversation, hasCountdown, hasPrompt, isOpen, payload, sendAction, setVisibility]);
25436
25488
  (0,preact_hooks__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
25437
25489
  if (prevSuggestions.current !== suggestions && !hideSuggestions) {
25438
25490
  if (hasSuggestions) {
@@ -25446,10 +25498,10 @@ const Suggestions = ({
25446
25498
  prevSuggestions.current = suggestions;
25447
25499
  }
25448
25500
  if (!prevHideSuggestions.current && hideSuggestions) {
25449
- (0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_20__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
25501
+ (0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_21__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
25450
25502
  sendPolite(t('suggestions.srUnavailableText'));
25451
25503
  } else if (!hasSuggestions && prevHasSuggestions.current) {
25452
- (0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_20__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
25504
+ (0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_21__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
25453
25505
  }
25454
25506
  prevHasSuggestions.current = hasSuggestions;
25455
25507
  prevHideSuggestions.current = hideSuggestions;
@@ -25457,21 +25509,21 @@ const Suggestions = ({
25457
25509
  const headingText = t('suggestions.headingText');
25458
25510
  const footerText = t('suggestions.footerText');
25459
25511
  const ContainerElement = headingText ? 'section' : 'div';
25460
- return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_22__.jsx)(ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_12__["default"], {
25512
+ return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsx)(ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_12__["default"], {
25461
25513
  isActive: !!showSuggestionsContainer,
25462
25514
  transitionStartState: ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_12__.transitionStartStates.notRendered,
25463
- children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_22__.jsxs)(ContainerElement, {
25515
+ children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsxs)(ContainerElement, {
25464
25516
  className: suggestionsClassNames,
25465
25517
  "aria-labelledby": headingText ? sectionId : undefined,
25466
25518
  ref: containerRef,
25467
- children: [headingText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_22__.jsx)("p", {
25519
+ children: [headingText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsx)("p", {
25468
25520
  id: sectionId,
25469
25521
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_9__.className)('suggestions__heading'),
25470
25522
  children: headingText
25471
- }), !!renderedSuggestions && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_22__.jsx)(ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_11__["default"], {
25523
+ }), !!renderedSuggestions && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsx)(ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_11__["default"], {
25472
25524
  suggestions: renderedSuggestions,
25473
25525
  onClickSuggestion: handleClick
25474
- }), footerText && !isOpen && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_22__.jsx)("p", {
25526
+ }), footerText && !isOpen && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsx)("p", {
25475
25527
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_9__.className)('suggestions__footer'),
25476
25528
  children: footerText
25477
25529
  })]