How to use the @commercetools-frontend/constants.DOMAINS.PAGE function in @commercetools-frontend/constants

To help you get started, we’ve selected a few @commercetools-frontend/constants 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
export function showApiErrorNotification({ errors, source }) {
  return showNotification(
    {
      kind: 'api-error',
      values: {
        source,
        // NOTE: Some sources or errors (e.g. GraphQL) return an array or object.
        // The cast into an array happens here so that consumers can pass both types.
        errors: Array.isArray(errors) ? errors : [errors],
      },
      domain: DOMAINS.PAGE,
    },
    {
      dismissAfter: 0,
    }
  );
}
github commercetools / merchant-center-application-kit / packages / actions-global / src / actions / show-api-error-notification.ts View on Github external
export default function showApiErrorNotification({
  errors,
}: TApiErrorNotificationOptions) {
  return showNotification(
    {
      id: 0,
      domain: DOMAINS.PAGE,
      kind: 'api-error',
      values: {
        // NOTE: Some sources or errors (e.g. GraphQL) return an array or object.
        // The cast into an array happens here so that consumers can pass both types.
        errors: Array.isArray(errors) ? errors : [errors],
      },
    },
    {
      dismissAfter: 0,
    }
  );
}
github commercetools / merchant-center-application-kit / visual-testing-app / src / components / notifications / notifications.visualroute.tsx View on Github external
{'These are not the droids you are looking for!'}
      
    
    
      
        {`It's a trap!`}
      
    
    
      
        {'I am your father.'}
      
    
    
      
        {'Do or do not, there is no try.'}
      
    
    
      
        {'These are not the droids you are looking for!'}
      
    
    
      
        {`It's a trap!`}
      
    
    
      
        {'Do or do not, there is no try.'}
github commercetools / merchant-center-application-kit / packages / application-shell / src / test-utils / test-utils.js View on Github external
const ReduxProviders = ({ children }) => (
    
      
        <div>
          
          
          
          {children}
        </div>
      
    
  );
  ReduxProviders.propTypes = {
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notifications-list / selectors.spec.js View on Github external
it('should select global notifications', () => {
    expect(
      selectGlobalNotifications.resultFunc([
        { domain: DOMAINS.GLOBAL },
        { domain: DOMAINS.PAGE },
      ])
    ).toEqual([{ domain: DOMAINS.GLOBAL }]);
  });
});
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notifications-list / selectors.spec.js View on Github external
it('should select side notifications', () => {
    expect(
      selectSideNotifications.resultFunc([
        { domain: DOMAINS.SIDE },
        { domain: DOMAINS.PAGE },
      ])
    ).toEqual([{ domain: DOMAINS.SIDE }]);
  });
});
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notification-kinds / unexpected-error / unexpected-error.js View on Github external
domain={props.notification.domain}
    onCloseClick={props.dismiss}
  &gt;
    
    {props.notification.values.errorId &amp;&amp; <br>}
    {props.notification.values.errorId &amp;&amp; (
      <span>{`ID (${props.notification.values.errorId})`}</span>
    )}
  
);
UnexpectedErrorNotification.displayName = 'UnexpectedErrorNotification';
UnexpectedErrorNotification.propTypes = {
  dismiss: PropTypes.func.isRequired,
  notification: PropTypes.shape({
    id: PropTypes.number.isRequired,
    domain: PropTypes.oneOf([DOMAINS.PAGE]).isRequired,
    kind: PropTypes.oneOf(['unexpected-error']).isRequired,
    values: PropTypes.shape({ errorId: PropTypes.string }),
  }),
};

export default UnexpectedErrorNotification;
github commercetools / merchant-center-application-kit / packages / actions-global / src / actions / show-unexpected-error-notification.ts View on Github external
export default function showUnexpectedErrorNotification({
  errorId,
}: TAppNotificationValuesUnexpectedError = {}) {
  return showNotification(
    {
      id: 0,
      domain: DOMAINS.PAGE,
      kind: 'unexpected-error',
      values: {
        errorId,
      },
    },
    {
      dismissAfter: 0,
    }
  );
}
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notifications-list / notifications-list.js View on Github external
function mapNotificationToComponent(notification) {
  switch (notification.domain) {
    case DOMAINS.PAGE:
      switch (notification.kind) {
        case 'error':
        case 'warning':
        case 'info':
        case 'success':
          return GenericNotification;
        case 'api-error':
          return ApiErrorNotification;
        case 'unexpected-error':
          return UnexpectedErrorNotification;
        default:
          return null;
      }
    case DOMAINS.GLOBAL:
      switch (notification.kind) {
        case 'error':

@commercetools-frontend/constants

Shared constants for MC applications

MIT
Latest version published 3 days ago

Package Health Score

87 / 100
Full package analysis