<commit_before>const ActionButton = require('./action_button')
const Carousel = require('./carousel')
const utils = require('./_utils')

module.exports = {
  id: 'builtin_card',
  group: 'Built-in Messages',
  title: 'card',

  jsonSchema: {
    description: 'module.builtin.types.card.description',
    type: 'object',
    required: ['title'],
    properties: {
      title: {
        type: 'string',
        title: 'title'
      },
      subtitle: {
        type: 'string',
        title: 'subtitle'
      },
      image: {
        type: 'string',
        $subtype: 'media',
        $filter: '.jpg, .png, .jpeg, .gif, .bmp, .tif, .tiff|image/*',
        title: 'image'
      },
      actions: {
        type: 'array',
        title: 'module.builtin.actionButton',
        items: ActionButton.jsonSchema
      }
    }
  },

  uiSchema: {},

  computePreviewText: formData => formData.title && `Card: ${formData.title}`,
  renderElement: (data, channel) => {
    // These channels now use channel renderers
    if (['telegram', 'twilio', 'slack', 'smooch', 'vonage'].includes(channel)) {
      return utils.extractPayload('card', data)
    }

    return Carousel.renderElement({ items: [data], ...data }, channel)
  }
}
<commit_msg>fix(builtin): fix card image subtype (#4996)<commit_after>const ActionButton = require('./action_button')
const Carousel = require('./carousel')
const utils = require('./_utils')

module.exports = {
  id: 'builtin_card',
  group: 'Built-in Messages',
  title: 'card',

  jsonSchema: {
    description: 'module.builtin.types.card.description',
    type: 'object',
    required: ['title'],
    properties: {
      title: {
        type: 'string',
        title: 'title'
      },
      subtitle: {
        type: 'string',
        title: 'subtitle'
      },
      image: {
        type: 'string',
        $subtype: 'image',
        $filter: '.jpg, .png, .jpeg, .gif, .bmp, .tif, .tiff|image/*',
        title: 'image'
      },
      actions: {
        type: 'array',
        title: 'module.builtin.actionButton',
        items: ActionButton.jsonSchema
      }
    }
  },

  uiSchema: {},

  computePreviewText: formData => formData.title && `Card: ${formData.title}`,
  renderElement: (data, channel) => {
    // These channels now use channel renderers
    if (['telegram', 'twilio', 'slack', 'smooch', 'vonage'].includes(channel)) {
      return utils.extractPayload('card', data)
    }

    return Carousel.renderElement({ items: [data], ...data }, channel)
  }
}

{'fraction_non_alphanumeric': 0.17074148296593186, 'fraction_numerical': 0.0016032064128256513, 'mean_word_length': 2.5454545454545454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6803341', 'n_tokens_mistral': 796, 'n_tokens_neox': 789, 'n_words': 179}