@majoo-ui/react 1.60.37-rc.3 → 1.60.37-rc.4

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.
Files changed (3) hide show
  1. package/index.esm.js +10 -10
  2. package/index.umd.js +10 -10
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -7101,7 +7101,7 @@ const ToastProvider = ({
7101
7101
  translations
7102
7102
  }) => {
7103
7103
  console.warn({
7104
- translations
7104
+ providerTranslations: translations
7105
7105
  });
7106
7106
  const isOnline = useNavigatorOnLine();
7107
7107
  const [toasts, setToasts] = useState([]);
@@ -7109,10 +7109,10 @@ const ToastProvider = ({
7109
7109
  t,
7110
7110
  i18n
7111
7111
  } = useTranslation(['MajooUI/toast', 'translation']);
7112
- const catchError$1 = useCallback((e, values) => {
7112
+ const catchError$1 = useCallback((e, values, trans) => {
7113
7113
  let errorMsg = catchError(e);
7114
- if (translations && translations[errorMsg]) {
7115
- errorMsg = translations[errorMsg][i18n.language];
7114
+ if (trans && trans[errorMsg]) {
7115
+ errorMsg = trans[errorMsg][i18n.language];
7116
7116
  }
7117
7117
  if (values) {
7118
7118
  Object.keys(values).forEach(key => {
@@ -7120,13 +7120,13 @@ const ToastProvider = ({
7120
7120
  });
7121
7121
  }
7122
7122
  console.warn({
7123
- translations,
7123
+ trans,
7124
7124
  e,
7125
7125
  errorMsg
7126
7126
  });
7127
7127
  return errorMsg;
7128
7128
  }, [translations, i18n.language]);
7129
- const createToastInstance = useCallback(toast => {
7129
+ const createToastInstance = useCallback((toast, trans) => {
7130
7130
  const {
7131
7131
  id,
7132
7132
  disabledOfflineIntercept
@@ -7147,20 +7147,20 @@ const ToastProvider = ({
7147
7147
  console.warn({
7148
7148
  toast,
7149
7149
  isValidElement: /*#__PURE__*/React.isValidElement(toast.description),
7150
- translations
7150
+ trans
7151
7151
  });
7152
7152
  return Object.assign({
7153
7153
  id: toastId,
7154
7154
  position: TOP_RIGHT_POSITION
7155
7155
  }, rest, {
7156
- description: /*#__PURE__*/React.isValidElement(toast.description) ? toast.description : catchError$1(toast.description, toast.values)
7156
+ description: /*#__PURE__*/React.isValidElement(toast.description) ? toast.description : catchError$1(toast.description, toast.values, trans)
7157
7157
  }, !isOnline && !disabledOfflineIntercept && offlineInstance);
7158
7158
  }, [isOnline, t, translations, i18n.language]);
7159
7159
  const addToast = React.useCallback(toast => {
7160
7160
  console.warn({
7161
- translations
7161
+ addToastTranslations: translations
7162
7162
  });
7163
- const toastInstance = createToastInstance(toast);
7163
+ const toastInstance = createToastInstance(toast, translations);
7164
7164
  setToasts(toastItems => {
7165
7165
  if (!toastItems.some(currToast => toast.id === currToast.id) || !toast.preventDuplicate) {
7166
7166
  return [...toastItems, toastInstance];
package/index.umd.js CHANGED
@@ -7193,7 +7193,7 @@
7193
7193
  translations
7194
7194
  }) => {
7195
7195
  console.warn({
7196
- translations
7196
+ providerTranslations: translations
7197
7197
  });
7198
7198
  const isOnline = useNavigatorOnLine();
7199
7199
  const [toasts, setToasts] = React.useState([]);
@@ -7201,10 +7201,10 @@
7201
7201
  t,
7202
7202
  i18n
7203
7203
  } = reactI18next.useTranslation(['MajooUI/toast', 'translation']);
7204
- const catchError$1 = React.useCallback((e, values) => {
7204
+ const catchError$1 = React.useCallback((e, values, trans) => {
7205
7205
  let errorMsg = catchError(e);
7206
- if (translations && translations[errorMsg]) {
7207
- errorMsg = translations[errorMsg][i18n.language];
7206
+ if (trans && trans[errorMsg]) {
7207
+ errorMsg = trans[errorMsg][i18n.language];
7208
7208
  }
7209
7209
  if (values) {
7210
7210
  Object.keys(values).forEach(key => {
@@ -7212,13 +7212,13 @@
7212
7212
  });
7213
7213
  }
7214
7214
  console.warn({
7215
- translations,
7215
+ trans,
7216
7216
  e,
7217
7217
  errorMsg
7218
7218
  });
7219
7219
  return errorMsg;
7220
7220
  }, [translations, i18n.language]);
7221
- const createToastInstance = React.useCallback(toast => {
7221
+ const createToastInstance = React.useCallback((toast, trans) => {
7222
7222
  const {
7223
7223
  id,
7224
7224
  disabledOfflineIntercept
@@ -7239,20 +7239,20 @@
7239
7239
  console.warn({
7240
7240
  toast,
7241
7241
  isValidElement: /*#__PURE__*/React__namespace.isValidElement(toast.description),
7242
- translations
7242
+ trans
7243
7243
  });
7244
7244
  return Object.assign({
7245
7245
  id: toastId,
7246
7246
  position: TOP_RIGHT_POSITION
7247
7247
  }, rest, {
7248
- description: /*#__PURE__*/React__namespace.isValidElement(toast.description) ? toast.description : catchError$1(toast.description, toast.values)
7248
+ description: /*#__PURE__*/React__namespace.isValidElement(toast.description) ? toast.description : catchError$1(toast.description, toast.values, trans)
7249
7249
  }, !isOnline && !disabledOfflineIntercept && offlineInstance);
7250
7250
  }, [isOnline, t, translations, i18n.language]);
7251
7251
  const addToast = React__namespace.useCallback(toast => {
7252
7252
  console.warn({
7253
- translations
7253
+ addToastTranslations: translations
7254
7254
  });
7255
- const toastInstance = createToastInstance(toast);
7255
+ const toastInstance = createToastInstance(toast, translations);
7256
7256
  setToasts(toastItems => {
7257
7257
  if (!toastItems.some(currToast => toast.id === currToast.id) || !toast.preventDuplicate) {
7258
7258
  return [...toastItems, toastInstance];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majoo-ui/react",
3
- "version": "1.60.37-rc.3",
3
+ "version": "1.60.37-rc.4",
4
4
  "dependencies": {
5
5
  "@majoo-ui/core": "^1.31.3",
6
6
  "@majoo-ui/helpers": "^1.30.5",