Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize for specific application #468

Open
github-actions bot opened this issue Apr 20, 2023 · 0 comments
Open

Customize for specific application #468

github-actions bot opened this issue Apr 20, 2023 · 0 comments
Labels

Comments

@github-actions
Copy link

Customize for specific application

* TODO: Customize for specific application

import { i18n } from 'boot/i18n';

import { GenericOption } from '../data/types/GenericOption';
import { PhoneCountryCode } from '../data/types/PhoneCountryCode';
import COUNTRY_CODES from '../../../enum/COUNTRY_CODES';
import DELIVERY_MEDIUMS from '../../../enum/DELIVERY_MEDIUMS';
import LANGUAGES from '../../../enum/LANGUAGES';
import ROLE from '../../../enum/USER_ROLES';

/**
 * Returns a list of language options for the SelectLanguageField
 * @returns - Array with all available language options
 */
export function availableLanguageOptions(): GenericOption[] {
  return [
    { label: LANGUAGES.DE, value: COUNTRY_CODES.DE },
    { label: LANGUAGES.EN, value: COUNTRY_CODES.EN },
    { label: LANGUAGES.FR, value: COUNTRY_CODES.FR },
    { label: LANGUAGES.IT, value: COUNTRY_CODES.IT },
  ];
}

/**
 * Returns a list of phone number options for the PhoneNumberField
 * @returns - Available phone number options
 * TODO: Customize for specific application
 */
export function availablePhonenNumberOptions(): PhoneCountryCode[] {
  return [
    {
      code: COUNTRY_CODES.CH,
      label: '+41',
      mask: '## ### ## ##',
      value: '+41',
    },
    { code: COUNTRY_CODES.DE, label: '+49', mask: undefined, value: '+49' },
  ];
}

/**
 * Returns a list of all users roles for the corresponding select field
 * @returns - Array with all available user roles
 */
export function availableUserRoles(): GenericOption[] {
  return [
    {
      label: i18n.global.t('fields.authentication.roles.admin'),
      value: ROLE.ADMIN,
    },
    {
      label: i18n.global.t('fields.authentication.roles.user'),
      value: ROLE.USER,
    },
  ];
}

/**
 * Returns the options for how a new user will receive their password, if their
 * account is created by an admin.
 * @returns - Array with all invitation options
 */
export function inviteOptions(): GenericOption[] {
  return [
    {
      label: `${i18n.global.t('fields.authentication.send_email')}`,
      value: JSON.stringify([DELIVERY_MEDIUMS.EMAIL]),
    },
    {
      label: `${i18n.global.t('fields.authentication.send_sms')}`,
      value: JSON.stringify([DELIVERY_MEDIUMS.SMS]),
    },
    {
      label: `${i18n.global.t('fields.authentication.send_both')}`,
      value: JSON.stringify([DELIVERY_MEDIUMS.EMAIL, DELIVERY_MEDIUMS.SMS]),
    },
    {
      label: `${i18n.global.t('fields.authentication.send_custom_email')}`,
      value: JSON.stringify([DELIVERY_MEDIUMS.CUSTOM_EMAIL]),
    },
    {
      label: `${i18n.global.t('fields.authentication.send_no_invite')}`,
      value: JSON.stringify([]),
    },
  ];
}

2a6d71fe4550fc8c27a374369229307e8dfa38cd

@github-actions github-actions bot added the todo label Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants