<commit_before>import React, { Component } from 'react'

import Loading from '../components/Loading'
import CreateAccountService from '../components/services/CreateAccountService'
import ServiceBar from '../components/services/ServiceBar'
import ServiceKonnectorsList from '../components/services/ServiceKonnectorsList'

export default class IntentService extends Component {
  constructor(props, context) {
    super(props, context)
    this.store = context.store

    const { window } = props

    this.state = {
      isFetching: true
    }

    // Maybe the logic about getting the intent from location.search should be
    // encapsulated in cozy.client.createService
    const intent = window.location.search.split('=')[1]

    this.store
      .fetchInitialData(props.data.cozyDomain, 7200)
      .then(() => this.store.createIntentService(intent, window))
      .then(service => {
        const data = service.getData()
        if (!data) {
          throw new Error('Unexpected data from intent')
        }

        this.setState({
          service: service,
          disableSuccessTimeout: !!data.disableSuccessTimeout,
          closeable: data.closeable !== undefined ? data.closeable : true
        })

        if (data.slug) {
          return this.store
            .fetchKonnectorInfos(data.slug)
            .then(konnector => [konnector])
        } else if (data.dataType) {
          return this.store.findByDataType(data.dataType)<commit_msg>✨ feat: possible to filter by category<commit_after>import React, { Component } from 'react'

import Loading from '../components/Loading'
import CreateAccountService from '../components/services/CreateAccountService'
import ServiceBar from '../components/services/ServiceBar'
import ServiceKonnectorsList from '../components/services/ServiceKonnectorsList'

export default class IntentService extends Component {
  constructor(props, context) {
    super(props, context)
    this.store = context.store

    const { window } = props

    this.state = {
      isFetching: true
    }

    // Maybe the logic about getting the intent from location.search should be
    // encapsulated in cozy.client.createService
    const intent = window.location.search.split('=')[1]

    this.store
      .fetchInitialData(props.data.cozyDomain, 7200)
      .then(() => this.store.createIntentService(intent, window))
      .then(service => {
        const data = service.getData()
        if (!data) {
          throw new Error('Unexpected data from intent')
        }

        this.setState({
          service: service,
          disableSuccessTimeout: !!data.disableSuccessTimeout,
          closeable: data.closeable !== undefined ? data.closeable : true
        })

        if (data.slug) {
          return this.store
            .fetchKonnectorInfos(data.slug)
            .then(konnector => [konnector])
        } else if (data.dataType) {
          return this.store.findByDataType(data.dataType)
        } else if (data.category) {
          return this.store.findByCategory(data.category)
{'fraction_non_alphanumeric': 0.10567771578601903, 'fraction_numerical': 0.0032819166393173614, 'mean_word_length': 2.762962962962963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4130262', 'n_tokens_mistral': 814, 'n_tokens_neox': 800, 'n_words': 202}