@seamly/web-ui 19.1.2 → 19.1.5

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.
@@ -14497,6 +14497,15 @@ class SeamlyBaseError extends Error {
14497
14497
  }
14498
14498
 
14499
14499
  this.originalError = originalError;
14500
+
14501
+ if (originalError !== null && originalError !== void 0 && originalError.payload) {
14502
+ this.originalEvent = originalError;
14503
+ this.originalError = originalError.payload.error;
14504
+ }
14505
+
14506
+ if (originalError !== null && originalError !== void 0 && originalError.error) {
14507
+ this.originalError = originalError.error;
14508
+ }
14500
14509
  }
14501
14510
 
14502
14511
  }
@@ -16153,45 +16162,48 @@ function useTranslationsContainer() {
16153
16162
 
16154
16163
 
16155
16164
 
16156
- function translations_middleware_createMiddleware() {
16157
- return ({
16158
- dispatch,
16159
- getState
16160
- }) => next => action => {
16161
- var _action$history, _action$history$trans, _action$initialState, _action$initialState$, _action$event, _action$event$payload, _action$event$payload2;
16165
+ function translations_middleware_createMiddleware({
16166
+ dispatch,
16167
+ getState
16168
+ }) {
16169
+ return next => {
16170
+ return action => {
16171
+ var _action$history, _action$history$trans, _action$initialState, _action$initialState$, _action$event, _action$event$payload, _action$event$payload2;
16162
16172
 
16163
- const result = next(action);
16173
+ const result = next(action);
16164
16174
 
16165
- switch (action.type) {
16166
- case String(seamlyActions.SET_HISTORY):
16167
- if ((_action$history = action.history) !== null && _action$history !== void 0 && (_action$history$trans = _action$history.translation) !== null && _action$history$trans !== void 0 && _action$history$trans.enabled) {
16168
- dispatch(enable(action.history.translation.locale));
16169
- }
16175
+ switch (action.type) {
16176
+ case String(seamlyActions.SET_HISTORY):
16177
+ if ((_action$history = action.history) !== null && _action$history !== void 0 && (_action$history$trans = _action$history.translation) !== null && _action$history$trans !== void 0 && _action$history$trans.enabled) {
16178
+ dispatch(enable(action.history.translation.locale));
16179
+ dispatch(setLocale(action.history.translation.locale));
16180
+ }
16170
16181
 
16171
- break;
16182
+ break;
16172
16183
 
16173
- case String(seamlyActions.SET_INITIAL_STATE):
16174
- if ((_action$initialState = action.initialState) !== null && _action$initialState !== void 0 && (_action$initialState$ = _action$initialState.translation) !== null && _action$initialState$ !== void 0 && _action$initialState$.enabled) {
16175
- dispatch(enable(action.initialState.translation.locale));
16176
- dispatch(setLocale(action.locale));
16177
- }
16184
+ case String(seamlyActions.SET_INITIAL_STATE):
16185
+ if ((_action$initialState = action.initialState) !== null && _action$initialState !== void 0 && (_action$initialState$ = _action$initialState.translation) !== null && _action$initialState$ !== void 0 && _action$initialState$.enabled) {
16186
+ dispatch(enable(action.initialState.translation.locale));
16187
+ dispatch(setLocale(action.locale));
16188
+ }
16178
16189
 
16179
- break;
16190
+ break;
16180
16191
 
16181
- case String(seamlyActions.ADD_EVENT):
16182
- if (action.event.type === 'info' && ((_action$event = action.event) === null || _action$event === void 0 ? void 0 : (_action$event$payload = _action$event.payload) === null || _action$event$payload === void 0 ? void 0 : (_action$event$payload2 = _action$event$payload.body) === null || _action$event$payload2 === void 0 ? void 0 : _action$event$payload2.subtype) === 'new_translation' && action.event.payload.body.translationEnabled) {
16183
- dispatch(setLocale(action.event.payload.body.translationLocale));
16184
- }
16192
+ case String(seamlyActions.ADD_EVENT):
16193
+ if (action.event.type === 'info' && ((_action$event = action.event) === null || _action$event === void 0 ? void 0 : (_action$event$payload = _action$event.payload) === null || _action$event$payload === void 0 ? void 0 : (_action$event$payload2 = _action$event$payload.body) === null || _action$event$payload2 === void 0 ? void 0 : _action$event$payload2.subtype) === 'new_translation' && action.event.payload.body.translationEnabled) {
16194
+ dispatch(setLocale(action.event.payload.body.translationLocale));
16195
+ }
16185
16196
 
16186
- break;
16197
+ break;
16187
16198
 
16188
- case String(disable):
16189
- const initialLocale = selectInitialLocale(getState());
16190
- dispatch(setLocale(initialLocale));
16191
- break;
16192
- }
16199
+ case String(disable):
16200
+ const initialLocale = selectInitialLocale(getState());
16201
+ dispatch(setLocale(initialLocale));
16202
+ break;
16203
+ }
16193
16204
 
16194
- return result;
16205
+ return result;
16206
+ };
16195
16207
  };
16196
16208
  }
16197
16209
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/reducer.js
@@ -20907,7 +20919,7 @@ function slide_defineProperty(obj, key, value) { if (key in obj) { Object.define
20907
20919
  function CarouselMessageSlide({
20908
20920
  item: slide,
20909
20921
  items,
20910
- currentIndex,
20922
+ index,
20911
20923
  isActive
20912
20924
  }) {
20913
20925
  const {
@@ -20918,7 +20930,7 @@ function CarouselMessageSlide({
20918
20930
  role: "group",
20919
20931
  "aria-roledescription": "slide",
20920
20932
  "aria-label": t('carousel.slide.label', {
20921
- index: currentIndex + 1,
20933
+ index: index + 1,
20922
20934
  total: items.length
20923
20935
  }),
20924
20936
  children: (0,jsx_runtime_namespaceObject.jsx)(card_component, slide_objectSpread(slide_objectSpread({}, slide), {}, {
@@ -20942,6 +20954,12 @@ const defaultGetItemKey = (item, idx, prefix) => `${prefix}${idx}`;
20942
20954
 
20943
20955
  const defaultGetItemLabel = item => item.label;
20944
20956
 
20957
+ const preventScroll = ({
20958
+ target
20959
+ }) => {
20960
+ target.scrollLeft = 0;
20961
+ };
20962
+
20945
20963
  function CarouselComponent({
20946
20964
  currentIndex: originalIndex,
20947
20965
  onChange,
@@ -20978,6 +20996,7 @@ function CarouselComponent({
20978
20996
  "aria-roledescription": "carousel",
20979
20997
  children: [(0,jsx_runtime_namespaceObject.jsx)("div", {
20980
20998
  className: css_className('carousel__slides-wrapper'),
20999
+ onScroll: preventScroll,
20981
21000
  children: (0,jsx_runtime_namespaceObject.jsx)("div", {
20982
21001
  id: carouselItemsId,
20983
21002
  className: css_className('carousel__slides'),
@@ -20997,6 +21016,7 @@ function CarouselComponent({
20997
21016
  item: item,
20998
21017
  items: items,
20999
21018
  currentIndex: currentIndex,
21019
+ index: idx,
21000
21020
  isActive: isActive
21001
21021
  })
21002
21022
  }, getItemKey(item, idx, 'item-'));
@@ -21029,6 +21049,7 @@ function CarouselComponent({
21029
21049
 
21030
21050
 
21031
21051
 
21052
+
21032
21053
  const getItemKey = (item, idx, prefix = '') => `${prefix}${item.title}:${idx}`;
21033
21054
 
21034
21055
  const getItemLabel = item => item.title;
@@ -21036,7 +21057,8 @@ const getItemLabel = item => item.title;
21036
21057
  const CarouselMessage = ({
21037
21058
  event
21038
21059
  }) => {
21039
- const slides = event.payload.body.cards;
21060
+ const [body] = useTranslatedEventData(event);
21061
+ const slides = body.cards;
21040
21062
  return (0,jsx_runtime_namespaceObject.jsx)(message_container, {
21041
21063
  event: event,
21042
21064
  modifiers: 'type-carousel',
@@ -23218,30 +23240,33 @@ function errors_createMiddleware({
23218
23240
  return ({
23219
23241
  getState
23220
23242
  }) => {
23221
- const handleError = error => {
23243
+ const handleError = action => {
23222
23244
  const {
23223
23245
  errorCallback,
23224
23246
  namespace,
23225
23247
  api,
23226
23248
  layoutMode
23227
23249
  } = selectConfig(getState());
23228
- errorCallback === null || errorCallback === void 0 ? void 0 : errorCallback(error, {
23250
+ errorCallback === null || errorCallback === void 0 ? void 0 : errorCallback(action.error, {
23229
23251
  namespace,
23230
23252
  api,
23231
23253
  layoutMode,
23232
- conversationUrl: seamlyApi.getConversationUrl()
23254
+ conversationUrl: seamlyApi.getConversationUrl(),
23255
+ action: action.type ? action : undefined
23233
23256
  });
23234
23257
  };
23235
23258
 
23236
23259
  return next => action => {
23237
23260
  try {
23238
23261
  if (action.error) {
23239
- handleError(action.error);
23262
+ handleError(action);
23240
23263
  }
23241
23264
 
23242
23265
  return next(action);
23243
23266
  } catch (error) {
23244
- handleError(error);
23267
+ handleError({
23268
+ error
23269
+ });
23245
23270
  throw error;
23246
23271
  }
23247
23272
  };
@@ -24767,7 +24792,8 @@ class ConversationProducer {
24767
24792
  this.emit({
24768
24793
  type: 'error',
24769
24794
  payload: {
24770
- type: 'seamly_offline'
24795
+ type: 'seamly_offline',
24796
+ error: err
24771
24797
  }
24772
24798
  });
24773
24799
  });
@@ -24839,7 +24865,8 @@ class ConversationProducer {
24839
24865
  this.emit({
24840
24866
  type: 'error',
24841
24867
  payload: {
24842
- type: 'join_channel_erred'
24868
+ type: 'join_channel_erred',
24869
+ error: err
24843
24870
  }
24844
24871
  });
24845
24872
  this.emit({
@@ -25571,7 +25598,7 @@ function store_createStore({
25571
25598
  api
25572
25599
  }), options_middleware_createMiddleware({
25573
25600
  api
25574
- }), translations_middleware_createMiddleware()]
25601
+ }), translations_middleware_createMiddleware]
25575
25602
  });
25576
25603
  return store;
25577
25604
  }
@@ -25846,8 +25873,11 @@ class ExternalApi {
25846
25873
  return this.appConfig(userConfig);
25847
25874
  }
25848
25875
 
25876
+ const defaults = external_api_objectSpread(external_api_objectSpread({}, this.appConfig.defaults), userConfig.defaults);
25877
+
25849
25878
  return external_api_objectSpread(external_api_objectSpread(external_api_objectSpread({}, this.appConfig), userConfig), {}, {
25850
- api: external_api_objectSpread(external_api_objectSpread({}, this.appConfig.api), userConfig.api)
25879
+ api: external_api_objectSpread(external_api_objectSpread({}, this.appConfig.api), userConfig.api),
25880
+ defaults: Object.keys(defaults).length ? defaults : undefined
25851
25881
  });
25852
25882
  }
25853
25883