@seamly/web-ui 24.3.1 → 24.4.1

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.1",
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
  })]
@@ -21216,8 +21250,9 @@ const UploadContent = ({
21216
21250
  }) => {
21217
21251
  if (fileId && !isDeleted) {
21218
21252
  return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("button", {
21253
+ type: "button",
21219
21254
  onClick: onClickHandler,
21220
- className: (0,lib_css__WEBPACK_IMPORTED_MODULE_5__.className)(['button', 'download', 'download-link']),
21255
+ className: (0,lib_css__WEBPACK_IMPORTED_MODULE_5__.className)(['download', 'download-link']),
21221
21256
  children: children
21222
21257
  });
21223
21258
  }
@@ -22934,7 +22969,6 @@ const EntryContainer = () => {
22934
22969
  upload: _upload__WEBPACK_IMPORTED_MODULE_11__["default"]
22935
22970
  });
22936
22971
  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
22972
  const config = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_1__.useConfig)();
22939
22973
  const {
22940
22974
  accountAllowsUploads
@@ -22965,11 +22999,10 @@ const EntryContainer = () => {
22965
22999
  }, [hasCountdown, hasResumeConversationPrompt, focusFn]);
22966
23000
  (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
22967
23001
  setRenderEntry(activeEntry);
22968
- setRenderEntryOptions(activeEntryOptions);
22969
23002
  // This focus action is required for auto entry changes. User driven
22970
23003
  // changes should be handled in the originating components.
22971
23004
  focusFn();
22972
- }, [activeEntry, activeEntryOptions, focusFn, entryContainer]);
23005
+ }, [activeEntry, focusFn, entryContainer]);
22973
23006
 
22974
23007
  // Check if the active element is inside this container and save it.
22975
23008
  containedFocus.current = !!(entryContainer.current && entryContainer.current.contains(document.activeElement));
@@ -22978,7 +23011,7 @@ const EntryContainer = () => {
22978
23011
  // Once we do, this property should be moved to that component instead.
22979
23012
  const {
22980
23013
  allowManualInput = true
22981
- } = renderEntryOptions;
23014
+ } = activeEntryOptions;
22982
23015
  return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div", {
22983
23016
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_3__.className)('chat__entry'),
22984
23017
  ref: entryContainer,
@@ -23048,9 +23081,9 @@ function useCharacterLimit(controlName) {
23048
23081
  const [{
23049
23082
  value
23050
23083
  }] = (0,domains_forms_hooks__WEBPACK_IMPORTED_MODULE_2__.useFormControl)(controlName);
23051
- const remainingChars = limit && hasLimit && value ? limit - value.length : limit;
23084
+ const remainingChars = typeof limit === 'number' && hasLimit && value ? limit - value.length : limit;
23052
23085
  const reachedCharacterWarning = hasLimit && typeof remainingChars == 'number' ? remainingChars <= config__WEBPACK_IMPORTED_MODULE_1__.maxCharacterWarningLimit : false;
23053
- const reachedCharacterLimit = hasLimit && remainingChars ? remainingChars < 0 : false;
23086
+ const reachedCharacterLimit = hasLimit && typeof remainingChars === 'number' ? remainingChars < 0 : false;
23054
23087
  (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
23055
23088
  validateLimit(reachedCharacterWarning, remainingChars);
23056
23089
  }, [reachedCharacterWarning, remainingChars, validateLimit]);
@@ -23607,6 +23640,19 @@ const Upload = () => {
23607
23640
  }
23608
23641
  prevIsComplete.current = isComplete;
23609
23642
  }, [isUploading, isComplete, clearUploads, cancelEntrySelection, focusSkiplinkTarget, sendPolite, t]);
23643
+
23644
+ // Reset form when service no longer allows uploads
23645
+ (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
23646
+ // If we are currently uploading, don't clear the uploads as that
23647
+ // may be confusing to the user.
23648
+ // When the upload completes and the user clicks the submit button,
23649
+ // there will be an error.
23650
+ if (!serviceAllowsUploads && !isUploading) {
23651
+ clearUploads();
23652
+ cancelEntrySelection();
23653
+ focusSkiplinkTarget();
23654
+ }
23655
+ }, [serviceAllowsUploads, isUploading, clearUploads, cancelEntrySelection, focusSkiplinkTarget]);
23610
23656
  const handleSubmit = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(({
23611
23657
  fileList
23612
23658
  }) => {
@@ -25279,7 +25325,7 @@ __webpack_require__.r(__webpack_exports__);
25279
25325
  /* 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
25326
  /* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! preact/hooks */ "preact/hooks");
25281
25327
  /* 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");
25328
+ /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/dist/react-redux.mjs");
25283
25329
  /* harmony import */ var domains_app_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! domains/app/hooks */ "./src/javascripts/core/domains/app/hooks.ts");
25284
25330
  /* harmony import */ var domains_config_hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! domains/config/hooks */ "./src/javascripts/core/domains/config/hooks.ts");
25285
25331
  /* harmony import */ var domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! domains/i18n/hooks */ "./src/javascripts/core/domains/i18n/hooks.ts");
@@ -25293,14 +25339,16 @@ __webpack_require__.r(__webpack_exports__);
25293
25339
  /* 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
25340
  /* 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
25341
  /* 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");
25342
+ /* 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");
25343
+ /* 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");
25344
+ /* 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");
25345
+ /* 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");
25346
+ /* 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");
25347
+ /* 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");
25348
+ /* 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");
25349
+ /* 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");
25350
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/preact/compat/jsx-runtime.mjs");
25351
+
25304
25352
 
25305
25353
 
25306
25354
 
@@ -25331,7 +25379,7 @@ const Suggestions = ({
25331
25379
  // generic hooks
25332
25380
  const {
25333
25381
  isInline
25334
- } = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_15__.useSeamlyLayoutMode)();
25382
+ } = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_16__.useSeamlyLayoutMode)();
25335
25383
  const {
25336
25384
  t
25337
25385
  } = (0,domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_4__.useI18n)();
@@ -25339,7 +25387,8 @@ const Suggestions = ({
25339
25387
  addMessageBubble,
25340
25388
  emitEvent,
25341
25389
  sendAction
25342
- } = (0,ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_16__["default"])();
25390
+ } = (0,ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_17__["default"])();
25391
+ const hasConversation = (0,ui_hooks_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_15__.useSeamlyHasConversation)();
25343
25392
  const {
25344
25393
  isOpen,
25345
25394
  setVisibility
@@ -25348,25 +25397,25 @@ const Suggestions = ({
25348
25397
  showSuggestions
25349
25398
  } = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_3__.useConfig)();
25350
25399
  // a11y hooks
25351
- const sectionId = (0,ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_19__.useGeneratedId)();
25400
+ const sectionId = (0,ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_20__.useGeneratedId)();
25352
25401
  const focusSkiplinkTarget = (0,ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_13__.useSkiplinkTargetFocusing)();
25353
25402
  const containerRef = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
25354
25403
  const {
25355
25404
  sendPolite
25356
25405
  } = (0,ui_hooks_live_region_hooks__WEBPACK_IMPORTED_MODULE_14__.useLiveRegion)();
25357
25406
  // interrupt & countdown hooks
25358
- const hasError = (0,react_redux__WEBPACK_IMPORTED_MODULE_23__.useSelector)(domains_interrupt_selectors__WEBPACK_IMPORTED_MODULE_5__.selectHasError);
25407
+ const hasError = (0,react_redux__WEBPACK_IMPORTED_MODULE_24__.useSelector)(domains_interrupt_selectors__WEBPACK_IMPORTED_MODULE_5__.selectHasError);
25359
25408
  const {
25360
25409
  hasCountdown,
25361
25410
  endCountdown
25362
- } = (0,ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_17__["default"])();
25411
+ } = (0,ui_hooks_use_seamly_idle_detach_countdown__WEBPACK_IMPORTED_MODULE_18__["default"])();
25363
25412
  const {
25364
25413
  hasPrompt,
25365
25414
  continueChat
25366
- } = (0,ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_18__["default"])();
25415
+ } = (0,ui_hooks_use_seamly_resume_conversation_prompt__WEBPACK_IMPORTED_MODULE_19__["default"])();
25367
25416
  // data hooks
25368
25417
  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');
25418
+ const payload = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_16__.useSeamlyServiceData)('suggestion');
25370
25419
  const {
25371
25420
  body: eventBody
25372
25421
  } = (0,domains_translations_hooks__WEBPACK_IMPORTED_MODULE_6__.useTranslatedEventData)({
@@ -25402,6 +25451,10 @@ const Suggestions = ({
25402
25451
  id,
25403
25452
  question
25404
25453
  }) => {
25454
+ // Do not allow interaction without a conversation
25455
+ if (!hasConversation()) {
25456
+ return;
25457
+ }
25405
25458
  if (hasCountdown) {
25406
25459
  endCountdown(true);
25407
25460
  }
@@ -25410,7 +25463,7 @@ const Suggestions = ({
25410
25463
  }
25411
25464
  const transactionId = (0,lib_id__WEBPACK_IMPORTED_MODULE_10__.randomId)();
25412
25465
  const action = {
25413
- type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_21__.actionTypes.custom,
25466
+ type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_22__.actionTypes.custom,
25414
25467
  originMessage: payload.id,
25415
25468
  body: {
25416
25469
  type: 'faqclick',
@@ -25432,7 +25485,7 @@ const Suggestions = ({
25432
25485
  });
25433
25486
  }
25434
25487
  focusSkiplinkTarget();
25435
- }, [addMessageBubble, continueChat, endCountdown, emitEvent, focusSkiplinkTarget, hasCountdown, hasPrompt, isOpen, payload, sendAction, setVisibility]);
25488
+ }, [addMessageBubble, continueChat, endCountdown, emitEvent, focusSkiplinkTarget, hasConversation, hasCountdown, hasPrompt, isOpen, payload, sendAction, setVisibility]);
25436
25489
  (0,preact_hooks__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
25437
25490
  if (prevSuggestions.current !== suggestions && !hideSuggestions) {
25438
25491
  if (hasSuggestions) {
@@ -25446,10 +25499,10 @@ const Suggestions = ({
25446
25499
  prevSuggestions.current = suggestions;
25447
25500
  }
25448
25501
  if (!prevHideSuggestions.current && hideSuggestions) {
25449
- (0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_20__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
25502
+ (0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_21__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
25450
25503
  sendPolite(t('suggestions.srUnavailableText'));
25451
25504
  } else if (!hasSuggestions && prevHasSuggestions.current) {
25452
- (0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_20__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
25505
+ (0,ui_utils_general_utils__WEBPACK_IMPORTED_MODULE_21__.runIfElementContainsOrHasFocus)(containerRef.current, focusSkiplinkTarget);
25453
25506
  }
25454
25507
  prevHasSuggestions.current = hasSuggestions;
25455
25508
  prevHideSuggestions.current = hideSuggestions;
@@ -25457,21 +25510,21 @@ const Suggestions = ({
25457
25510
  const headingText = t('suggestions.headingText');
25458
25511
  const footerText = t('suggestions.footerText');
25459
25512
  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"], {
25513
+ return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsx)(ui_components_widgets_in_out_transition__WEBPACK_IMPORTED_MODULE_12__["default"], {
25461
25514
  isActive: !!showSuggestionsContainer,
25462
25515
  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, {
25516
+ children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsxs)(ContainerElement, {
25464
25517
  className: suggestionsClassNames,
25465
25518
  "aria-labelledby": headingText ? sectionId : undefined,
25466
25519
  ref: containerRef,
25467
- children: [headingText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_22__.jsx)("p", {
25520
+ children: [headingText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsx)("p", {
25468
25521
  id: sectionId,
25469
25522
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_9__.className)('suggestions__heading'),
25470
25523
  children: headingText
25471
- }), !!renderedSuggestions && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_22__.jsx)(ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_11__["default"], {
25524
+ }), !!renderedSuggestions && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsx)(ui_components_suggestions_suggestions_list__WEBPACK_IMPORTED_MODULE_11__["default"], {
25472
25525
  suggestions: renderedSuggestions,
25473
25526
  onClickSuggestion: handleClick
25474
- }), footerText && !isOpen && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_22__.jsx)("p", {
25527
+ }), footerText && !isOpen && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_23__.jsx)("p", {
25475
25528
  className: (0,lib_css__WEBPACK_IMPORTED_MODULE_9__.className)('suggestions__footer'),
25476
25529
  children: footerText
25477
25530
  })]