How to use @commercetools-frontend/notifications - 5 common examples

To help you get started, we’ve selected a few @commercetools-frontend/notifications examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commercetools / merchant-center-application-kit / packages / actions-global / src / global.js View on Github external
if (notification.domain) {
      if (!Object.values(DOMAINS).includes(notification.domain))
        // eslint-disable-next-line no-console
        console.warn(
          `Unknown notification domain "${notification.domain}"`,
          notification
        );
    }
    // eslint-disable-next-line no-console
    else console.warn('Notification is missing domain', notification);

  let dismissAfter = meta.dismissAfter;
  if (!isNumber(dismissAfter))
    dismissAfter = notification.kind === 'success' ? 5000 : 0;

  return addNotification(notification, { ...meta, dismissAfter });
}
github commercetools / merchant-center-application-kit / packages / actions-global / src / actions / show-notification.ts View on Github external
if (!Object.values(NOTIFICATION_DOMAINS).includes(notification.domain))
        // eslint-disable-next-line no-console
        console.warn(
          `Unknown notification domain "${notification.domain}"`,
          notification
        );
    }
    // eslint-disable-next-line no-console
    else console.warn('Notification is missing domain', notification);

  let dismissAfter = meta.dismissAfter;
  if (!isNumber(dismissAfter))
    dismissAfter =
      notification.kind === NOTIFICATION_KINDS_SIDE.success ? 5000 : 0;

  return addNotification>(notification, {
    ...meta,
    dismissAfter,
  });
}
github commercetools / merchant-center-application-kit / src / middleware / hide-notifications.js View on Github external
selectPageNotifications(state).forEach(notification =>
      next(removeNotification(notification.id))
    );

@commercetools-frontend/notifications

A general-purpose notification system built on top of redux

MIT
Latest version published 2 days ago

Package Health Score

87 / 100
Full package analysis