@seamly/web-ui 20.3.1 → 20.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.
@@ -18073,6 +18073,7 @@ const seamlyActions = {
18073
18073
  CLEAR_EVENTS: 'CLEAR_EVENTS',
18074
18074
  SET_HISTORY: 'SET_HISTORY',
18075
18075
  SET_EVENTS_READ: 'SET_EVENTS_READ',
18076
+ SET_LOADED_IMAGE_EVENT_IDS: 'SET_LOADED_IMAGE_EVENT_IDS',
18076
18077
  ACK_EVENT: 'ACK_EVENT',
18077
18078
  SET_IS_LOADING: 'SET_IS_LOADING',
18078
18079
  CLEAR_PARTICIPANTS: 'CLEAR_PARTICIPANTS',
@@ -18118,6 +18119,7 @@ const {
18118
18119
  CLEAR_EVENTS,
18119
18120
  SET_HISTORY,
18120
18121
  SET_EVENTS_READ,
18122
+ SET_LOADED_IMAGE_EVENT_IDS,
18121
18123
  ACK_EVENT,
18122
18124
  SET_IS_LOADING,
18123
18125
  CLEAR_PARTICIPANTS,
@@ -18370,6 +18372,7 @@ const seamlyStateReducer = (state, action) => {
18370
18372
  case CLEAR_EVENTS:
18371
18373
  return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
18372
18374
  unreadEvents: 0,
18375
+ loadedImageEventIds: [],
18373
18376
  events: []
18374
18377
  });
18375
18378
 
@@ -18391,6 +18394,11 @@ const seamlyStateReducer = (state, action) => {
18391
18394
  })
18392
18395
  });
18393
18396
 
18397
+ case SET_LOADED_IMAGE_EVENT_IDS:
18398
+ return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
18399
+ loadedImageEventIds: [...state.loadedImageEventIds, action.eventId]
18400
+ });
18401
+
18394
18402
  case SET_HISTORY:
18395
18403
  const {
18396
18404
  events: history,
@@ -18953,6 +18961,7 @@ const useEvents = () => hooks_useSelector(selectEvents, []);
18953
18961
  const useSeamlyIsLoading = () => useSeamlyStateContext().isLoading;
18954
18962
  const useSeamlyHeaderData = () => useSeamlyStateContext().headerTitles;
18955
18963
  const useSeamlyUnreadCount = () => useSeamlyStateContext().unreadEvents;
18964
+ const useLoadedImageEventIds = () => useSeamlyStateContext().loadedImageEventIds;
18956
18965
  const useSkiplink = () => useSeamlyStateContext().skiplinkTargetId;
18957
18966
  const useSeamlyParticipant = participantId => useSeamlyStateContext().participantInfo.participants[participantId];
18958
18967
  const useSeamlyServiceInfo = () => useSeamlyStateContext().serviceInfo;
@@ -29743,6 +29752,11 @@ function image_objectSpread(target) { for (var i = 1; i < arguments.length; i++)
29743
29752
 
29744
29753
 
29745
29754
 
29755
+
29756
+ const {
29757
+ SET_LOADED_IMAGE_EVENT_IDS: image_SET_LOADED_IMAGE_EVENT_IDS
29758
+ } = seamlyActions;
29759
+
29746
29760
  const Image = _ref => {
29747
29761
  let {
29748
29762
  event,
@@ -29757,6 +29771,16 @@ const Image = _ref => {
29757
29771
  isZoomable
29758
29772
  } = body;
29759
29773
  const [showLighbox, setShowLightbox] = hooks_module_m(false);
29774
+ const dispatch = useStoreDispatch();
29775
+
29776
+ const handleOnLoad = () => {
29777
+ dispatch({
29778
+ type: image_SET_LOADED_IMAGE_EVENT_IDS,
29779
+ eventId: event.payload.id
29780
+ });
29781
+ setShowLightbox(true);
29782
+ };
29783
+
29760
29784
  return jsxRuntime_module_e(message_container, image_objectSpread(image_objectSpread({
29761
29785
  event: event,
29762
29786
  type: "image"
@@ -29765,9 +29789,7 @@ const Image = _ref => {
29765
29789
  src: url,
29766
29790
  id: descriptorId,
29767
29791
  alt: description,
29768
- onLoad: () => {
29769
- setShowLightbox(true);
29770
- }
29792
+ onLoad: handleOnLoad
29771
29793
  }), isZoomable && showLighbox && jsxRuntime_module_e(image_lightbox, {
29772
29794
  description: description,
29773
29795
  url: url
@@ -30871,7 +30893,7 @@ const Conversation = () => {
30871
30893
  const {
30872
30894
  t
30873
30895
  } = useI18n();
30874
- const appBodyContainer = hooks_module_h(null);
30896
+ const chatBodyContainer = hooks_module_h(null);
30875
30897
  const events = useEvents();
30876
30898
  const isLoading = useSeamlyIsLoading();
30877
30899
  const {
@@ -30879,13 +30901,14 @@ const Conversation = () => {
30879
30901
  } = useVisibility();
30880
30902
  const skiplinkTargetId = useSkiplink();
30881
30903
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
30904
+ const loadedImageEventIds = useLoadedImageEventIds();
30882
30905
  hooks_module_y(() => {
30883
- window.requestAnimationFrame(() => {
30884
- if (appBodyContainer.current) {
30885
- appBodyContainer.current.scrollTop = appBodyContainer.current.scrollHeight;
30886
- }
30887
- });
30888
- }, [events, isLoading, isOpen]);
30906
+ const containerElement = chatBodyContainer.current;
30907
+
30908
+ if (containerElement) {
30909
+ containerElement.scrollTop = containerElement.scrollHeight;
30910
+ }
30911
+ }, [events, isLoading, isOpen, loadedImageEventIds]);
30889
30912
 
30890
30913
  const renderEvents = () => {
30891
30914
  let prevParticipant = null;
@@ -30930,7 +30953,7 @@ const Conversation = () => {
30930
30953
  children: t('skiplinkText')
30931
30954
  }), jsxRuntime_module_e("div", {
30932
30955
  className: css_className('chat__body'),
30933
- ref: appBodyContainer,
30956
+ ref: chatBodyContainer,
30934
30957
  children: jsxRuntime_module_e("div", {
30935
30958
  className: css_className('conversation__container'),
30936
30959
  children: [jsxRuntime_module_e(privacy_disclaimer, {}), jsxRuntime_module_e("ol", {
@@ -31312,6 +31335,12 @@ function TextEntryForm(_ref) {
31312
31335
  setBlockAutoEntrySwitch(false);
31313
31336
  };
31314
31337
  }, [setBlockAutoEntrySwitch, hasValue]);
31338
+
31339
+ const handlePointerDown = event => {
31340
+ // When a message is submitted, the keyboard should be prevented from closing on mobile devices
31341
+ event.preventDefault();
31342
+ };
31343
+
31315
31344
  return jsxRuntime_module_e(form_controls_form, {
31316
31345
  className: css_className('entry-form'),
31317
31346
  disableValidationClasses: true,
@@ -31339,6 +31368,7 @@ function TextEntryForm(_ref) {
31339
31368
  }), jsxRuntime_module_e("button", {
31340
31369
  className: css_className('button', 'input__submit'),
31341
31370
  type: "submit",
31371
+ onPointerDown: handlePointerDown,
31342
31372
  "aria-disabled": !hasValue || reachedCharacterLimit ? 'true' : null,
31343
31373
  children: jsxRuntime_module_e(icon, {
31344
31374
  name: "send",
@@ -36204,7 +36234,7 @@ class API {
36204
36234
  return {
36205
36235
  clientName: "@seamly/web-ui",
36206
36236
  clientVariant: this.layoutMode,
36207
- clientVersion: "20.3.1",
36237
+ clientVersion: "20.4.0",
36208
36238
  currentUrl: window.location.toString(),
36209
36239
  screenResolution: `${window.screen.width}x${window.screen.height}`,
36210
36240
  timezone: getTimeZone(),
@@ -36295,6 +36325,7 @@ const state_reducer_initialState = {
36295
36325
  events: [],
36296
36326
  initialState: {},
36297
36327
  unreadEvents: 0,
36328
+ loadedImageEventIds: [],
36298
36329
  isLoading: false,
36299
36330
  idleDetachCountdown: {
36300
36331
  hasCountdown: false,