@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.
@@ -8941,6 +8941,7 @@ const seamlyActions = {
8941
8941
  CLEAR_EVENTS: 'CLEAR_EVENTS',
8942
8942
  SET_HISTORY: 'SET_HISTORY',
8943
8943
  SET_EVENTS_READ: 'SET_EVENTS_READ',
8944
+ SET_LOADED_IMAGE_EVENT_IDS: 'SET_LOADED_IMAGE_EVENT_IDS',
8944
8945
  ACK_EVENT: 'ACK_EVENT',
8945
8946
  SET_IS_LOADING: 'SET_IS_LOADING',
8946
8947
  CLEAR_PARTICIPANTS: 'CLEAR_PARTICIPANTS',
@@ -8986,6 +8987,7 @@ const {
8986
8987
  CLEAR_EVENTS,
8987
8988
  SET_HISTORY,
8988
8989
  SET_EVENTS_READ,
8990
+ SET_LOADED_IMAGE_EVENT_IDS,
8989
8991
  ACK_EVENT,
8990
8992
  SET_IS_LOADING,
8991
8993
  CLEAR_PARTICIPANTS,
@@ -9225,6 +9227,7 @@ const seamlyStateReducer = (state, action) => {
9225
9227
  case CLEAR_EVENTS:
9226
9228
  return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
9227
9229
  unreadEvents: 0,
9230
+ loadedImageEventIds: [],
9228
9231
  events: []
9229
9232
  });
9230
9233
 
@@ -9244,6 +9247,11 @@ const seamlyStateReducer = (state, action) => {
9244
9247
  })
9245
9248
  });
9246
9249
 
9250
+ case SET_LOADED_IMAGE_EVENT_IDS:
9251
+ return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
9252
+ loadedImageEventIds: [...state.loadedImageEventIds, action.eventId]
9253
+ });
9254
+
9247
9255
  case SET_HISTORY:
9248
9256
  const {
9249
9257
  events: history,
@@ -9784,6 +9792,7 @@ const useEvents = () => hooks_useSelector(selectEvents, []);
9784
9792
  const useSeamlyIsLoading = () => useSeamlyStateContext().isLoading;
9785
9793
  const useSeamlyHeaderData = () => useSeamlyStateContext().headerTitles;
9786
9794
  const useSeamlyUnreadCount = () => useSeamlyStateContext().unreadEvents;
9795
+ const useLoadedImageEventIds = () => useSeamlyStateContext().loadedImageEventIds;
9787
9796
  const useSkiplink = () => useSeamlyStateContext().skiplinkTargetId;
9788
9797
  const useSeamlyParticipant = participantId => useSeamlyStateContext().participantInfo.participants[participantId];
9789
9798
  const useSeamlyServiceInfo = () => useSeamlyStateContext().serviceInfo;
@@ -20118,6 +20127,11 @@ function image_objectWithoutPropertiesLoose(source, excluded) { if (source == nu
20118
20127
 
20119
20128
 
20120
20129
 
20130
+
20131
+ const {
20132
+ SET_LOADED_IMAGE_EVENT_IDS: image_SET_LOADED_IMAGE_EVENT_IDS
20133
+ } = seamlyActions;
20134
+
20121
20135
  const Image = _ref => {
20122
20136
  let {
20123
20137
  event,
@@ -20132,6 +20146,16 @@ const Image = _ref => {
20132
20146
  isZoomable
20133
20147
  } = body;
20134
20148
  const [showLighbox, setShowLightbox] = (0,hooks_namespaceObject.useState)(false);
20149
+ const dispatch = useStoreDispatch();
20150
+
20151
+ const handleOnLoad = () => {
20152
+ dispatch({
20153
+ type: image_SET_LOADED_IMAGE_EVENT_IDS,
20154
+ eventId: event.payload.id
20155
+ });
20156
+ setShowLightbox(true);
20157
+ };
20158
+
20135
20159
  return (0,jsx_runtime_namespaceObject.jsxs)(message_container, image_objectSpread(image_objectSpread({
20136
20160
  event: event,
20137
20161
  type: "image"
@@ -20140,9 +20164,7 @@ const Image = _ref => {
20140
20164
  src: url,
20141
20165
  id: descriptorId,
20142
20166
  alt: description,
20143
- onLoad: () => {
20144
- setShowLightbox(true);
20145
- }
20167
+ onLoad: handleOnLoad
20146
20168
  }), isZoomable && showLighbox && (0,jsx_runtime_namespaceObject.jsx)(image_lightbox, {
20147
20169
  description: description,
20148
20170
  url: url
@@ -21158,7 +21180,7 @@ const Conversation = () => {
21158
21180
  const {
21159
21181
  t
21160
21182
  } = useI18n();
21161
- const appBodyContainer = (0,hooks_namespaceObject.useRef)(null);
21183
+ const chatBodyContainer = (0,hooks_namespaceObject.useRef)(null);
21162
21184
  const events = useEvents();
21163
21185
  const isLoading = useSeamlyIsLoading();
21164
21186
  const {
@@ -21166,13 +21188,14 @@ const Conversation = () => {
21166
21188
  } = useVisibility();
21167
21189
  const skiplinkTargetId = useSkiplink();
21168
21190
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
21191
+ const loadedImageEventIds = useLoadedImageEventIds();
21169
21192
  (0,hooks_namespaceObject.useEffect)(() => {
21170
- window.requestAnimationFrame(() => {
21171
- if (appBodyContainer.current) {
21172
- appBodyContainer.current.scrollTop = appBodyContainer.current.scrollHeight;
21173
- }
21174
- });
21175
- }, [events, isLoading, isOpen]);
21193
+ const containerElement = chatBodyContainer.current;
21194
+
21195
+ if (containerElement) {
21196
+ containerElement.scrollTop = containerElement.scrollHeight;
21197
+ }
21198
+ }, [events, isLoading, isOpen, loadedImageEventIds]);
21176
21199
 
21177
21200
  const renderEvents = () => {
21178
21201
  let prevParticipant = null;
@@ -21217,7 +21240,7 @@ const Conversation = () => {
21217
21240
  children: t('skiplinkText')
21218
21241
  }), (0,jsx_runtime_namespaceObject.jsx)("div", {
21219
21242
  className: css_className('chat__body'),
21220
- ref: appBodyContainer,
21243
+ ref: chatBodyContainer,
21221
21244
  children: (0,jsx_runtime_namespaceObject.jsxs)("div", {
21222
21245
  className: css_className('conversation__container'),
21223
21246
  children: [(0,jsx_runtime_namespaceObject.jsx)(privacy_disclaimer, {}), (0,jsx_runtime_namespaceObject.jsxs)("ol", {
@@ -21568,6 +21591,12 @@ function TextEntryForm({
21568
21591
  setBlockAutoEntrySwitch(false);
21569
21592
  };
21570
21593
  }, [setBlockAutoEntrySwitch, hasValue]);
21594
+
21595
+ const handlePointerDown = event => {
21596
+ // When a message is submitted, the keyboard should be prevented from closing on mobile devices
21597
+ event.preventDefault();
21598
+ };
21599
+
21571
21600
  return (0,jsx_runtime_namespaceObject.jsxs)(form_controls_form, {
21572
21601
  className: css_className('entry-form'),
21573
21602
  disableValidationClasses: true,
@@ -21595,6 +21624,7 @@ function TextEntryForm({
21595
21624
  }), (0,jsx_runtime_namespaceObject.jsx)("button", {
21596
21625
  className: css_className('button', 'input__submit'),
21597
21626
  type: "submit",
21627
+ onPointerDown: handlePointerDown,
21598
21628
  "aria-disabled": !hasValue || reachedCharacterLimit ? 'true' : null,
21599
21629
  children: (0,jsx_runtime_namespaceObject.jsx)(icon, {
21600
21630
  name: "send",
@@ -26152,7 +26182,7 @@ class API {
26152
26182
  return {
26153
26183
  clientName: "@seamly/web-ui",
26154
26184
  clientVariant: this.layoutMode,
26155
- clientVersion: "20.3.1",
26185
+ clientVersion: "20.4.0",
26156
26186
  currentUrl: window.location.toString(),
26157
26187
  screenResolution: `${window.screen.width}x${window.screen.height}`,
26158
26188
  timezone: getTimeZone(),
@@ -26234,6 +26264,7 @@ const state_reducer_initialState = {
26234
26264
  events: [],
26235
26265
  initialState: {},
26236
26266
  unreadEvents: 0,
26267
+ loadedImageEventIds: [],
26237
26268
  isLoading: false,
26238
26269
  idleDetachCountdown: {
26239
26270
  hasCountdown: false,